Changeset 27615 in vbox for trunk/include
- Timestamp:
- Mar 23, 2010 3:02:33 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59164
- Location:
- trunk/include
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuest.h
r27095 r27615 113 113 * @{ 114 114 */ 115 #if def RT_ARCH_AMD64115 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64) 116 116 # define VBOXGUEST_IOCTL_FLAG 128 117 #elif defined(RT_ARCH_X86) 117 #elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC) 118 118 # define VBOXGUEST_IOCTL_FLAG 0 119 119 #else -
trunk/include/iprt/assert.h
r25984 r27615 243 243 * Debugger breakpoint instruction. 244 244 * 245 * @remarks In the gnu world we add a nop instruction after the int3 to246 * force gdb to remain at the int3 source line.247 * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp.248 245 * @remarks This macro does not depend on RT_STRICT. 249 246 */ 250 #ifdef __GNUC__ 251 # ifndef __L4ENV__ 252 # define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3\n\tnop"); } while (0) 253 # else 254 # define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0) 255 # endif 256 #elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING) 257 # define RTAssertDebugBreak() do { __debugbreak(); } while (0) 258 #else 259 # error "Unknown compiler" 260 #endif 247 #define RTAssertDebugBreak() do { RT_BREAKPOINT(); } while (0) 261 248 262 249 -
trunk/include/iprt/cdefs.h
r26603 r27615 91 91 #define RT_NO_DEPRECATED_MACROS 92 92 #define RT_EXCEPTIONS_ENABLED 93 #define RT_BIG_ENDIAN 94 #define RT_LITTLE_ENDIAN 93 95 #endif /* DOXYGEN_RUNNING */ 94 96 … … 100 102 * Indicates that we're compiling for the AMD64 architecture. 101 103 */ 102 #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_AMD64) 104 105 /** @def RT_ARCH_SPARC 106 * Indicates that we're compiling for the SPARC V8 architecture (32-bit). 107 */ 108 109 /** @def RT_ARCH_SPARC64 110 * Indicates that we're compiling for the SPARC V9 architecture (64-bit). 111 */ 112 #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_AMD64) && !defined(RT_ARCH_SPARC) && !defined(RT_ARCH_SPARC64) 103 113 # if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__) 104 114 # define RT_ARCH_AMD64 105 115 # elif defined(__i386__) || defined(_M_IX86) || defined(__X86__) 106 116 # define RT_ARCH_X86 117 # elif defined(__sparc64__) 118 # define RT_ARCH_SPARC64 119 # elif defined(__sparc__) 120 # define RT_ARCH_SPARC 107 121 # else /* PORTME: append test for new archs. */ 108 122 # error "Check what predefined macros your compiler uses to indicate architecture." 109 123 # endif 110 #elif defined(RT_ARCH_X86) && defined(RT_ARCH_AMD64) /* PORTME: append new archs. */ 124 /* PORTME: append new archs checks. */ 125 #elif defined(RT_ARCH_X86) && defined(RT_ARCH_AMD64) 111 126 # error "Both RT_ARCH_X86 and RT_ARCH_AMD64 cannot be defined at the same time!" 127 #elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC) 128 # error "Both RT_ARCH_X86 and RT_ARCH_SPARC cannot be defined at the same time!" 129 #elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC64) 130 # error "Both RT_ARCH_X86 and RT_ARCH_SPARC64 cannot be defined at the same time!" 131 #elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC) 132 # error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC cannot be defined at the same time!" 133 #elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC64) 134 # error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC64 cannot be defined at the same time!" 135 #elif defined(RT_ARCH_SPARC) && defined(RT_ARCH_SPARC64) 136 # error "Both RT_ARCH_SPARC and RT_ARCH_SPARC64 cannot be defined at the same time!" 112 137 #endif 113 138 … … 122 147 * @deprecated 123 148 */ 124 #if !defined(__X86__) && !defined(__AMD64__) 149 #if !defined(__X86__) && !defined(__AMD64__) && !defined(RT_ARCH_SPARC) && !defined(RT_ARCH_SPARC64) 125 150 # if defined(RT_ARCH_AMD64) 126 151 # define __AMD64__ … … 138 163 #endif 139 164 165 /** @def RT_BIG_ENDIAN 166 * Defined if the architecture is big endian. */ 167 /** @def RT_LITTLE_ENDIAN 168 * Defined if the architecture is little endian. */ 169 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 170 # define RT_LITTLE_ENDIAN 171 #elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64) 172 # define RT_BIG_ENDIAN 173 #else 174 # error "PORTME: architecture endianess" 175 #endif 176 #if defined(RT_BIG_ENDIAN) && defined(RT_LITTLE_ENDIAN) 177 # error "Both RT_BIG_ENDIAN and RT_LITTLE_ENDIAN are defined" 178 #endif 179 180 140 181 /** @def IN_RING0 141 182 * Used to indicate that we're compiling code which is running … … 166 207 */ 167 208 #if !defined(ARCH_BITS) || defined(DOXYGEN_RUNNING) 168 # if defined(RT_ARCH_AMD64) 209 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64) 169 210 # define ARCH_BITS 64 170 211 # else … … 540 581 #ifdef _MSC_VER 541 582 # define RTCALL __cdecl 542 #elif defined(__GNUC__) && defined(IN_RING0) && !(defined(RT_OS_OS2) || defined(RT_ARCH_AMD64)) /* the latter is kernel/gcc */ 583 #elif defined(RT_OS_OS2) 584 # define RTCALL __cdecl 585 #elif defined(__GNUC__) && defined(IN_RING0) \ 586 && !(defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)) /* the latter is kernel/gcc */ 543 587 # define RTCALL __attribute__((cdecl,regparm(0))) 544 588 #else … … 1178 1222 1179 1223 /** @def RT_BYTE1 1180 * Gets first byte of something. */1224 * Gets the first byte of something. */ 1181 1225 #define RT_BYTE1(a) ( (a) & 0xff ) 1182 1226 1183 1227 /** @def RT_BYTE2 1184 * Gets second byte of something. */1228 * Gets the second byte of something. */ 1185 1229 #define RT_BYTE2(a) ( ((a) >> 8) & 0xff ) 1186 1230 1187 1231 /** @def RT_BYTE3 1188 * Gets second byte of something. */1232 * Gets the second byte of something. */ 1189 1233 #define RT_BYTE3(a) ( ((a) >> 16) & 0xff ) 1190 1234 1191 1235 /** @def RT_BYTE4 1192 * Gets fourth byte of something. */1236 * Gets the fourth byte of something. */ 1193 1237 #define RT_BYTE4(a) ( ((a) >> 24) & 0xff ) 1238 1239 /** @def RT_BYTE5 1240 * Gets the fifth byte of something. */ 1241 #define RT_BYTE5(a) (((a) >> 32) & 0xff) 1242 1243 /** @def RT_BYTE6 1244 * Gets the sixth byte of something. */ 1245 #define RT_BYTE6(a) (((a) >> 40) & 0xff) 1246 1247 /** @def RT_BYTE7 1248 * Gets the seventh byte of something. */ 1249 #define RT_BYTE7(a) (((a) >> 48) & 0xff) 1250 1251 /** @def RT_BYTE8 1252 * Gets the eight byte of something. */ 1253 #define RT_BYTE8(a) (((a) >> 56) & 0xff) 1194 1254 1195 1255 … … 1599 1659 #define NOREF(var) (void)(var) 1600 1660 1601 /** @def Breakpoint1661 /** @def RT_BREAKPOINT 1602 1662 * Emit a debug breakpoint instruction. 1603 1663 * 1604 * Use this for instrumenting a debugging session only! 1605 * No committed code shall use Breakpoint(). 1664 * @remarks In the x86/amd64 gnu world we add a nop instruction after the int3 1665 * to force gdb to remain at the int3 source line. 1666 * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp on 1667 * x86/amd64. 1606 1668 */ 1607 1669 #ifdef __GNUC__ 1608 # define Breakpoint() __asm__ __volatile__("int $3\n\t") 1670 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 1671 # if !defined(__L4ENV__) 1672 # define RT_BREAKPOINT() __asm__ __volatile__("int $3\n\tnope\n\t") 1673 # else 1674 # define RT_BREAKPOINT() __asm__ __volatile__("int3; jmp 1f; 1:\n\t") 1675 # endif 1676 # elif defined(RT_ARCH_SPARC64) 1677 # define RT_BREAKPOINT() __asm__ __volatile__("illtrap $0\n\t") /** @todo Sparc64: this is just a wild guess. */ 1678 # elif defined(RT_ARCH_SPARC) 1679 # define RT_BREAKPOINT() __asm__ __volatile__("unimp 0\n\t") /** @todo Sparc: this is just a wild guess (same as Sparc64, just different name). */ 1680 # endif 1609 1681 #endif 1610 1682 #ifdef _MSC_VER 1611 # define Breakpoint() __asm int 31683 # define RT_BREAKPOINT() __debugbreak() 1612 1684 #endif 1613 1685 #if defined(__IBMC__) || defined(__IBMCPP__) 1614 # define Breakpoint()__interrupt(3)1615 #endif 1616 #ifndef Breakpoint1617 # error "This compiler is not supported!"1686 # define RT_BREAKPOINT() __interrupt(3) 1687 #endif 1688 #ifndef RT_BREAKPOINT 1689 # error "This compiler/arch is not supported!" 1618 1690 #endif 1619 1691 … … 1732 1804 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) ) 1733 1805 # endif /* !IN_RING3 */ 1806 1734 1807 #elif defined(RT_ARCH_X86) 1735 1808 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U ) 1809 1810 #elif defined(RT_ARCH_SPARC64) 1811 # ifdef IN_RING3 1812 # if defined(RT_OS_SOLARIS) 1813 /** Sparc64 user mode: According to Figure 9.4 in solaris internals */ 1814 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80004000U >= 0x80004000U + 0x100000000ULL ) 1815 # else 1816 # error "Port me" 1817 # endif 1818 # else /* !IN_RING3 */ 1819 # if defined(RT_OS_SOLARIS) 1820 /** @todo Sparc64 kernel mode: This is according to Figure 11.1 in solaris 1821 * internals. Verify in sources. */ 1822 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= 0x01000000U ) 1823 # else 1824 # error "Port me" 1825 # endif 1826 # endif /* !IN_RING3 */ 1827 1828 #elif defined(RT_ARCH_SPARC) 1829 # ifdef IN_RING3 1830 # ifdef RT_OS_SOLARIS 1831 /** Sparc user mode: According to Figure 9.4 (sun4u) in solaris internals. */ 1832 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x414000U >= 0x414000U + 0x10000U ) 1833 # else 1834 # error "Port me" 1835 # endif 1836 # else /* !IN_RING3 */ 1837 # ifdef RT_OS_SOLARIS 1838 /** @todo Sparc kernel mode: Check the sources! */ 1839 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U ) 1840 # else 1841 # error "Port me" 1842 # endif 1843 # endif /* !IN_RING3 */ 1844 1736 1845 #else 1737 1846 # error "Architecture identifier missing / not implemented." … … 1739 1848 1740 1849 /** Old name for RT_VALID_PTR. */ 1741 #define VALID_PTR(ptr) RT_VALID_PTR(ptr)1850 #define VALID_PTR(ptr) RT_VALID_PTR(ptr) 1742 1851 1743 1852 /** @def RT_VALID_ALIGNED_PTR -
trunk/include/iprt/log.h
r22700 r27615 475 475 */ 476 476 #ifndef LOG_USE_C99 477 # if defined(RT_ARCH_AMD64) || defined(RT_OS_DARWIN) 477 # if defined(RT_ARCH_AMD64) || defined(RT_OS_DARWIN) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64) 478 478 # define LOG_USE_C99 479 479 # endif -
trunk/include/iprt/stdint.h
r23525 r27615 67 67 # endif /* 64-bit darwin kludge. */ 68 68 69 #elif defined(RT_OS_FREEBSD) && defined(_KERNEL) \69 #elif defined(RT_OS_FREEBSD) && defined(_KERNEL) 70 70 71 71 # ifndef __STDC_CONSTANT_MACROS … … 102 102 103 103 /* x-bit types */ 104 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 104 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64) 105 105 # if !defined(_INT8_T_DECLARED) && !defined(_INT8_T) 106 106 typedef signed char int8_t; -
trunk/include/iprt/types.h
r27509 r27615 172 172 typedef struct uint128_s 173 173 { 174 # ifdef RT_BIG_ENDIAN 175 uint64_t Hi; 176 uint64_t Lo; 177 # else 174 178 uint64_t Lo; 175 179 uint64_t Hi; 180 # endif 176 181 } uint128_t; 177 182 #endif … … 186 191 typedef struct int128_s 187 192 { 188 uint64_t lo; 189 int64_t hi; 193 # ifdef RT_BIG_ENDIAN 194 int64_t Hi; 195 uint64_t Lo; 196 # else 197 uint64_t Lo; 198 int64_t Hi; 199 # endif 190 200 } int128_t; 191 201 #endif … … 207 217 struct 208 218 { 219 #ifdef RT_BIG_ENDIAN 220 uint8_t Hi; 221 uint8_t Lo; 222 #else 209 223 uint8_t Lo; 210 224 uint8_t Hi; 225 #endif 211 226 } s; 212 227 } RTUINT16U; … … 227 242 struct 228 243 { 244 #ifdef RT_BIG_ENDIAN 245 uint16_t Hi; 246 uint16_t Lo; 247 #else 229 248 uint16_t Lo; 230 249 uint16_t Hi; 250 #endif 231 251 } s; 232 252 /** Word view. */ 233 253 struct 234 254 { 255 #ifdef RT_BIG_ENDIAN 256 uint16_t w1; 257 uint16_t w0; 258 #else 235 259 uint16_t w0; 236 260 uint16_t w1; 261 #endif 237 262 } Words; 238 263 … … 260 285 struct 261 286 { 287 #ifdef RT_BIG_ENDIAN 288 uint32_t Hi; 289 uint32_t Lo; 290 #else 262 291 uint32_t Lo; 263 292 uint32_t Hi; 293 #endif 264 294 } s; 265 295 /** Double-Word view. */ 266 296 struct 267 297 { 298 #ifdef RT_BIG_ENDIAN 299 uint32_t dw1; 300 uint32_t dw0; 301 #else 268 302 uint32_t dw0; 269 303 uint32_t dw1; 304 #endif 270 305 } DWords; 271 306 /** Word view. */ 272 307 struct 273 308 { 309 #ifdef RT_BIG_ENDIAN 310 uint16_t w3; 311 uint16_t w2; 312 uint16_t w1; 313 uint16_t w0; 314 #else 274 315 uint16_t w0; 275 316 uint16_t w1; 276 317 uint16_t w2; 277 318 uint16_t w3; 319 #endif 278 320 } Words; 279 321 … … 304 346 struct 305 347 { 348 #ifdef RT_BIG_ENDIAN 349 uint64_t Hi; 350 uint64_t Lo; 351 #else 306 352 uint64_t Lo; 307 353 uint64_t Hi; 354 #endif 308 355 } s; 309 356 /** Quad-Word view. */ 310 357 struct 311 358 { 359 #ifdef RT_BIG_ENDIAN 360 uint64_t qw1; 361 uint64_t qw0; 362 #else 312 363 uint64_t qw0; 313 364 uint64_t qw1; 365 #endif 314 366 } QWords; 315 367 /** Double-Word view. */ 316 368 struct 317 369 { 370 #ifdef RT_BIG_ENDIAN 371 uint32_t dw3; 372 uint32_t dw2; 373 uint32_t dw1; 374 uint32_t dw0; 375 #else 318 376 uint32_t dw0; 319 377 uint32_t dw1; 320 378 uint32_t dw2; 321 379 uint32_t dw3; 380 #endif 322 381 } DWords; 323 382 /** Word view. */ 324 383 struct 325 384 { 385 #ifdef RT_BIG_ENDIAN 386 uint16_t w7; 387 uint16_t w6; 388 uint16_t w5; 389 uint16_t w4; 390 uint16_t w3; 391 uint16_t w2; 392 uint16_t w1; 393 uint16_t w0; 394 #else 326 395 uint16_t w0; 327 396 uint16_t w1; … … 332 401 uint16_t w6; 333 402 uint16_t w7; 403 #endif 334 404 } Words; 335 405
Note:
See TracChangeset
for help on using the changeset viewer.