summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime/common/asm
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Runtime/common/asm
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Runtime/common/asm')
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm8
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm4
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm58
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm77
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm57
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicUoOrU64.asm76
-rw-r--r--src/VBox/Runtime/common/asm/ASMCpuIdExSlow.asm137
-rw-r--r--src/VBox/Runtime/common/asm/ASMCpuId_Idx_ECX.asm116
-rw-r--r--src/VBox/Runtime/common/asm/ASMGetGDTR.asm52
-rw-r--r--src/VBox/Runtime/common/asm/ASMGetIDTR.asm52
-rw-r--r--src/VBox/Runtime/common/asm/ASMGetLDTR.asm43
-rw-r--r--src/VBox/Runtime/common/asm/ASMGetSegAttr.asm61
-rw-r--r--src/VBox/Runtime/common/asm/ASMGetTR.asm43
-rw-r--r--src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMNopPause.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMRdMsrEx.asm84
-rw-r--r--src/VBox/Runtime/common/asm/ASMWrMsrEx.asm79
-rw-r--r--src/VBox/Runtime/common/asm/asm-fake.cpp2
20 files changed, 946 insertions, 11 deletions
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
index da71254e..f6963e1f 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
@@ -36,8 +36,8 @@ BEGINCODE
;
; @param pu64 x86:ebp+8 gcc:rdi msc:rcx
; @param u64New x86:ebp+c gcc:rsi msc:rdx
-; @param u64Old x86:ebp+14 gcc:rcx msc:r8
-; @param u64Old x86:ebp+1c gcc:rdx msc:r9
+; @param u64Old x86:ebp+14 gcc:rdx msc:r8
+; @param pu64Old x86:ebp+1c gcc:rcx msc:r9
;
; @returns bool result: true if successfully exchanged, false if not.
; x86:al
@@ -49,9 +49,9 @@ BEGINPROC_EXPORTED ASMAtomicCmpXchgExU64
lock cmpxchg [rcx], rdx
mov [r9], rax
%else
- mov rax, rcx
+ mov rax, rdx
lock cmpxchg [rdi], rsi
- mov [rdx], rax
+ mov [rcx], rax
%endif
setz al
movzx eax, al
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
index d6ee4d69..0474644c 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
@@ -36,7 +36,7 @@ BEGINCODE
;
; @param pu64 x86:ebp+8 gcc:rdi msc:rcx
; @param u64New x86:ebp+c gcc:rsi msc:rdx
-; @param u64Old x86:ebp+14 gcc:rcx msc:r8
+; @param u64Old x86:ebp+14 gcc:rdx msc:r8
;
; @returns bool result: true if successfully exchanged, false if not.
; x86:al
@@ -47,7 +47,7 @@ BEGINPROC_EXPORTED ASMAtomicCmpXchgU64
mov rax, r8
lock cmpxchg [rcx], rdx
%else
- mov rax, rcx
+ mov rax, rdx
lock cmpxchg [rdi], rsi
%endif
setz al
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
index 0c57b29d..55c92c8d 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
@@ -4,7 +4,7 @@
;
;
-; Copyright (C) 2006-2009 Oracle Corporation
+; Copyright (C) 2006-2010 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
index 60d01e32..c7e86e8a 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
@@ -4,7 +4,7 @@
;
;
-; Copyright (C) 2006-2009 Oracle Corporation
+; Copyright (C) 2006-2010 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
new file mode 100644
index 00000000..1e4bb0b9
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
@@ -0,0 +1,58 @@
+; $Id: ASMAtomicUoAndU32.asm $
+;; @file
+; IPRT - ASMAtomicUoAndU32().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Atomically OR an unsigned 32-bit value, unordered.
+;
+; @param pu32 x86:esp+4 gcc:rdi msc:rcx
+; @param u32Or x86:esp+8 gcc:rsi msc:rdx
+;
+; @returns void
+;
+BEGINPROC_EXPORTED ASMAtomicUoAndU32
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+ and [rcx], rdx
+ %else
+ and [rdi], rsi
+ %endif
+%elifdef RT_ARCH_X86
+ mov ecx, [esp + 04h]
+ mov edx, [esp + 08h]
+ and [ecx], edx
+%endif
+ ret
+ENDPROC ASMAtomicUoAndU32
+
+
+
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm
new file mode 100644
index 00000000..7f145c22
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm
@@ -0,0 +1,77 @@
+; $Id: ASMAtomicUoAndU64.asm $
+;; @file
+; IPRT - ASMAtomicUoAndU64().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Atomically AND an unsigned 64-bit value, unordered.
+;
+; @param pu64 x86:ebp+8 gcc:rdi msc:rcx
+; @param u64Or x86:ebp+c gcc:rsi msc:rdx
+;
+; @returns void
+;
+BEGINPROC_EXPORTED ASMAtomicUoAndU64
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+ and [rcx], rdx
+ %else
+ and [rdi], rsi
+ %endif
+%elifdef RT_ARCH_X86
+ push ebp
+ mov ebp, esp
+ push ebx
+ push edi
+
+ mov edi, [ebp + 08h]
+ mov ebx, [ebp + 0ch]
+ mov ecx, [ebp + 0ch + 4]
+ mov eax, ebx
+ mov edx, ecx
+.try_again:
+ cmpxchg8b [edi]
+ jz .done
+ mov ebx, eax
+ and ebx, [ebp + 0ch]
+ mov ecx, edx
+ and ecx, [ebp + 0ch + 4]
+ jmp .try_again
+
+.done:
+ pop edi
+ pop ebx
+ leave
+%endif
+ ret
+ENDPROC ASMAtomicUoAndU64
+
+
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
new file mode 100644
index 00000000..efd63e54
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
@@ -0,0 +1,57 @@
+; $Id: ASMAtomicUoOrU32.asm $
+;; @file
+; IPRT - ASMAtomicUoOrU32().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Atomically OR an unsigned 32-bit value, unordered.
+;
+; @param pu32 x86:esp+4 gcc:rdi msc:rcx
+; @param u32Or x86:esp+8 gcc:rsi msc:rdx
+;
+; @returns void
+;
+BEGINPROC_EXPORTED ASMAtomicUoOrU32
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+ or [rcx], rdx
+ %else
+ or [rdi], rsi
+ %endif
+%elifdef RT_ARCH_X86
+ mov ecx, [esp + 04h]
+ mov edx, [esp + 08h]
+ or [ecx], edx
+%endif
+ ret
+ENDPROC ASMAtomicUoOrU32
+
+
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU64.asm
new file mode 100644
index 00000000..729aba51
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU64.asm
@@ -0,0 +1,76 @@
+; $Id: ASMAtomicUoOrU64.asm $
+;; @file
+; IPRT - ASMAtomicUoOrU64().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Atomically OR an unsigned 64-bit value, unordered.
+;
+; @param pu64 x86:ebp+8 gcc:rdi msc:rcx
+; @param u64Or x86:ebp+c gcc:rsi msc:rdx
+;
+; @returns void
+;
+BEGINPROC_EXPORTED ASMAtomicUoOrU64
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+ or [rcx], rdx
+ %else
+ or [rdi], rsi
+ %endif
+%elifdef RT_ARCH_X86
+ push ebp
+ mov ebp, esp
+ push ebx
+ push edi
+
+ mov edi, [ebp + 08h]
+ mov ebx, [ebp + 0ch]
+ mov ecx, [ebp + 0ch + 4]
+ mov eax, ebx
+ mov edx, ecx
+.try_again:
+ cmpxchg8b [edi]
+ jz .done
+ mov ebx, eax
+ or ebx, [ebp + 0ch]
+ mov ecx, edx
+ or ecx, [ebp + 0ch + 4]
+ jmp .try_again
+
+.done:
+ pop edi
+ pop ebx
+ leave
+%endif
+ ret
+ENDPROC ASMAtomicUoOrU64
+
diff --git a/src/VBox/Runtime/common/asm/ASMCpuIdExSlow.asm b/src/VBox/Runtime/common/asm/ASMCpuIdExSlow.asm
new file mode 100644
index 00000000..772aee35
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMCpuIdExSlow.asm
@@ -0,0 +1,137 @@
+; $Id: ASMCpuIdExSlow.asm $
+;; @file
+; IPRT - ASMCpuIdExSlow().
+;
+
+;
+; Copyright (C) 2012-2013 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
+
+;;
+; CPUID with EAX and ECX inputs, returning ALL output registers.
+;
+; @param uOperator x86:ebp+8 gcc:rdi msc:rcx
+; @param uInitEBX x86:ebp+c gcc:rsi msc:rdx
+; @param uInitECX x86:ebp+10 gcc:rdx msc:r8
+; @param uInitEDX x86:ebp+14 gcc:rcx msc:r9
+; @param pvEAX x86:ebp+18 gcc:r8 msc:rbp+30h
+; @param pvEBX x86:ebp+1c gcc:r9 msc:rbp+38h
+; @param pvECX x86:ebp+20 gcc:rbp+10h msc:rbp+40h
+; @param pvEDX x86:ebp+24 gcc:rbp+18h msc:rbp+48h
+;
+; @returns EAX
+;
+BEGINPROC_EXPORTED ASMCpuIdExSlow
+ push xBP
+ mov xBP, xSP
+ push xBX
+%ifdef RT_ARCH_X86
+ push edi
+%endif
+
+%ifdef ASM_CALL64_MSC
+ mov eax, ecx
+ mov ebx, edx
+ mov ecx, r8d
+ mov edx, r9d
+ mov r8, [rbp + 30h]
+ mov r9, [rbp + 38h]
+ mov r10, [rbp + 40h]
+ mov r11, [rbp + 48h]
+%elifdef ASM_CALL64_GCC
+ mov eax, edi
+ mov ebx, esi
+ xchg ecx, edx
+ mov r10, [rbp + 10h]
+ mov r11, [rbp + 18h]
+%elifdef RT_ARCH_X86
+ mov eax, [ebp + 08h]
+ mov ebx, [ebp + 0ch]
+ mov ecx, [ebp + 10h]
+ mov edx, [ebp + 14h]
+ mov edi, [ebp + 18h]
+%else
+ %error unsupported arch
+%endif
+
+ cpuid
+
+%ifdef RT_ARCH_AMD64
+ test r8, r8
+ jz .store_ebx
+ mov [r8], eax
+%else
+ test edi, edi
+ jz .store_ebx
+ mov [edi], eax
+%endif
+.store_ebx:
+
+%ifdef RT_ARCH_AMD64
+ test r9, r9
+ jz .store_ecx
+ mov [r9], ebx
+%else
+ mov edi, [ebp + 1ch]
+ test edi, edi
+ jz .store_ecx
+ mov [edi], ebx
+%endif
+.store_ecx:
+
+%ifdef RT_ARCH_AMD64
+ test r10, r10
+ jz .store_edx
+ mov [r10], ecx
+%else
+ mov edi, [ebp + 20h]
+ test edi, edi
+ jz .store_edx
+ mov [edi], ecx
+%endif
+.store_edx:
+
+%ifdef RT_ARCH_AMD64
+ test r11, r11
+ jz .done
+ mov [r11], edx
+%else
+ mov edi, [ebp + 24h]
+ test edi, edi
+ jz .done
+ mov [edi], edx
+%endif
+.done:
+
+%ifdef RT_ARCH_X86
+ pop edi
+%endif
+ pop xBX
+ leave
+ ret
+ENDPROC ASMCpuIdExSlow
+
diff --git a/src/VBox/Runtime/common/asm/ASMCpuId_Idx_ECX.asm b/src/VBox/Runtime/common/asm/ASMCpuId_Idx_ECX.asm
new file mode 100644
index 00000000..9992fb22
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMCpuId_Idx_ECX.asm
@@ -0,0 +1,116 @@
+; $Id: ASMCpuId_Idx_ECX.asm $
+;; @file
+; IPRT - ASMCpuId_Idx_ECX().
+;
+
+;
+; Copyright (C) 2012-2013 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
+
+;;
+; CPUID with EAX and ECX inputs, returning ALL output registers.
+;
+; @param uOperator x86:ebp+8 gcc:rdi msc:rcx
+; @param uIdxECX x86:ebp+c gcc:rsi msc:rdx
+; @param pvEAX x86:ebp+10 gcc:rdx msc:r8
+; @param pvEBX x86:ebp+14 gcc:rcx msc:r9
+; @param pvECX x86:ebp+18 gcc:r8 msc:rsp+28h
+; @param pvEDX x86:ebp+1c gcc:r9 msc:rsp+30h
+;
+; @returns void
+;
+BEGINPROC_EXPORTED ASMCpuId_Idx_ECX
+%ifdef RT_ARCH_AMD64
+ mov r10, rbx
+
+ %ifdef ASM_CALL64_MSC
+
+ mov eax, ecx
+ mov ecx, edx
+ xor ebx, ebx
+ xor edx, edx
+
+ cpuid
+
+ mov [r8], eax
+ mov [r9], ebx
+ mov rax, [rsp + 28h]
+ mov rbx, [rsp + 30h]
+ mov [rax], ecx
+ mov [rbx], edx
+
+ %else
+ mov rsi, rdx
+ mov r11, rcx
+ mov eax, edi
+ mov ecx, esi
+ xor ebx, ebx
+ xor edx, edx
+
+ cpuid
+
+ mov [rsi], eax
+ mov [r11], ebx
+ mov [r8], ecx
+ mov [r9], edx
+
+ %endif
+
+ mov rbx, r10
+ ret
+
+%elifdef RT_ARCH_X86
+ push ebp
+ mov ebp, esp
+ push ebx
+ push edi
+
+ xor edx, edx
+ xor ebx, ebx
+ mov eax, [ebp + 08h]
+ mov ecx, [ebp + 0ch]
+
+ cpuid
+
+ mov edi, [ebp + 10h]
+ mov [edi], eax
+ mov edi, [ebp + 14h]
+ mov [edi], ebx
+ mov edi, [ebp + 18h]
+ mov [edi], ecx
+ mov edi, [ebp + 1ch]
+ mov [edi], edx
+
+ pop edi
+ pop ebx
+ leave
+ ret
+%else
+ %error unsupported arch
+%endif
+ENDPROC ASMCpuId_Idx_ECX
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetGDTR.asm b/src/VBox/Runtime/common/asm/ASMGetGDTR.asm
new file mode 100644
index 00000000..3d827e4e
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetGDTR.asm
@@ -0,0 +1,52 @@
+; $Id: ASMGetGDTR.asm $
+;; @file
+; IPRT - ASMGetGDTR().
+;
+
+;
+; Copyright (C) 2006-2013 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 GDTR CPU register.
+; @param pGdtr Where to store the GDTR contents.
+; msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMGetGDTR
+%ifdef ASM_CALL64_MSC
+ mov rax, rcx
+%elifdef ASM_CALL64_GCC
+ mov rax, rdi
+%elifdef RT_ARCH_X86
+ mov eax, [esp + 4]
+%else
+ %error "Undefined arch?"
+%endif
+ sgdt [xAX]
+ ret
+ENDPROC ASMGetGDTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetIDTR.asm b/src/VBox/Runtime/common/asm/ASMGetIDTR.asm
new file mode 100644
index 00000000..558a6d7b
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetIDTR.asm
@@ -0,0 +1,52 @@
+; $Id: ASMGetIDTR.asm $
+;; @file
+; IPRT - ASMGetIDTR().
+;
+
+;
+; Copyright (C) 2006-2013 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 IDTR CPU register.
+; @param pIdtr Where to store the IDTR contents.
+; msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMGetIDTR
+%ifdef ASM_CALL64_MSC
+ mov rax, rcx
+%elifdef ASM_CALL64_GCC
+ mov rax, rdi
+%elifdef RT_ARCH_X86
+ mov eax, [esp + 4]
+%else
+ %error "Undefined arch?"
+%endif
+ sidt [xAX]
+ ret
+ENDPROC ASMGetIDTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetLDTR.asm b/src/VBox/Runtime/common/asm/ASMGetLDTR.asm
new file mode 100644
index 00000000..f7adf829
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetLDTR.asm
@@ -0,0 +1,43 @@
+; $Id: ASMGetLDTR.asm $
+;; @file
+; IPRT - ASMGetLDTR().
+;
+
+;
+; Copyright (C) 2006-2013 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
+
+;;
+; Get the LDTR register.
+; @returns LDTR.
+;
+BEGINPROC_EXPORTED ASMGetLDTR
+ sldt ax
+ movzx eax, ax
+ ret
+ENDPROC ASMGetLDTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetSegAttr.asm b/src/VBox/Runtime/common/asm/ASMGetSegAttr.asm
new file mode 100644
index 00000000..a9f493e7
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetSegAttr.asm
@@ -0,0 +1,61 @@
+; $Id: ASMGetSegAttr.asm $
+;; @file
+; IPRT - ASMGetSegAttr().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Get the segment attributes for a selector.
+;
+; @param uSel x86: [ebp + 08h] msc: ecx gcc: edi The selector value.
+; @returns Segment attributes on success or ~0U on failure.
+;
+; @remarks Using ~0U for failure is chosen because valid access rights always
+; have bits 0:7 as 0 (on both Intel & AMD).
+;
+BEGINPROC_EXPORTED ASMGetSegAttr
+%ifdef ASM_CALL64_MSC
+ and ecx, 0ffffh
+ lar eax, ecx
+%elifdef ASM_CALL64_GCC
+ and edi, 0ffffh
+ lar eax, edi
+%elifdef RT_ARCH_X86
+ movzx edx, word [esp + 4]
+ lar eax, edx
+%else
+ %error "Which arch is this?"
+%endif
+ jz .return
+ mov eax, 0ffffffffh
+.return:
+ ret
+ENDPROC ASMGetSegAttr
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetTR.asm b/src/VBox/Runtime/common/asm/ASMGetTR.asm
new file mode 100644
index 00000000..3d6fc68e
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetTR.asm
@@ -0,0 +1,43 @@
+; $Id: ASMGetTR.asm $
+;; @file
+; IPRT - ASMGetTR().
+;
+
+;
+; Copyright (C) 2006-2013 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
+
+;;
+; Get the TR register.
+; @returns TR.
+;
+BEGINPROC_EXPORTED ASMGetTR
+ str ax
+ movzx eax, ax
+ ret
+ENDPROC ASMGetTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
index 6155e869..4308631a 100644
--- a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
@@ -4,7 +4,7 @@
;
;
-; Copyright (C) 2006-2007 Oracle Corporation
+; Copyright (C) 2006-2010 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/asm/ASMNopPause.asm b/src/VBox/Runtime/common/asm/ASMNopPause.asm
index 455bd14d..8447a87f 100644
--- a/src/VBox/Runtime/common/asm/ASMNopPause.asm
+++ b/src/VBox/Runtime/common/asm/ASMNopPause.asm
@@ -4,7 +4,7 @@
;
;
-; Copyright (C) 2009 Oracle Corporation
+; Copyright (C) 2009-2010 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/asm/ASMRdMsrEx.asm b/src/VBox/Runtime/common/asm/ASMRdMsrEx.asm
new file mode 100644
index 00000000..69135620
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMRdMsrEx.asm
@@ -0,0 +1,84 @@
+; $Id: ASMRdMsrEx.asm $
+;; @file
+; IPRT - ASMRdMsrEx().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Special version of ASMRdMsr that allow specifying the rdi value.
+;
+; @param uMsr msc=rcx, gcc=rdi, x86=[ebp+8] The MSR to read.
+; @param uEdi msc=rdx, gcc=rsi, x86=[ebp+12] The EDI/RDI value.
+; @returns MSR value in rax on amd64 and edx:eax on x86.
+;
+BEGINPROC_EXPORTED ASMRdMsrEx
+%ifdef ASM_CALL64_MSC
+proc_frame ASMRdMsrEx_DupWarningHack
+ push rdi
+ [pushreg rdi]
+[endprolog]
+ and ecx, ecx ; serious paranoia
+ mov rdi, rdx
+ xor eax, eax
+ xor edx, edx
+ rdmsr
+ pop rdi
+ and eax, eax ; paranoia
+ shl rdx, 32
+ or rax, rdx
+ ret
+endproc_frame
+%elifdef ASM_CALL64_GCC
+ mov ecx, edi
+ mov rdi, rsi
+ xor eax, eax
+ xor edx, edx
+ rdmsr
+ and eax, eax ; paranoia
+ shl rdx, 32
+ or rax, rdx
+ ret
+%elifdef RT_ARCH_X86
+ push ebp
+ mov ebp, esp
+ push edi
+ xor eax, eax
+ xor edx, edx
+ mov ecx, [ebp + 8]
+ mov edi, [esp + 12]
+ rdmsr
+ pop edi
+ leave
+ ret
+%else
+ %error "Undefined arch?"
+%endif
+ENDPROC ASMRdMsrEx
+
diff --git a/src/VBox/Runtime/common/asm/ASMWrMsrEx.asm b/src/VBox/Runtime/common/asm/ASMWrMsrEx.asm
new file mode 100644
index 00000000..4feeaa9a
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMWrMsrEx.asm
@@ -0,0 +1,79 @@
+; $Id: ASMWrMsrEx.asm $
+;; @file
+; IPRT - ASMWrMsrEx().
+;
+
+;
+; Copyright (C) 2013 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
+
+;;
+; Special version of ASMRdMsr that allow specifying the rdi value.
+;
+; @param uMsr msc=rcx, gcc=rdi, x86=[ebp+8] The MSR to read.
+; @param uXDI msc=rdx, gcc=rsi, x86=[ebp+12] The EDI/RDI value.
+; @param uValue msc=r8, gcc=rdx, x86=[ebp+16] The 64-bit value to write.
+;
+BEGINPROC_EXPORTED ASMWrMsrEx
+%ifdef ASM_CALL64_MSC
+proc_frame ASMWrMsrEx_DupWarningHack
+ push rdi
+ [pushreg rdi]
+[endprolog]
+ and ecx, ecx ; serious paranoia
+ mov rdi, rdx
+ mov eax, r8d
+ mov rdx, r8
+ shr rdx, 32
+ wrmsr
+ pop rdi
+ ret
+endproc_frame
+%elifdef ASM_CALL64_GCC
+ mov ecx, edi
+ mov rdi, rsi
+ mov eax, edx
+ shr edx, 32
+ wrmsr
+ ret
+%elifdef RT_ARCH_X86
+ push ebp
+ mov ebp, esp
+ push edi
+ mov ecx, [ebp + 8]
+ mov edi, [esp + 12]
+ mov eax, [esp + 16]
+ mov edx, [esp + 20]
+ wrmsr
+ pop edi
+ leave
+ ret
+%else
+ %error "Undefined arch?"
+%endif
+ENDPROC ASMWrMsrEx
+
diff --git a/src/VBox/Runtime/common/asm/asm-fake.cpp b/src/VBox/Runtime/common/asm/asm-fake.cpp
index c2edb702..b737ffe3 100644
--- a/src/VBox/Runtime/common/asm/asm-fake.cpp
+++ b/src/VBox/Runtime/common/asm/asm-fake.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;