vbox的更動 112 路徑 trunk/src/VBox/VMM/VMMAll/CPUMAllA.asm
- 時間撮記:
- 2007-1-17 下午04:04:27 (18 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMAll/CPUMAllA.asm
r19 r112 97 97 %ifdef __AMD64__ 98 98 %ifdef __WIN__ 99 mov CPUM_REG, rcx99 mov xDX, rcx 100 100 %else 101 mov CPUM_REG, rdi101 mov xDX, rdi 102 102 %endif 103 103 %else 104 mov CPUM_REG, dword [esp + 4]105 %endif 106 test dword [ CPUM_REG+ CPUM.fUseFlags], CPUM_USED_FPU104 mov xDX, dword [esp + 4] 105 %endif 106 test dword [xDX + CPUM.fUseFlags], CPUM_USED_FPU 107 107 jz hlfpua_not_loaded 108 108 jmp hlfpua_to_host … … 113 113 align 16 114 114 hlfpua_not_loaded: 115 mov eax, [ CPUM_REG+ CPUM.Guest.cr0]115 mov eax, [xDX + CPUM.Guest.cr0] 116 116 and eax, X86_CR0_MP | X86_CR0_EM | X86_CR0_TS 117 117 %ifdef __AMD64__ … … 134 134 ;; and mask for cr0. 135 135 hlfpu_afFlags: 136 dd~(X86_CR0_TS | X86_CR0_MP)137 dd~(X86_CR0_TS)138 dd~(X86_CR0_TS | X86_CR0_MP)139 dd~(X86_CR0_TS)140 dd~(X86_CR0_MP)141 dd0142 dd~(X86_CR0_MP)143 dd0136 RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP) 137 RTCCPTR_DEF ~(X86_CR0_TS) 138 RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP) 139 RTCCPTR_DEF ~(X86_CR0_TS) 140 RTCCPTR_DEF ~(X86_CR0_MP) 141 RTCCPTR_DEF 0 142 RTCCPTR_DEF ~(X86_CR0_MP) 143 RTCCPTR_DEF 0 144 144 145 145 ; … … 149 149 hlfpua_switch_fpu_ctx: 150 150 %ifndef IN_RING3 ; IN_GC or IN_RING0 151 mov ecx, cr0151 mov xCX, cr0 152 152 %ifdef __AMD64__ 153 153 lea r8, [hlfpu_afFlags wrt rip] 154 and ecx, [eax*2+ r8] ; calc the new cr0 flags.154 and rcx, [rax*4 + r8] ; calc the new cr0 flags. 155 155 %else 156 156 and ecx, [eax*2 + hlfpu_afFlags] ; calc the new cr0 flags. 157 157 %endif 158 mov eax, cr0159 and eax, dword~(X86_CR0_TS | X86_CR0_EM)160 mov cr0, eax; clear flags so we don't trap here.158 mov xAX, cr0 159 and xAX, ~(X86_CR0_TS | X86_CR0_EM) 160 mov cr0, xAX ; clear flags so we don't trap here. 161 161 %endif 162 162 %ifndef __AMD64__ 163 test dword [ CPUM_REG+ CPUM.CPUFeatures.edx], X86_CPUID_FEATURE_EDX_FXSR163 test dword [xDX + CPUM.CPUFeatures.edx], X86_CPUID_FEATURE_EDX_FXSR 164 164 jz short hlfpua_no_fxsave 165 165 %endif 166 166 167 fxsave [ CPUM_REG+ CPUM.Host.fpu]168 or dword [ CPUM_REG+ CPUM.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)169 fxrstor [ CPUM_REG+ CPUM.Guest.fpu]167 fxsave [xDX + CPUM.Host.fpu] 168 or dword [xDX + CPUM.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM) 169 fxrstor [xDX + CPUM.Guest.fpu] 170 170 hlfpua_finished_switch: 171 171 %ifdef IN_GC 172 mov cr0, ecx; load the new cr0 flags.172 mov cr0, xCX ; load the new cr0 flags. 173 173 %endif 174 174 ; return continue execution. … … 179 179 ; legacy support. 180 180 hlfpua_no_fxsave: 181 fnsave [ CPUM_REG+ CPUM.Host.fpu]182 or dword [ CPUM_REG+ CPUM.fUseFlags], dword (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM) ; yasm / nasm183 mov eax, [ CPUM_REG+ CPUM.Guest.fpu] ; control word181 fnsave [xDX + CPUM.Host.fpu] 182 or dword [xDX + CPUM.fUseFlags], dword (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM) ; yasm / nasm 183 mov eax, [xDX + CPUM.Guest.fpu] ; control word 184 184 not eax ; 1 means exception ignored (6 LS bits) 185 185 and eax, byte 03Fh ; 6 LS bits only 186 test eax, [ CPUM_REG+ CPUM.Guest.fpu + 4]; status word186 test eax, [xDX + CPUM.Guest.fpu + 4]; status word 187 187 jz short hlfpua_no_exceptions_pending 188 188 ; technically incorrect, but we certainly don't want any exceptions now!! 189 and dword [ CPUM_REG+ CPUM.Guest.fpu + 4], ~03Fh189 and dword [xDX + CPUM.Guest.fpu + 4], ~03Fh 190 190 hlfpua_no_exceptions_pending: 191 frstor [ CPUM_REG+ CPUM.Guest.fpu]191 frstor [xDX + CPUM.Guest.fpu] 192 192 jmp near hlfpua_finished_switch 193 193 %endif ; !__AMD64__ … … 214 214 %ifdef __AMD64__ 215 215 %ifdef __WIN__ 216 mov CPUM_REG, rcx216 mov xDX, rcx 217 217 %else 218 mov CPUM_REG, rdi218 mov xDX, rdi 219 219 %endif 220 220 %else 221 mov CPUM_REG, dword [esp + 4]221 mov xDX, dword [esp + 4] 222 222 %endif 223 223 224 224 ; Restore FPU if guest has used it. 225 225 ; Using fxrstor should ensure that we're not causing unwanted exception on the host. 226 test dword [ CPUM_REG+ CPUM.fUseFlags], CPUM_USED_FPU226 test dword [xDX + CPUM.fUseFlags], CPUM_USED_FPU 227 227 jz short gth_fpu_no 228 228 229 mov eax, cr0230 mov ecx, eax; save old CR0231 and eax, dword~(X86_CR0_TS | X86_CR0_EM)232 mov cr0, eax233 234 fxsave [ CPUM_REG+ CPUM.Guest.fpu]235 fxrstor [ CPUM_REG+ CPUM.Host.fpu]236 237 mov cr0, ecx; and restore old CR0 again238 and dword [ CPUM_REG+ CPUM.fUseFlags], ~CPUM_USED_FPU229 mov xAX, cr0 230 mov xCX, xAX ; save old CR0 231 and xAX, ~(X86_CR0_TS | X86_CR0_EM) 232 mov cr0, xAX 233 234 fxsave [xDX + CPUM.Guest.fpu] 235 fxrstor [xDX + CPUM.Host.fpu] 236 237 mov cr0, xCX ; and restore old CR0 again 238 and dword [xDX + CPUM.fUseFlags], ~CPUM_USED_FPU 239 239 gth_fpu_no: 240 240 xor eax, eax
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器