Changeset 54254 in vbox
- Timestamp:
- Feb 17, 2015 10:58:55 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-amd64-x86.h
r54251 r54254 28 28 29 29 #include <iprt/types.h> 30 #include <iprt/assert.h> 30 31 #if !defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86) 31 32 # error "Not on AMD64 or x86" … … 83 84 */ 84 85 85 /** @todo find a more proper place for this structure? */ 86 /** @todo find a more proper place for these structures? */ 87 86 88 #pragma pack(1) 87 89 /** IDTR */ … … 96 98 97 99 #pragma pack(1) 100 /** @internal */ 101 typedef struct RTIDTRALIGNEDINT 102 { 103 /** Alignment padding. */ 104 uint8_t au16Padding[ARCH_BITS == 64 ? 3 : 1]; 105 /** The IDTR structure. */ 106 RTIDTR Idtr; 107 } RTIDTRALIGNEDINT; 108 #pragma pack() 109 110 /** Wrapped RTIDTR for preventing misalignment exceptions. */ 111 typedef union RTIDTRALIGNED 112 { 113 /** Try make sure this structure has optimal alignment. */ 114 uint64_t auAlignmentHack[ARCH_BITS == 64 ? 2 : 1]; 115 /** Aligned structure. */ 116 RTIDTRALIGNEDINT s; 117 } RTIDTRALIGNED; 118 AssertCompileSize(RTIDTRALIGNED, ARCH_BITS * 2 / 8); 119 /** Pointer to a an RTIDTR alignment wrapper. */ 120 typedef RTIDTRALIGNED *PRIDTRALIGNED; 121 122 123 #pragma pack(1) 98 124 /** GDTR */ 99 125 typedef struct RTGDTR … … 106 132 #pragma pack() 107 133 134 #pragma pack(1) 135 /** @internal */ 136 typedef struct RTGDTRALIGNEDINT 137 { 138 /** Alignment padding. */ 139 uint8_t au16Padding[ARCH_BITS == 64 ? 3 : 1]; 140 /** The GDTR structure. */ 141 RTGDTR Gdtr; 142 } RTGDTRALIGNEDINT; 143 #pragma pack() 144 145 /** Wrapped RTGDTR for preventing misalignment exceptions. */ 146 typedef union RTGDTRALIGNED 147 { 148 /** Try make sure this structure has optimal alignment. */ 149 uint64_t auAlignmentHack[ARCH_BITS == 64 ? 2 : 1]; 150 /** Aligned structure. */ 151 RTGDTRALIGNEDINT s; 152 } RTGDTRALIGNED; 153 AssertCompileSize(RTGDTRALIGNED, ARCH_BITS * 2 / 8); 154 /** Pointer to a an RTGDTR alignment wrapper. */ 155 typedef RTGDTRALIGNED *PRGDTRALIGNED; 156 108 157 109 158 /** … … 130 179 } 131 180 # endif 181 } 182 #endif 183 184 185 /** 186 * Gets the content of the IDTR.LIMIT CPU register. 187 * @returns IDTR limit. 188 */ 189 #if RT_INLINE_ASM_EXTERNAL 190 DECLASM(uint16_t) ASMGetIdtrLimit(void); 191 #else 192 DECLINLINE(uint16_t) ASMGetIdtrLimit(void) 193 { 194 RTIDTRALIGNED TmpIdtr; 195 # if RT_INLINE_ASM_GNU_STYLE 196 __asm__ __volatile__("sidt %0" : "=m" (TmpIdtr.s.Idtr)); 197 # else 198 __asm 199 { 200 sidt [TmpIdtr.s.Idtr] 201 } 202 # endif 203 return TmpIdtr.s.Idtr.cbIdt; 132 204 } 133 205 #endif -
trunk/src/VBox/Runtime/Makefile.kmk
r53993 r54254 187 187 common/asm/ASMNopPause.asm \ 188 188 common/asm/ASMGetIDTR.asm \ 189 common/asm/ASMGetIdtrLimit.asm \ 189 190 common/asm/ASMSetIDTR.asm \ 190 191 common/asm/ASMGetGDTR.asm \ -
trunk/src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm
r54253 r54254 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - ASMGetI DTR().3 ; IPRT - ASMGetIdtrLimit(). 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-201 3Oracle Corporation7 ; Copyright (C) 2006-2015 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 … … 34 35 ;; 35 36 ; Gets the content of the IDTR CPU register. 36 ; @param pIdtr Where to store the IDTR contents. 37 ; msc=rcx, gcc=rdi, x86=[esp+4] 37 ; @returns IDTR.LIMIT in ax 38 38 ; 39 BEGINPROC_EXPORTED ASMGetIDTR 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?" 48 %endif 49 sidt [xAX] 39 BEGINPROC_EXPORTED ASMGetIdtrLimit 40 sub xSP, 18h 41 SEH64_ALLOCATE_STACK 18h 42 SEH64_END_PROLOGUE 43 sidt [xSP + 6] 44 mov ax, [xSP + 6] 45 add xSP, 18h 50 46 ret 51 ENDPROC ASMGetI DTR47 ENDPROC ASMGetIdtrLimit 52 48
Note:
See TracChangeset
for help on using the changeset viewer.