VirtualBox

Changeset 3672 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Jul 17, 2007 12:39:30 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22950
Message:

RT_OS_* and RT_ARCH_* for Runtime/ and Support/

Location:
trunk/src/VBox/HostDrivers/Support
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r3621 r3672  
    4141
    4242
    43 #if defined(__WIN__)
     43#if defined(RT_OS_WINDOWS)
    4444    __BEGIN_DECLS
    4545#   if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
     
    6161    __END_DECLS
    6262
    63 #elif defined(__LINUX__)
     63#elif defined(RT_OS_LINUX)
    6464#   include <linux/autoconf.h>
    6565#   include <linux/version.h>
     
    8686#   include <linux/timer.h>
    8787
    88 #elif defined(__DARWIN__)
     88#elif defined(RT_OS_DARWIN)
    8989#   include <libkern/libkern.h>
    9090#   include <iprt/string.h>
    9191
    92 #elif defined(__OS2__)
    93 
    94 #elif defined(__FREEBSD__)
     92#elif defined(RT_OS_OS2)
     93
     94#elif defined(RT_OS_FREEBSD)
    9595#   include <sys/libkern.h>
    9696#   include <iprt/string.h>
     
    117117 * Win32
    118118 */
    119 #if defined(__WIN__)
     119#if defined(RT_OS_WINDOWS)
    120120
    121121/* debug printf */
     
    126126 * to actually be much lower. The values here have been determined experimentally.
    127127 */
    128 #ifdef __X86__
     128#ifdef RT_ARCH_X86
    129129# define MAX_LOCK_MEM_SIZE   (32*1024*1024) /* 32mb */
    130130#endif
    131 #ifdef __AMD64__
     131#ifdef RT_ARCH_AMD64
    132132# define MAX_LOCK_MEM_SIZE   (24*1024*1024) /* 24mb */
    133133#endif
     
    137137 * Linux
    138138 */
    139 #elif defined(__LINUX__)
     139#elif defined(RT_OS_LINUX)
    140140
    141141/* check kernel version */
     
    155155 * Darwin
    156156 */
    157 #elif defined(__DARWIN__)
     157#elif defined(RT_OS_DARWIN)
    158158
    159159/* debug printf */
     
    164164 * OS/2
    165165 */
    166 #elif defined(__OS2__)
     166#elif defined(RT_OS_OS2)
    167167
    168168/* No log API in OS/2 only COM port. */
     
    173173 * FreeBSD
    174174 */
    175 #elif defined(__FREEBSD__)
     175#elif defined(RT_OS_FREEBSD)
    176176
    177177/* No log API in OS/2 only COM port. */
     
    198198
    199199/* dprintf2 - extended logging. */
    200 #if defined(__DARWIN__) || defined(__OS2__)
     200#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2)
    201201# define dprintf2 dprintf
    202202#else
     
    250250    /** Segment Selector. */
    251251    uint32_t    u16SegSel : 16;
    252 #ifdef __AMD64__
     252#ifdef RT_ARCH_AMD64
    253253    /** Interrupt Stack Table index. */
    254254    uint32_t    u3IST : 3;
     
    269269    /** High offset word. */
    270270    uint32_t    u16OffsetHigh : 16;
    271 #ifdef __AMD64__
     271#ifdef RT_ARCH_AMD64
    272272    /** The upper top part of the address. */
    273273    uint32_t    u32OffsetTop;
     
    381381        struct
    382382        {
    383 #if defined(__WIN__)
     383#if defined(RT_OS_WINDOWS)
    384384            /** Pointer to memory descriptor list (MDL). */
    385385            PMDL               *papMdl;
    386386            unsigned            cMdls;
    387 #elif defined(__LINUX__)
     387#elif defined(RT_OS_LINUX)
    388388            struct page       **papPages;
    389389            unsigned            cPages;
     
    394394        struct
    395395        {
    396 #if defined(__WIN__)
     396#if defined(RT_OS_WINDOWS)
    397397            /** Pointer to memory descriptor list (MDL). */
    398398            PMDL                pMdl;
    399 #elif defined(__LINUX__)
     399#elif defined(RT_OS_LINUX)
    400400            struct page        *paPages;
    401401            unsigned            cPages;
     
    406406        struct
    407407        {
    408 #if defined(__WIN__)
     408#if defined(RT_OS_WINDOWS)
    409409            /** Pointer to memory descriptor list (MDL). */
    410410            PMDL                pMdl;
    411 #elif defined(__LINUX__)
     411#elif defined(RT_OS_LINUX)
    412412            /** Pointer to the array of page pointers. */
    413413            struct page       **papPages;
     
    572572    /** Which process this session is associated with. */
    573573    RTR0PROCESS                 R0Process;
    574 #if defined(__OS2__)
     574#if defined(RT_OS_OS2)
    575575    /** The system file number of this session. */
    576576    uint16_t                    sfn;
    577577    uint16_t                    Alignment; /**< Alignment */
    578578#endif
    579 #if defined(__DARWIN__) || defined(__OS2__)
     579#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2)
    580580    /** Pointer to the next session with the same hash. */
    581581    PSUPDRVSESSION              pNextHash;
     
    644644    uint32_t                u32SystemTimerGranularityGrant;
    645645#endif
    646 #ifdef __WIN__
     646#ifdef RT_OS_WINDOWS
    647647    /** The GIP timer object. */
    648648    KTIMER                  GipTimer;
     
    656656    ULONG                   ulGipTimerInterval;
    657657#endif
    658 #ifdef __LINUX__
     658#ifdef RT_OS_LINUX
    659659    /** The last jiffies. */
    660660    unsigned long           ulLastJiffies;
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r3537 r3672  
    3434 * and 64-bit processes.
    3535 */
    36 #ifdef __AMD64__
     36#ifdef RT_ARCH_AMD64
    3737# define SUP_IOCTL_FLAG     128
    38 #elif defined(__X86__)
     38#elif defined(RT_ARCH_X86)
    3939# define SUP_IOCTL_FLAG     0
    4040#else
     
    4242#endif
    4343
    44 #ifdef __WIN__
     44#ifdef RT_OS_WINDOWS
    4545# define SUP_CTL_CODE(Function)         CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    4646# define SUP_CTL_CODE_FAST(Function)    CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS)
     
    6464# endif
    6565
    66 #elif defined(__OS2__)
     66#elif defined(RT_OS_OS2)
    6767# define SUP_CTL_CATEGORY               0xc0
    6868# define SUP_CTL_CODE(Function)         ((unsigned char)(Function))
     
    7070# define SUP_CTL_CODE_FAST(Function)    ((unsigned char)(Function))
    7171
    72 #elif defined(__LINUX__)
    73 # ifdef __X86__ /** @todo With the next major version change, drop this branch. */
     72#elif defined(RT_OS_LINUX)
     73# ifdef RT_ARCH_X86 /** @todo With the next major version change, drop this branch. */
    7474#  define SUP_CTL_CODE(Function) \
    7575    ( (3U << 30) | ((0x22) << 8) | ((Function) | SUP_IOCTL_FLAG) | (sizeof(SUPDRVIOCTLDATA) << 16) )
     
    8787# endif
    8888
    89 #elif defined(__L4__)
     89#elif defined(RT_OS_L4)
    9090# define SUP_CTL_CODE(Function) \
    9191    ( (3U << 30) | ((0x22) << 8) | ((Function) | SUP_IOCTL_FLAG) | (sizeof(SUPDRVIOCTLDATA) << 16) )
     
    150150*   Structures and Typedefs                                                    *
    151151*******************************************************************************/
    152 #ifdef __AMD64__
     152#ifdef RT_ARCH_AMD64
    153153# pragma pack(8)                        /* paranoia. */
    154154#else
     
    156156#endif
    157157
    158 #ifndef __WIN__
     158#ifndef RT_OS_WINDOWS
    159159/**
    160160 * Structure used by OSes with less advanced ioctl interfaces, i.e. most
     
    167167    void           *pvOut;
    168168    unsigned long   cbOut;
    169 #ifdef __OS2__
     169#ifdef RT_OS_OS2
    170170    int             rc;
    171171#endif
  • trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c

    r3537 r3672  
    260260    /* objects. */
    261261    pObj = pDevExt->pObjs;
    262 #if !defined(DEBUG_bird) || !defined(__LINUX__) /* breaks unloading, temporary, remove me! */
     262#if !defined(DEBUG_bird) || !defined(RT_OS_LINUX) /* breaks unloading, temporary, remove me! */
    263263    Assert(!pObj);                      /* (can trigger on forced unloads) */
    264264#endif
     
    27622762        static uint8_t au8Ints[] =
    27632763        {
    2764 #ifdef __WIN__   /* We don't use 0xef and above because they are system stuff on linux (ef is IPI,
     2764#ifdef RT_OS_WINDOWS   /* We don't use 0xef and above because they are system stuff on linux (ef is IPI,
    27652765                  * local apic timer, or some other frequently fireing thing). */
    27662766            0xef, 0xee, 0xed, 0xec,
     
    27712771            0xbf, 0xbe, 0xbd, 0xbc,
    27722772        };
    2773 #if defined(__AMD64__) && defined(DEBUG)
     2773#if defined(RT_ARCH_AMD64) && defined(DEBUG)
    27742774        static int  s_iWobble = 0;
    27752775        unsigned    iMax = !(s_iWobble++ % 2) ? 0x80 : 0x100;
     
    28262826    pPatch->ChangedIdt.u16OffsetLow     = (uint32_t)((uintptr_t)&pPatch->auCode[0] & 0xffff);
    28272827    pPatch->ChangedIdt.u16OffsetHigh    = (uint32_t)((uintptr_t)&pPatch->auCode[0] >> 16);
    2828 #ifdef __AMD64__
     2828#ifdef RT_ARCH_AMD64
    28292829    pPatch->ChangedIdt.u32OffsetTop     = (uint32_t)((uintptr_t)&pPatch->auCode[0] >> 32);
    28302830#endif
    28312831    pPatch->ChangedIdt.u16SegSel        = ASMGetCS();
    2832 #ifdef __AMD64__
     2832#ifdef RT_ARCH_AMD64
    28332833    pPatch->ChangedIdt.u3IST            = 0;
    28342834    pPatch->ChangedIdt.u5Reserved       = 0;
     
    28452845     */
    28462846  {
    2847 #ifdef __AMD64__
     2847#ifdef RT_ARCH_AMD64
    28482848    union
    28492849    {
     
    28762876     *      reserve some stack space for the interrupt forwarding.
    28772877     */
    2878 # ifdef __WIN__
     2878# ifdef RT_OS_WINDOWS
    28792879    *u.pb++ = 0x50;                     //  push    rax                             ; alignment filler.
    28802880    *u.pb++ = 0x41;                     //  push    r8                              ; uArg
     
    29502950    *u.pb++ = 0xcb;
    29512951
    2952 #else /* __X86__ */
     2952#else /* RT_ARCH_X86 */
    29532953
    29542954    union
     
    30013001    *u.pb++ = 0xc0;
    30023002
    3003 #ifdef __WIN__
     3003#ifdef RT_OS_WINDOWS
    30043004    *u.pb++ = 0xb8;                     //  mov     eax, KernelFS
    30053005    *u.pu32++ = ASMGetFS();
     
    30563056        *uFixJmpNotNested.pu16++ = pPatch->SavedIdt.u16SegSel;
    30573057    }
    3058 #endif /* __X86__ */
     3058#endif /* RT_ARCH_X86 */
    30593059    Assert(u.pb <= &pPatch->auCode[sizeof(pPatch->auCode)]);
    30603060#if 0
     
    32343234
    32353235    /* Update IDT Entry */
    3236 #ifdef __AMD64__
     3236#ifdef RT_ARCH_AMD64
    32373237    ASMAtomicXchgU128((volatile uint128_t *)pvIdtEntry, *(uint128_t *)(uintptr_t)pNewIDTEntry);
    32383238#else
     
    36293629        for (pPatch = pDevExt->pIdtPatches; pPatch; pPatch = pPatch->pNext)
    36303630        {
    3631 # ifdef __AMD64__
     3631# ifdef RT_ARCH_AMD64
    36323632            ASMAtomicXchgU64((volatile uint64_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup], (uint64_t)pvVMMR0);
    3633 # else /* __X86__ */
     3633# else /* RT_ARCH_X86 */
    36343634            ASMAtomicXchgU32((volatile uint32_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup],
    36353635                             (uint32_t)pvVMMR0 - (uint32_t)&pPatch->auCode[pPatch->offVMMR0EntryFixup + 4]);
     
    36723672    for (pPatch = pDevExt->pIdtPatches; pPatch; pPatch = pPatch->pNext)
    36733673    {
    3674 # ifdef __AMD64__
     3674# ifdef RT_ARCH_AMD64
    36753675        ASMAtomicXchgU64((volatile uint64_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup],
    36763676                         (uint64_t)&pPatch->auCode[pPatch->offStub]);
    3677 # else /* __X86__ */
     3677# else /* RT_ARCH_X86 */
    36783678        ASMAtomicXchgU32((volatile uint32_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup],
    36793679                         (uint32_t)&pPatch->auCode[pPatch->offStub] - (uint32_t)&pPatch->auCode[pPatch->offVMMR0EntryFixup + 4]);
     
    42984298        if (pGip->u64NanoTSLastUpdateHz)
    42994299        {
    4300 #ifdef __AMD64__ /** @todo fix 64-bit div here to work on x86 linux. */
     4300#ifdef RT_ARCH_AMD64 /** @todo fix 64-bit div here to work on x86 linux. */
    43014301            uint64_t u64Delta = u64NanoTS - pGip->u64NanoTSLastUpdateHz;
    43024302            uint32_t u32UpdateHz = (uint32_t)((UINT64_C(1000000000) * GIP_UPDATEHZ_RECALC_FREQ) / u64Delta);
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r3537 r3672  
    807807     * Generate the code.
    808808     */
    809 #ifdef __AMD64__
     809#ifdef RT_ARCH_AMD64
    810810    /*
    811811     * reg params:
  • trunk/src/VBox/HostDrivers/Support/linux/Makefile

    r3400 r3672  
    123123 export INCL
    124124endif
    125 KFLAGS   := -D__KERNEL__ -DMODULE -D__LINUX__ -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0
     125KFLAGS   := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0
    126126ifndef CONFIG_VBOXDRV_FIXEDMAJOR
    127127 KFLAGS  += -DCONFIG_VBOXDRV_AS_MISC
    128128endif
    129129ifeq ($(BUILD_TARGET_ARCH),amd64)
    130  KFLAGS  += -D__AMD64__
     130 KFLAGS  += -DRT_ARCH_AMD64
    131131else
    132  KFLAGS  += -D__X86__
     132 KFLAGS  += -DRT_ARCH_X86
    133133endif
    134134#ifeq ($(BUILD_TYPE),debug) - you'll have to enable this manually to get debug stuff.
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r3393 r3672  
    121121 * This sucks soooo badly on x86! Why don't they export __PAGE_KERNEL_EXEC so PAGE_KERNEL_EXEC would be usable?
    122122 */
    123 #if defined(__AMD64__)
     123#if defined(RT_ARCH_AMD64)
    124124# define MY_PAGE_KERNEL_EXEC    PAGE_KERNEL_EXEC
    125125#elif defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE)
     
    149149# endif
    150150
    151 # ifndef __AMD64__
     151# ifndef RT_ARCH_AMD64
    152152/* In 2.6.9-22.ELsmp we have to call change_page_attr() twice when changing
    153153 * the page attributes from PAGE_KERNEL to something else, because there appears
     
    170170
    171171#ifndef MY_CHANGE_PAGE_ATTR
    172 # ifdef __AMD64__ /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr().  */
     172# ifdef RT_ARCH_AMD64 /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr().  */
    173173#  define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \
    174174    do { \
     
    205205 *                    and disabled on i386.
    206206 */
    207 # if defined(__AMD64__)
     207# if defined(RT_ARCH_AMD64)
    208208#  if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
    209209#   define DO_DISABLE_NMI 1
     
    267267#define DEVICE_NAME    "vboxdrv"
    268268
    269 #ifdef __AMD64__
     269#ifdef RT_ARCH_AMD64
    270270/**
    271271 * Memory for the executable memory heap (in IPRT).
     
    608608        if (RT_SUCCESS(rc))
    609609        {
    610 #ifdef __AMD64__
     610#ifdef RT_ARCH_AMD64
    611611            rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory));
    612612#endif
     
    10251025     * Allocate page pointer array.
    10261026     */
    1027 #ifdef __AMD64__ /** @todo check out if there is a correct way of getting memory below 4GB (physically). */
     1027#ifdef RT_ARCH_AMD64 /** @todo check out if there is a correct way of getting memory below 4GB (physically). */
    10281028    paPages = alloc_pages(GFP_DMA, cOrder);
    10291029#else
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r3542 r3672  
    4949*   Structures and Typedefs                                                    *
    5050*******************************************************************************/
    51 #if 0 //def __AMD64__
     51#if 0 //def RT_ARCH_AMD64
    5252typedef struct SUPDRVEXECMEM
    5353{
     
    328328             pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession));
    329329
    330 #ifdef __AMD64__
     330#ifdef RT_ARCH_AMD64
    331331    /* Don't allow 32-bit processes to do any I/O controls. */
    332332    if (!IoIs32bitProcess(pIrp))
     
    360360                     pStack->Parameters.DeviceIoControl.IoControlCode));
    361361    }
    362 #ifdef __AMD64__
     362#ifdef RT_ARCH_AMD64
    363363    else
    364364        dprintf(("VBoxSupDrvDeviceControlSlow: WOW64 req - not supported\n"));
     
    613613                 * Done, setup pMem and return values.
    614614                 */
    615 #ifdef __AMD64__
     615#ifdef RT_ARCH_AMD64
    616616                 MmProtectMdlSystemAddress(pMem->u.cont.pMdl, PAGE_EXECUTE_READWRITE);
    617617#endif
     
    10691069    dprintf2(("supdrvOSGipSuspend:\n"));
    10701070    KeCancelTimer(&pDevExt->GipTimer);
    1071 #ifdef __AMD64__
     1071#ifdef RT_ARCH_AMD64
    10721072    ExSetTimerResolution(0, FALSE);
    10731073#endif
     
    10841084void *VBOXCALL  supdrvOSExecAlloc(size_t cb)
    10851085{
    1086 #if 0 //def __AMD64__
     1086#if 0 //def RT_ARCH_AMD64
    10871087    cb = RT_ALIGN_Z(cb, PAGE_SIZE);
    10881088    void *pv = ExAllocatePoolWithTag(NonPagedPool, cb, SUPDRV_NT_POOL_TAG);
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm

    r3542 r3672  
    2626
    2727BEGINCODE
    28 %ifdef __AMD64__
     28%ifdef RT_ARCH_AMD64
    2929%define _DbgPrint DbgPrint
    3030%endif
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