Index: /trunk/include/iprt/asm-amd64-x86.h
===================================================================
--- /trunk/include/iprt/asm-amd64-x86.h	(revision 55106)
+++ /trunk/include/iprt/asm-amd64-x86.h	(revision 55107)
@@ -1727,4 +1727,18 @@
 
 /**
+ * Get XCR0 (eXtended feature Control Register 0).
+ * @returns xcr0.
+ */
+DECLASM(uint64_t) ASMGetXcr0(void);
+
+
+/**
+ * Sets the XCR0 register.
+ * @param   uXcr0   The new XCR0 value.
+ */
+DECLASM(void) ASMSetXcr0(uint64_t uXcr0);
+
+
+/**
  * Enables interrupts (EFLAGS.IF).
  */
Index: /trunk/src/VBox/Runtime/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Runtime/Makefile.kmk	(revision 55106)
+++ /trunk/src/VBox/Runtime/Makefile.kmk	(revision 55107)
@@ -655,4 +655,6 @@
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
 	common/math/bignum-amd64-x86.asm
 RuntimeR3_SOURCES.amd64 += \
@@ -666,4 +668,6 @@
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
 	common/math/bignum-amd64-x86.asm \
 	common/math/RTUInt128MulByU64.asm
@@ -1694,4 +1698,6 @@
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm
@@ -1704,4 +1710,6 @@
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm
Index: /trunk/src/VBox/Runtime/common/asm/ASMGetXcr0.asm
===================================================================
--- /trunk/src/VBox/Runtime/common/asm/ASMGetXcr0.asm	(revision 55107)
+++ /trunk/src/VBox/Runtime/common/asm/ASMGetXcr0.asm	(revision 55107)
@@ -0,0 +1,47 @@
+; $Id$
+;; @file
+; IPRT - ASMGetXcr0().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Gets the content of the XCR0 CPU register.
+; @returns XCR0 value in rax (amd64) / edx:eax (x86).
+;
+BEGINPROC_EXPORTED ASMGetXcr0
+        xor     ecx, ecx                ; XCR0
+        xgetbv
+%ifdef RT_ARCH_AMD64
+        shl     rdx, 32
+        or      rax, rdx
+%endif
+        ret
+ENDPROC ASMGetXcr0
+
Index: /trunk/src/VBox/Runtime/common/asm/ASMSetXcr0.asm
===================================================================
--- /trunk/src/VBox/Runtime/common/asm/ASMSetXcr0.asm	(revision 55107)
+++ /trunk/src/VBox/Runtime/common/asm/ASMSetXcr0.asm	(revision 55107)
@@ -0,0 +1,58 @@
+; $Id$
+;; @file
+; IPRT - ASMSetXcr0().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Sets the content of the Xcr0 CPU register.
+; @param   uXcr0    The new XCR0 content.
+;                   msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMSetXcr0
+%ifdef ASM_CALL64_MSC
+        mov     rdx, rcx
+        shr     rdx, 32
+        mov     eax, ecx
+%elifdef ASM_CALL64_GCC
+        mov     rdx, rdi
+        shr     rdx, 32
+        mov     eax, edi
+%elifdef RT_ARCH_X86
+        mov     eax, [esp + 4]
+        mov     edx, [esp + 8]
+%else
+ %error "Undefined arch?"
+%endif
+        xor     ecx, ecx
+        xsetbv
+        ret
+ENDPROC ASMSetXcr0
+
