Changeset 87403 in vbox
- Timestamp:
- Jan 23, 2021 4:11:18 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142391
- Location:
- trunk
- Files:
-
- 2 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-amd64-x86.h
r87402 r87403 84 84 # pragma intrinsic(__rdtscp) 85 85 # endif 86 # if defined(RT_ARCH_AMD64) && RT_INLINE_ASM_USES_INTRIN >= RT_MSC_VER_VS2015 /*?*/ 87 # pragma intrinsic(_readfsbase_u64) 88 # pragma intrinsic(_readgsbase_u64) 89 # pragma intrinsic(_writefsbase_u64) 90 # pragma intrinsic(_writegsbase_u64) 91 # endif 86 92 #endif 87 93 … … 409 415 # endif 410 416 417 #ifdef RT_ARCH_AMD64 418 419 /** 420 * Get the FS base register. 421 * @returns FS base address. 422 */ 423 #if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < RT_MSC_VER_VS2015 /*?*/ 424 DECLASM(uint64_t) ASMGetFSBase(void); 425 #else 426 DECLINLINE(uint64_t) ASMGetFSBase(void) 427 { 428 # if RT_INLINE_ASM_USES_INTRIN >= RT_MSC_VER_VS2015 429 return (uint64_t)_readfsbase_u64(); 430 # elif RT_INLINE_ASM_GNU_STYLE 431 uint64_t uFSBase; 432 __asm__ __volatile__("rdfsbase %0\n\t" : "=r" (uFSBase)); 433 return uFSBase; 434 # endif 435 } 436 # endif 437 438 439 /** 440 * Set the FS base register. 441 * @param uNewBase The new base value. 442 */ 443 #if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < RT_MSC_VER_VS2015 /*?*/ 444 DECLASM(void) ASMSetFSBase(uint64_t uNewBase); 445 #else 446 DECLINLINE(void) ASMSetFSBase(uint64_t uNewBase) 447 { 448 # if RT_INLINE_ASM_USES_INTRIN >= RT_MSC_VER_VS2015 449 _writefsbase_u64(uNewBase); 450 # elif RT_INLINE_ASM_GNU_STYLE 451 __asm__ __volatile__("wrfsbase %0\n\t" : : "r" (uNewBase)); 452 # endif 453 } 454 # endif 455 456 #endif /* RT_ARCH_AMD64 */ 411 457 412 458 /** … … 432 478 } 433 479 #endif 480 481 #ifdef RT_ARCH_AMD64 482 483 /** 484 * Get the GS base register. 485 * @returns GS base address. 486 */ 487 #if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < RT_MSC_VER_VS2015 /*?*/ 488 DECLASM(uint64_t) ASMGetGSBase(void); 489 #else 490 DECLINLINE(uint64_t) ASMGetGSBase(void) 491 { 492 # if RT_INLINE_ASM_USES_INTRIN >= RT_MSC_VER_VS2015 493 return (uint64_t)_readgsbase_u64(); 494 # elif RT_INLINE_ASM_GNU_STYLE 495 uint64_t uGSBase; 496 __asm__ __volatile__("rdgsbase %0\n\t" : "=r" (uGSBase)); 497 return uGSBase; 498 # endif 499 } 500 # endif 501 502 503 /** 504 * Set the GS base register. 505 * @param uNewBase The new base value. 506 */ 507 #if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < RT_MSC_VER_VS2015 /*?*/ 508 DECLASM(void) ASMSetGSBase(uint64_t uNewBase); 509 #else 510 DECLINLINE(void) ASMSetGSBase(uint64_t uNewBase) 511 { 512 # if RT_INLINE_ASM_USES_INTRIN >= RT_MSC_VER_VS2015 513 _writegsbase_u64(uNewBase); 514 # elif RT_INLINE_ASM_GNU_STYLE 515 __asm__ __volatile__("wrgsbase %0\n\t" : : "r" (uNewBase)); 516 # endif 517 } 518 # endif 519 520 #endif /* RT_ARCH_AMD64 */ 434 521 435 522 -
trunk/src/VBox/Runtime/Makefile.kmk
r87235 r87403 239 239 common/asm/ASMGetLDTR.asm \ 240 240 common/asm/ASMGetSegAttr.asm \ 241 common/asm/ASMGetTR.asm 241 common/asm/ASMGetFSBase.asm \ 242 common/asm/ASMSetFSBase.asm \ 243 common/asm/ASMGetGSBase.asm \ 244 common/asm/ASMSetGSBase.asm \ 245 common/asm/ASMGetTR.asm \ 242 246 243 247 # -
trunk/src/VBox/Runtime/common/asm/ASMGetFSBase.asm
r87387 r87403 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASMGet TR().3 ; IPRT - ASMGetFSBase(). 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-202 0Oracle Corporation7 ; Copyright (C) 2006-2021 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 ;* Header Files * 29 29 ;******************************************************************************* 30 %define RT_ASM_WITH_SEH64 30 31 %include "iprt/asmdefs.mac" 31 32 … … 33 34 34 35 ;; 35 ; Get the TRregister.36 ; @returns TR.36 ; Get the FS base register. 37 ; @returns FS base 37 38 ; 38 BEGINPROC_EXPORTED ASMGet TR39 str ax40 movzx eax,ax39 BEGINPROC_EXPORTED ASMGetFSBase 40 SEH64_END_PROLOGUE 41 rdfsbase rax 41 42 ret 42 ENDPROC ASMGet TR43 ENDPROC ASMGetFSBase 43 44 -
trunk/src/VBox/Runtime/common/asm/ASMGetGSBase.asm
r87387 r87403 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASMGet TR().3 ; IPRT - ASMGetGSBase(). 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-202 0Oracle Corporation7 ; Copyright (C) 2006-2021 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 ;* Header Files * 29 29 ;******************************************************************************* 30 %define RT_ASM_WITH_SEH64 30 31 %include "iprt/asmdefs.mac" 31 32 … … 33 34 34 35 ;; 35 ; Get the TRregister.36 ; @returns TR.36 ; Get the GS base register. 37 ; @returns GS base 37 38 ; 38 BEGINPROC_EXPORTED ASMGet TR39 str ax40 movzx eax,ax39 BEGINPROC_EXPORTED ASMGetGSBase 40 SEH64_END_PROLOGUE 41 rdgsbase rax 41 42 ret 42 ENDPROC ASMGet TR43 ENDPROC ASMGetGSBase 43 44 -
trunk/src/VBox/Runtime/common/asm/ASMSetFSBase.asm
r87387 r87403 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASM GetTR().3 ; IPRT - ASMSetFSBase(). 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-202 0Oracle Corporation7 ; Copyright (C) 2006-2021 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 ;* Header Files * 29 29 ;******************************************************************************* 30 %define RT_ASM_WITH_SEH64 30 31 %include "iprt/asmdefs.mac" 31 32 … … 33 34 34 35 ;; 35 ; Get the TRregister.36 ; @ returns TR.36 ; Set the FS base register. 37 ; @param uNewBase msc:rcx gcc:rdi New FS base value. 37 38 ; 38 BEGINPROC_EXPORTED ASMGetTR 39 str ax 40 movzx eax, ax 39 BEGINPROC_EXPORTED ASMSetFSBase 40 SEH64_END_PROLOGUE 41 %ifdef ASM_CALL64_MSC 42 wrfsbase rcx 43 %else 44 wrfsbase rdi 45 %endif 41 46 ret 42 ENDPROC ASM GetTR47 ENDPROC ASMSetFSBase 43 48 -
trunk/src/VBox/Runtime/common/asm/ASMSetGSBase.asm
r87387 r87403 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASM GetTR().3 ; IPRT - ASMSetGSBase(). 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-202 0Oracle Corporation7 ; Copyright (C) 2006-2021 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 ;* Header Files * 29 29 ;******************************************************************************* 30 %define RT_ASM_WITH_SEH64 30 31 %include "iprt/asmdefs.mac" 31 32 … … 33 34 34 35 ;; 35 ; Get the TRregister.36 ; @ returns TR.36 ; Set the GS base register. 37 ; @param uNewBase msc:rcx gcc:rdi New GS base value. 37 38 ; 38 BEGINPROC_EXPORTED ASMGetTR 39 str ax 40 movzx eax, ax 39 BEGINPROC_EXPORTED ASMSetGSBase 40 SEH64_END_PROLOGUE 41 %ifdef ASM_CALL64_MSC 42 wrgsbase rcx 43 %else 44 wrgsbase rdi 45 %endif 41 46 ret 42 ENDPROC ASM GetTR47 ENDPROC ASMSetGSBase 43 48
Note:
See TracChangeset
for help on using the changeset viewer.