VirtualBox

Changeset 55107 in vbox


Ignore:
Timestamp:
Apr 6, 2015 11:34:45 PM (9 years ago)
Author:
vboxsync
Message:

asm-amd64-x86.h: Added ASMGetXcr0 & ASMSetXcr0.

Location:
trunk
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-amd64-x86.h

    r54260 r55107  
    17271727
    17281728/**
     1729 * Get XCR0 (eXtended feature Control Register 0).
     1730 * @returns xcr0.
     1731 */
     1732DECLASM(uint64_t) ASMGetXcr0(void);
     1733
     1734
     1735/**
     1736 * Sets the XCR0 register.
     1737 * @param   uXcr0   The new XCR0 value.
     1738 */
     1739DECLASM(void) ASMSetXcr0(uint64_t uXcr0);
     1740
     1741
     1742/**
    17291743 * Enables interrupts (EFLAGS.IF).
    17301744 */
  • trunk/src/VBox/Runtime/Makefile.kmk

    r55095 r55107  
    655655        common/asm/ASMRdMsrEx.asm \
    656656        common/asm/ASMWrMsrEx.asm \
     657        common/asm/ASMGetXcr0.asm \
     658        common/asm/ASMSetXcr0.asm \
    657659        common/math/bignum-amd64-x86.asm
    658660RuntimeR3_SOURCES.amd64 += \
     
    666668        common/asm/ASMRdMsrEx.asm \
    667669        common/asm/ASMWrMsrEx.asm \
     670        common/asm/ASMGetXcr0.asm \
     671        common/asm/ASMSetXcr0.asm \
    668672        common/math/bignum-amd64-x86.asm \
    669673        common/math/RTUInt128MulByU64.asm
     
    16941698        common/asm/ASMAtomicUoOrU64.asm \
    16951699        common/asm/ASMAtomicUoOrU32.asm \
     1700        common/asm/ASMGetXcr0.asm \
     1701        common/asm/ASMSetXcr0.asm \
    16961702        common/asm/ASMRdMsrEx.asm \
    16971703        common/asm/ASMWrMsrEx.asm
     
    17041710        common/asm/ASMAtomicUoOrU64.asm \
    17051711        common/asm/ASMAtomicUoOrU32.asm \
     1712        common/asm/ASMGetXcr0.asm \
     1713        common/asm/ASMSetXcr0.asm \
    17061714        common/asm/ASMRdMsrEx.asm \
    17071715        common/asm/ASMWrMsrEx.asm
  • trunk/src/VBox/Runtime/common/asm/ASMGetXcr0.asm

    r55084 r55107  
    11; $Id$
    22;; @file
    3 ; IPRT - ASMGetGDTR().
     3; IPRT - ASMGetXcr0().
    44;
    55
    66;
    7 ; Copyright (C) 2006-2013 Oracle Corporation
     7; Copyright (C) 2006-2015 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
     
    3333
    3434;;
    35 ; Gets the content of the GDTR CPU register.
    36 ; @param   pGdtr    Where to store the GDTR contents.
    37 ;                   msc=rcx, gcc=rdi, x86=[esp+4]
     35; Gets the content of the XCR0 CPU register.
     36; @returns XCR0 value in rax (amd64) / edx:eax (x86).
    3837;
    39 BEGINPROC_EXPORTED ASMGetGDTR
    40 %ifdef ASM_CALL64_MSC
    41         mov     rax, rcx
    42 %elifdef ASM_CALL64_GCC
    43         mov     rax, rdi
    44 %elifdef RT_ARCH_X86
    45         mov     eax, [esp + 4]
    46 %else
    47  %error "Undefined arch?"
     38BEGINPROC_EXPORTED ASMGetXcr0
     39        xor     ecx, ecx                ; XCR0
     40        xgetbv
     41%ifdef RT_ARCH_AMD64
     42        shl     rdx, 32
     43        or      rax, rdx
    4844%endif
    49         sgdt    [xAX]
    5045        ret
    51 ENDPROC ASMGetGDTR
     46ENDPROC ASMGetXcr0
    5247
  • trunk/src/VBox/Runtime/common/asm/ASMSetXcr0.asm

    r55084 r55107  
    11; $Id$
    22;; @file
    3 ; IPRT - ASMSetGDTR().
     3; IPRT - ASMSetXcr0().
    44;
    55
    66;
    7 ; Copyright (C) 2006-2014 Oracle Corporation
     7; Copyright (C) 2006-2015 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
     
    3333
    3434;;
    35 ; Sets the content of the GDTR CPU register.
    36 ; @param   pGdtr    Where to load the GDTR contents from.
     35; Sets the content of the Xcr0 CPU register.
     36; @param   uXcr0    The new XCR0 content.
    3737;                   msc=rcx, gcc=rdi, x86=[esp+4]
    3838;
    39 BEGINPROC_EXPORTED ASMSetGDTR
     39BEGINPROC_EXPORTED ASMSetXcr0
    4040%ifdef ASM_CALL64_MSC
    41         mov     rax, rcx
     41        mov     rdx, rcx
     42        shr     rdx, 32
     43        mov     eax, ecx
    4244%elifdef ASM_CALL64_GCC
    43         mov     rax, rdi
     45        mov     rdx, rdi
     46        shr     rdx, 32
     47        mov     eax, edi
    4448%elifdef RT_ARCH_X86
    4549        mov     eax, [esp + 4]
     50        mov     edx, [esp + 8]
    4651%else
    4752 %error "Undefined arch?"
    4853%endif
    49         lgdt    [xAX]
     54        xor     ecx, ecx
     55        xsetbv
    5056        ret
    51 ENDPROC ASMSetGDTR
     57ENDPROC ASMSetXcr0
    5258
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette