vbox的更動 7286 路徑 trunk/src/VBox/VMM/VMMGC/EMGCA.asm
- 時間撮記:
- 2008-3-5 上午08:06:41 (17 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMGC/EMGCA.asm
-
屬性 svn:eol-style
設為
native
r5999 r7286 26 26 27 27 ;; 28 ; Emulate lockCMPXCHG instruction, CDECL calling conv.28 ; Emulate LOCK CMPXCHG instruction, CDECL calling conv. 29 29 ; EMGCDECL(uint32_t) EMGCEmulateLockCmpXchg(RTGCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize, uint32_t *pEflags); 30 30 ; … … 165 165 ret 166 166 ENDPROC EMGCEmulateCmpXchg 167 168 ;; 169 ; Emulate LOCK XADD instruction, CDECL calling conv. 170 ; EMGCDECL(uint32_t) EMGCEmulateLockXAdd(RTGCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize, uint32_t *pEflags); 171 ; 172 ; @returns eax=0 if data exchanged, other code - invalid access, #PF was generated. 173 ; @param [esp + 04h] Param 1 - First parameter - pointer to first parameter 174 ; @param [esp + 08h] Param 2 - Second parameter - pointer to second parameter (general register) 175 ; @param [esp + 0ch] Param 3 - Size of parameters, only 1/2/4 is valid. 176 ; @param [esp + 10h] Param 4 - Pointer to eflags (out) 177 ; @uses eax, ecx, edx 178 ; 179 align 16 180 BEGINPROC EMGCEmulateLockXAdd 181 push ebx 182 mov ecx, [esp + 04h + 4] ; ecx = first parameter 183 mov ebx, [esp + 08h + 4] ; ebx = 2nd parameter 184 mov eax, [esp + 0ch + 4] ; eax = size of parameters 185 186 cmp al, 4 187 je short .do_dword ; 4 bytes variant 188 cmp al, 2 189 je short .do_word ; 2 byte variant 190 cmp al, 1 191 je short .do_byte ; 1 bytes variant 192 int3 193 194 .do_dword: 195 ; load 2nd parameter's value 196 mov eax, dword [ebx] 197 lock xadd dword [ecx], eax ; do 4 bytes XADD 198 mov dword [ebx], eax 199 jmp short .done 200 201 .do_word: 202 ; load 2nd parameter's value 203 mov eax, dword [ebx] 204 lock xadd word [ecx], ax ; do 2 bytes XADD 205 mov word [ebx], ax 206 jmp short .done 207 208 .do_byte: 209 ; load 2nd parameter's value 210 mov eax, dword [ebx] 211 lock xadd byte [ecx], al ; do 1 bytes XADD 212 mov byte [ebx], al 213 214 .done: 215 ; collect flags and return. 216 pushf 217 pop eax 218 219 mov edx, [esp + 10h + 4] ; eflags pointer 220 mov dword [edx], eax 221 222 pop ebx 223 mov eax, VINF_SUCCESS 224 retn 225 226 ; Read error - we will be here after our page fault handler. 227 GLOBALNAME EMGCEmulateLockXAdd_Error 228 pop ebx 229 mov eax, VERR_ACCESS_DENIED 230 ret 231 232 ENDPROC EMGCEmulateLockXAdd 233 234 ;; 235 ; Emulate XADD instruction, CDECL calling conv. 236 ; EMGCDECL(uint32_t) EMGCEmulateXAdd(RTGCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize, uint32_t *pEflags); 237 ; 238 ; @returns eax=0 if data written, other code - invalid access, #PF was generated. 239 ; @param [esp + 04h] Param 1 - First parameter - pointer to first parameter 240 ; @param [esp + 08h] Param 2 - Second parameter - pointer to second parameter (general register) 241 ; @param [esp + 0ch] Param 3 - Size of parameters, only 1/2/4 is valid. 242 ; @param [esp + 10h] Param 4 - Pointer to eflags (out) 243 ; @uses eax, ecx, edx 244 ; 245 align 16 246 BEGINPROC EMGCEmulateXAdd 247 push ebx 248 mov ecx, [esp + 04h + 4] ; ecx = first parameter 249 mov ebx, [esp + 08h + 4] ; ebx = 2nd parameter (eax) 250 mov eax, [esp + 0ch + 4] ; eax = size of parameters 251 252 cmp al, 4 253 je short .do_dword ; 4 bytes variant 254 cmp al, 2 255 je short .do_word ; 2 byte variant 256 cmp al, 1 257 je short .do_byte ; 1 bytes variant 258 int3 259 260 .do_dword: 261 ; load 2nd parameter's value 262 mov eax, dword [ebx] 263 xadd dword [ecx], eax ; do 4 bytes XADD 264 mov dword [ebx], eax 265 jmp short .done 266 267 .do_word: 268 ; load 2nd parameter's value 269 mov eax, dword [ebx] 270 xadd word [ecx], ax ; do 2 bytes XADD 271 mov word [ebx], ax 272 jmp short .done 273 274 .do_byte: 275 ; load 2nd parameter's value 276 mov eax, dword [ebx] 277 xadd byte [ecx], al ; do 1 bytes XADD 278 mov byte [ebx], al 279 280 .done: 281 ; collect flags and return. 282 pushf 283 pop eax 284 285 mov edx, [esp + 10h + 4] ; eflags pointer 286 mov dword [edx], eax 287 288 pop ebx 289 mov eax, VINF_SUCCESS 290 retn 291 292 ; Read error - we will be here after our page fault handler. 293 GLOBALNAME EMGCEmulateXAdd_Error 294 pop ebx 295 mov eax, VERR_ACCESS_DENIED 296 ret 297 ENDPROC EMGCEmulateXAdd -
屬性 svn:eol-style
設為
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器