VirtualBox

Changeset 27615 in vbox for trunk/include


Ignore:
Timestamp:
Mar 23, 2010 3:02:33 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59164
Message:

include,tools/env.sh: applying sparc patches.

Location:
trunk/include
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuest.h

    r27095 r27615  
    113113 * @{
    114114 */
    115 #ifdef RT_ARCH_AMD64
     115#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
    116116# define VBOXGUEST_IOCTL_FLAG     128
    117 #elif defined(RT_ARCH_X86)
     117#elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
    118118# define VBOXGUEST_IOCTL_FLAG     0
    119119#else
  • trunk/include/iprt/assert.h

    r25984 r27615  
    243243 * Debugger breakpoint instruction.
    244244 *
    245  * @remarks In the gnu world we add a nop instruction after the int3 to
    246  *          force gdb to remain at the int3 source line.
    247  * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp.
    248245 * @remarks This macro does not depend on RT_STRICT.
    249246 */
    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)
    261248
    262249
  • trunk/include/iprt/cdefs.h

    r26603 r27615  
    9191#define RT_NO_DEPRECATED_MACROS
    9292#define RT_EXCEPTIONS_ENABLED
     93#define RT_BIG_ENDIAN
     94#define RT_LITTLE_ENDIAN
    9395#endif /* DOXYGEN_RUNNING */
    9496
     
    100102 * Indicates that we're compiling for the AMD64 architecture.
    101103 */
    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)
    103113# if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__)
    104114#  define RT_ARCH_AMD64
    105115# elif defined(__i386__) || defined(_M_IX86) || defined(__X86__)
    106116#  define RT_ARCH_X86
     117# elif defined(__sparc64__)
     118#  define RT_ARCH_SPARC64
     119# elif defined(__sparc__)
     120#  define RT_ARCH_SPARC
    107121# else /* PORTME: append test for new archs. */
    108122#  error "Check what predefined macros your compiler uses to indicate architecture."
    109123# 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)
    111126# 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!"
    112137#endif
    113138
     
    122147 * @deprecated
    123148 */
    124 #if !defined(__X86__) && !defined(__AMD64__)
     149#if !defined(__X86__) && !defined(__AMD64__) && !defined(RT_ARCH_SPARC) && !defined(RT_ARCH_SPARC64)
    125150# if defined(RT_ARCH_AMD64)
    126151#  define __AMD64__
     
    138163#endif
    139164
     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
    140181/** @def IN_RING0
    141182 * Used to indicate that we're compiling code which is running
     
    166207 */
    167208#if !defined(ARCH_BITS) || defined(DOXYGEN_RUNNING)
    168 # if defined(RT_ARCH_AMD64)
     209# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
    169210#  define ARCH_BITS 64
    170211# else
     
    540581#ifdef _MSC_VER
    541582# 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 */
    543587# define RTCALL     __attribute__((cdecl,regparm(0)))
    544588#else
     
    11781222
    11791223/** @def RT_BYTE1
    1180  * Gets first byte of something. */
     1224 * Gets the first byte of something. */
    11811225#define RT_BYTE1(a)                             ( (a) & 0xff )
    11821226
    11831227/** @def RT_BYTE2
    1184  * Gets second byte of something. */
     1228 * Gets the second byte of something. */
    11851229#define RT_BYTE2(a)                             ( ((a) >> 8) & 0xff )
    11861230
    11871231/** @def RT_BYTE3
    1188  * Gets second byte of something. */
     1232 * Gets the second byte of something. */
    11891233#define RT_BYTE3(a)                             ( ((a) >> 16) & 0xff )
    11901234
    11911235/** @def RT_BYTE4
    1192  * Gets fourth byte of something. */
     1236 * Gets the fourth byte of something. */
    11931237#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)
    11941254
    11951255
     
    15991659#define NOREF(var)               (void)(var)
    16001660
    1601 /** @def Breakpoint
     1661/** @def RT_BREAKPOINT
    16021662 * Emit a debug breakpoint instruction.
    16031663 *
    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.
    16061668 */
    16071669#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
    16091681#endif
    16101682#ifdef _MSC_VER
    1611 # define Breakpoint()           __asm int 3
     1683# define RT_BREAKPOINT()        __debugbreak()
    16121684#endif
    16131685#if defined(__IBMC__) || defined(__IBMCPP__)
    1614 # define Breakpoint()           __interrupt(3)
    1615 #endif
    1616 #ifndef Breakpoint
    1617 # 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!"
    16181690#endif
    16191691
     
    17321804                                     || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
    17331805# endif /* !IN_RING3 */
     1806
    17341807#elif defined(RT_ARCH_X86)
    17351808# 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
    17361845#else
    17371846# error "Architecture identifier missing / not implemented."
     
    17391848
    17401849/** Old name for RT_VALID_PTR.  */
    1741 #define VALID_PTR(ptr)      RT_VALID_PTR(ptr)
     1850#define VALID_PTR(ptr)          RT_VALID_PTR(ptr)
    17421851
    17431852/** @def RT_VALID_ALIGNED_PTR
  • trunk/include/iprt/log.h

    r22700 r27615  
    475475 */
    476476#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)
    478478#  define LOG_USE_C99
    479479# endif
  • trunk/include/iprt/stdint.h

    r23525 r27615  
    6767# endif /* 64-bit darwin kludge. */
    6868
    69 #elif defined(RT_OS_FREEBSD) && defined(_KERNEL) \
     69#elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
    7070
    7171# ifndef __STDC_CONSTANT_MACROS
     
    102102
    103103    /* 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)
    105105#   if !defined(_INT8_T_DECLARED)   && !defined(_INT8_T)
    106106typedef signed char         int8_t;
  • trunk/include/iprt/types.h

    r27509 r27615  
    172172typedef struct uint128_s
    173173{
     174# ifdef RT_BIG_ENDIAN
     175    uint64_t    Hi;
     176    uint64_t    Lo;
     177# else
    174178    uint64_t    Lo;
    175179    uint64_t    Hi;
     180# endif
    176181} uint128_t;
    177182#endif
     
    186191typedef struct int128_s
    187192{
    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
    190200} int128_t;
    191201#endif
     
    207217    struct
    208218    {
     219#ifdef RT_BIG_ENDIAN
     220        uint8_t    Hi;
     221        uint8_t    Lo;
     222#else
    209223        uint8_t    Lo;
    210224        uint8_t    Hi;
     225#endif
    211226    } s;
    212227} RTUINT16U;
     
    227242    struct
    228243    {
     244#ifdef RT_BIG_ENDIAN
     245        uint16_t    Hi;
     246        uint16_t    Lo;
     247#else
    229248        uint16_t    Lo;
    230249        uint16_t    Hi;
     250#endif
    231251    } s;
    232252    /** Word view. */
    233253    struct
    234254    {
     255#ifdef RT_BIG_ENDIAN
     256        uint16_t    w1;
     257        uint16_t    w0;
     258#else
    235259        uint16_t    w0;
    236260        uint16_t    w1;
     261#endif
    237262    } Words;
    238263
     
    260285    struct
    261286    {
     287#ifdef RT_BIG_ENDIAN
     288        uint32_t    Hi;
     289        uint32_t    Lo;
     290#else
    262291        uint32_t    Lo;
    263292        uint32_t    Hi;
     293#endif
    264294    } s;
    265295    /** Double-Word view. */
    266296    struct
    267297    {
     298#ifdef RT_BIG_ENDIAN
     299        uint32_t    dw1;
     300        uint32_t    dw0;
     301#else
    268302        uint32_t    dw0;
    269303        uint32_t    dw1;
     304#endif
    270305    } DWords;
    271306    /** Word view. */
    272307    struct
    273308    {
     309#ifdef RT_BIG_ENDIAN
     310        uint16_t    w3;
     311        uint16_t    w2;
     312        uint16_t    w1;
     313        uint16_t    w0;
     314#else
    274315        uint16_t    w0;
    275316        uint16_t    w1;
    276317        uint16_t    w2;
    277318        uint16_t    w3;
     319#endif
    278320    } Words;
    279321
     
    304346    struct
    305347    {
     348#ifdef RT_BIG_ENDIAN
     349        uint64_t    Hi;
     350        uint64_t    Lo;
     351#else
    306352        uint64_t    Lo;
    307353        uint64_t    Hi;
     354#endif
    308355    } s;
    309356    /** Quad-Word view. */
    310357    struct
    311358    {
     359#ifdef RT_BIG_ENDIAN
     360        uint64_t    qw1;
     361        uint64_t    qw0;
     362#else
    312363        uint64_t    qw0;
    313364        uint64_t    qw1;
     365#endif
    314366    } QWords;
    315367    /** Double-Word view. */
    316368    struct
    317369    {
     370#ifdef RT_BIG_ENDIAN
     371        uint32_t    dw3;
     372        uint32_t    dw2;
     373        uint32_t    dw1;
     374        uint32_t    dw0;
     375#else
    318376        uint32_t    dw0;
    319377        uint32_t    dw1;
    320378        uint32_t    dw2;
    321379        uint32_t    dw3;
     380#endif
    322381    } DWords;
    323382    /** Word view. */
    324383    struct
    325384    {
     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
    326395        uint16_t    w0;
    327396        uint16_t    w1;
     
    332401        uint16_t    w6;
    333402        uint16_t    w7;
     403#endif
    334404    } Words;
    335405
Note: See TracChangeset for help on using the changeset viewer.

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