Changeset 3672 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Jul 17, 2007 12:39:30 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 22950
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDRV.h
r3621 r3672 41 41 42 42 43 #if defined( __WIN__)43 #if defined(RT_OS_WINDOWS) 44 44 __BEGIN_DECLS 45 45 # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK) … … 61 61 __END_DECLS 62 62 63 #elif defined( __LINUX__)63 #elif defined(RT_OS_LINUX) 64 64 # include <linux/autoconf.h> 65 65 # include <linux/version.h> … … 86 86 # include <linux/timer.h> 87 87 88 #elif defined( __DARWIN__)88 #elif defined(RT_OS_DARWIN) 89 89 # include <libkern/libkern.h> 90 90 # include <iprt/string.h> 91 91 92 #elif defined( __OS2__)93 94 #elif defined( __FREEBSD__)92 #elif defined(RT_OS_OS2) 93 94 #elif defined(RT_OS_FREEBSD) 95 95 # include <sys/libkern.h> 96 96 # include <iprt/string.h> … … 117 117 * Win32 118 118 */ 119 #if defined( __WIN__)119 #if defined(RT_OS_WINDOWS) 120 120 121 121 /* debug printf */ … … 126 126 * to actually be much lower. The values here have been determined experimentally. 127 127 */ 128 #ifdef __X86__128 #ifdef RT_ARCH_X86 129 129 # define MAX_LOCK_MEM_SIZE (32*1024*1024) /* 32mb */ 130 130 #endif 131 #ifdef __AMD64__131 #ifdef RT_ARCH_AMD64 132 132 # define MAX_LOCK_MEM_SIZE (24*1024*1024) /* 24mb */ 133 133 #endif … … 137 137 * Linux 138 138 */ 139 #elif defined( __LINUX__)139 #elif defined(RT_OS_LINUX) 140 140 141 141 /* check kernel version */ … … 155 155 * Darwin 156 156 */ 157 #elif defined( __DARWIN__)157 #elif defined(RT_OS_DARWIN) 158 158 159 159 /* debug printf */ … … 164 164 * OS/2 165 165 */ 166 #elif defined( __OS2__)166 #elif defined(RT_OS_OS2) 167 167 168 168 /* No log API in OS/2 only COM port. */ … … 173 173 * FreeBSD 174 174 */ 175 #elif defined( __FREEBSD__)175 #elif defined(RT_OS_FREEBSD) 176 176 177 177 /* No log API in OS/2 only COM port. */ … … 198 198 199 199 /* dprintf2 - extended logging. */ 200 #if defined( __DARWIN__) || defined(__OS2__)200 #if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) 201 201 # define dprintf2 dprintf 202 202 #else … … 250 250 /** Segment Selector. */ 251 251 uint32_t u16SegSel : 16; 252 #ifdef __AMD64__252 #ifdef RT_ARCH_AMD64 253 253 /** Interrupt Stack Table index. */ 254 254 uint32_t u3IST : 3; … … 269 269 /** High offset word. */ 270 270 uint32_t u16OffsetHigh : 16; 271 #ifdef __AMD64__271 #ifdef RT_ARCH_AMD64 272 272 /** The upper top part of the address. */ 273 273 uint32_t u32OffsetTop; … … 381 381 struct 382 382 { 383 #if defined( __WIN__)383 #if defined(RT_OS_WINDOWS) 384 384 /** Pointer to memory descriptor list (MDL). */ 385 385 PMDL *papMdl; 386 386 unsigned cMdls; 387 #elif defined( __LINUX__)387 #elif defined(RT_OS_LINUX) 388 388 struct page **papPages; 389 389 unsigned cPages; … … 394 394 struct 395 395 { 396 #if defined( __WIN__)396 #if defined(RT_OS_WINDOWS) 397 397 /** Pointer to memory descriptor list (MDL). */ 398 398 PMDL pMdl; 399 #elif defined( __LINUX__)399 #elif defined(RT_OS_LINUX) 400 400 struct page *paPages; 401 401 unsigned cPages; … … 406 406 struct 407 407 { 408 #if defined( __WIN__)408 #if defined(RT_OS_WINDOWS) 409 409 /** Pointer to memory descriptor list (MDL). */ 410 410 PMDL pMdl; 411 #elif defined( __LINUX__)411 #elif defined(RT_OS_LINUX) 412 412 /** Pointer to the array of page pointers. */ 413 413 struct page **papPages; … … 572 572 /** Which process this session is associated with. */ 573 573 RTR0PROCESS R0Process; 574 #if defined( __OS2__)574 #if defined(RT_OS_OS2) 575 575 /** The system file number of this session. */ 576 576 uint16_t sfn; 577 577 uint16_t Alignment; /**< Alignment */ 578 578 #endif 579 #if defined( __DARWIN__) || defined(__OS2__)579 #if defined(RT_OS_DARWIN) || defined(RT_OS_OS2) 580 580 /** Pointer to the next session with the same hash. */ 581 581 PSUPDRVSESSION pNextHash; … … 644 644 uint32_t u32SystemTimerGranularityGrant; 645 645 #endif 646 #ifdef __WIN__646 #ifdef RT_OS_WINDOWS 647 647 /** The GIP timer object. */ 648 648 KTIMER GipTimer; … … 656 656 ULONG ulGipTimerInterval; 657 657 #endif 658 #ifdef __LINUX__658 #ifdef RT_OS_LINUX 659 659 /** The last jiffies. */ 660 660 unsigned long ulLastJiffies; -
trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h
r3537 r3672 34 34 * and 64-bit processes. 35 35 */ 36 #ifdef __AMD64__36 #ifdef RT_ARCH_AMD64 37 37 # define SUP_IOCTL_FLAG 128 38 #elif defined( __X86__)38 #elif defined(RT_ARCH_X86) 39 39 # define SUP_IOCTL_FLAG 0 40 40 #else … … 42 42 #endif 43 43 44 #ifdef __WIN__44 #ifdef RT_OS_WINDOWS 45 45 # define SUP_CTL_CODE(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS) 46 46 # define SUP_CTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS) … … 64 64 # endif 65 65 66 #elif defined( __OS2__)66 #elif defined(RT_OS_OS2) 67 67 # define SUP_CTL_CATEGORY 0xc0 68 68 # define SUP_CTL_CODE(Function) ((unsigned char)(Function)) … … 70 70 # define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function)) 71 71 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. */ 74 74 # define SUP_CTL_CODE(Function) \ 75 75 ( (3U << 30) | ((0x22) << 8) | ((Function) | SUP_IOCTL_FLAG) | (sizeof(SUPDRVIOCTLDATA) << 16) ) … … 87 87 # endif 88 88 89 #elif defined( __L4__)89 #elif defined(RT_OS_L4) 90 90 # define SUP_CTL_CODE(Function) \ 91 91 ( (3U << 30) | ((0x22) << 8) | ((Function) | SUP_IOCTL_FLAG) | (sizeof(SUPDRVIOCTLDATA) << 16) ) … … 150 150 * Structures and Typedefs * 151 151 *******************************************************************************/ 152 #ifdef __AMD64__152 #ifdef RT_ARCH_AMD64 153 153 # pragma pack(8) /* paranoia. */ 154 154 #else … … 156 156 #endif 157 157 158 #ifndef __WIN__158 #ifndef RT_OS_WINDOWS 159 159 /** 160 160 * Structure used by OSes with less advanced ioctl interfaces, i.e. most … … 167 167 void *pvOut; 168 168 unsigned long cbOut; 169 #ifdef __OS2__169 #ifdef RT_OS_OS2 170 170 int rc; 171 171 #endif -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r3537 r3672 260 260 /* objects. */ 261 261 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! */ 263 263 Assert(!pObj); /* (can trigger on forced unloads) */ 264 264 #endif … … 2762 2762 static uint8_t au8Ints[] = 2763 2763 { 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, 2765 2765 * local apic timer, or some other frequently fireing thing). */ 2766 2766 0xef, 0xee, 0xed, 0xec, … … 2771 2771 0xbf, 0xbe, 0xbd, 0xbc, 2772 2772 }; 2773 #if defined( __AMD64__) && defined(DEBUG)2773 #if defined(RT_ARCH_AMD64) && defined(DEBUG) 2774 2774 static int s_iWobble = 0; 2775 2775 unsigned iMax = !(s_iWobble++ % 2) ? 0x80 : 0x100; … … 2826 2826 pPatch->ChangedIdt.u16OffsetLow = (uint32_t)((uintptr_t)&pPatch->auCode[0] & 0xffff); 2827 2827 pPatch->ChangedIdt.u16OffsetHigh = (uint32_t)((uintptr_t)&pPatch->auCode[0] >> 16); 2828 #ifdef __AMD64__2828 #ifdef RT_ARCH_AMD64 2829 2829 pPatch->ChangedIdt.u32OffsetTop = (uint32_t)((uintptr_t)&pPatch->auCode[0] >> 32); 2830 2830 #endif 2831 2831 pPatch->ChangedIdt.u16SegSel = ASMGetCS(); 2832 #ifdef __AMD64__2832 #ifdef RT_ARCH_AMD64 2833 2833 pPatch->ChangedIdt.u3IST = 0; 2834 2834 pPatch->ChangedIdt.u5Reserved = 0; … … 2845 2845 */ 2846 2846 { 2847 #ifdef __AMD64__2847 #ifdef RT_ARCH_AMD64 2848 2848 union 2849 2849 { … … 2876 2876 * reserve some stack space for the interrupt forwarding. 2877 2877 */ 2878 # ifdef __WIN__2878 # ifdef RT_OS_WINDOWS 2879 2879 *u.pb++ = 0x50; // push rax ; alignment filler. 2880 2880 *u.pb++ = 0x41; // push r8 ; uArg … … 2950 2950 *u.pb++ = 0xcb; 2951 2951 2952 #else /* __X86__*/2952 #else /* RT_ARCH_X86 */ 2953 2953 2954 2954 union … … 3001 3001 *u.pb++ = 0xc0; 3002 3002 3003 #ifdef __WIN__3003 #ifdef RT_OS_WINDOWS 3004 3004 *u.pb++ = 0xb8; // mov eax, KernelFS 3005 3005 *u.pu32++ = ASMGetFS(); … … 3056 3056 *uFixJmpNotNested.pu16++ = pPatch->SavedIdt.u16SegSel; 3057 3057 } 3058 #endif /* __X86__*/3058 #endif /* RT_ARCH_X86 */ 3059 3059 Assert(u.pb <= &pPatch->auCode[sizeof(pPatch->auCode)]); 3060 3060 #if 0 … … 3234 3234 3235 3235 /* Update IDT Entry */ 3236 #ifdef __AMD64__3236 #ifdef RT_ARCH_AMD64 3237 3237 ASMAtomicXchgU128((volatile uint128_t *)pvIdtEntry, *(uint128_t *)(uintptr_t)pNewIDTEntry); 3238 3238 #else … … 3629 3629 for (pPatch = pDevExt->pIdtPatches; pPatch; pPatch = pPatch->pNext) 3630 3630 { 3631 # ifdef __AMD64__3631 # ifdef RT_ARCH_AMD64 3632 3632 ASMAtomicXchgU64((volatile uint64_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup], (uint64_t)pvVMMR0); 3633 # else /* __X86__*/3633 # else /* RT_ARCH_X86 */ 3634 3634 ASMAtomicXchgU32((volatile uint32_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup], 3635 3635 (uint32_t)pvVMMR0 - (uint32_t)&pPatch->auCode[pPatch->offVMMR0EntryFixup + 4]); … … 3672 3672 for (pPatch = pDevExt->pIdtPatches; pPatch; pPatch = pPatch->pNext) 3673 3673 { 3674 # ifdef __AMD64__3674 # ifdef RT_ARCH_AMD64 3675 3675 ASMAtomicXchgU64((volatile uint64_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup], 3676 3676 (uint64_t)&pPatch->auCode[pPatch->offStub]); 3677 # else /* __X86__*/3677 # else /* RT_ARCH_X86 */ 3678 3678 ASMAtomicXchgU32((volatile uint32_t *)&pPatch->auCode[pPatch->offVMMR0EntryFixup], 3679 3679 (uint32_t)&pPatch->auCode[pPatch->offStub] - (uint32_t)&pPatch->auCode[pPatch->offVMMR0EntryFixup + 4]); … … 4298 4298 if (pGip->u64NanoTSLastUpdateHz) 4299 4299 { 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. */ 4301 4301 uint64_t u64Delta = u64NanoTS - pGip->u64NanoTSLastUpdateHz; 4302 4302 uint32_t u32UpdateHz = (uint32_t)((UINT64_C(1000000000) * GIP_UPDATEHZ_RECALC_FREQ) / u64Delta); -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r3537 r3672 807 807 * Generate the code. 808 808 */ 809 #ifdef __AMD64__809 #ifdef RT_ARCH_AMD64 810 810 /* 811 811 * reg params: -
trunk/src/VBox/HostDrivers/Support/linux/Makefile
r3400 r3672 123 123 export INCL 124 124 endif 125 KFLAGS := -D__KERNEL__ -DMODULE -D __LINUX__-DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0125 KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 126 126 ifndef CONFIG_VBOXDRV_FIXEDMAJOR 127 127 KFLAGS += -DCONFIG_VBOXDRV_AS_MISC 128 128 endif 129 129 ifeq ($(BUILD_TARGET_ARCH),amd64) 130 KFLAGS += -D __AMD64__130 KFLAGS += -DRT_ARCH_AMD64 131 131 else 132 KFLAGS += -D __X86__132 KFLAGS += -DRT_ARCH_X86 133 133 endif 134 134 #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 121 121 * This sucks soooo badly on x86! Why don't they export __PAGE_KERNEL_EXEC so PAGE_KERNEL_EXEC would be usable? 122 122 */ 123 #if defined( __AMD64__)123 #if defined(RT_ARCH_AMD64) 124 124 # define MY_PAGE_KERNEL_EXEC PAGE_KERNEL_EXEC 125 125 #elif defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE) … … 149 149 # endif 150 150 151 # ifndef __AMD64__151 # ifndef RT_ARCH_AMD64 152 152 /* In 2.6.9-22.ELsmp we have to call change_page_attr() twice when changing 153 153 * the page attributes from PAGE_KERNEL to something else, because there appears … … 170 170 171 171 #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(). */ 173 173 # define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \ 174 174 do { \ … … 205 205 * and disabled on i386. 206 206 */ 207 # if defined( __AMD64__)207 # if defined(RT_ARCH_AMD64) 208 208 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21) 209 209 # define DO_DISABLE_NMI 1 … … 267 267 #define DEVICE_NAME "vboxdrv" 268 268 269 #ifdef __AMD64__269 #ifdef RT_ARCH_AMD64 270 270 /** 271 271 * Memory for the executable memory heap (in IPRT). … … 608 608 if (RT_SUCCESS(rc)) 609 609 { 610 #ifdef __AMD64__610 #ifdef RT_ARCH_AMD64 611 611 rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory)); 612 612 #endif … … 1025 1025 * Allocate page pointer array. 1026 1026 */ 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). */ 1028 1028 paPages = alloc_pages(GFP_DMA, cOrder); 1029 1029 #else -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r3542 r3672 49 49 * Structures and Typedefs * 50 50 *******************************************************************************/ 51 #if 0 //def __AMD64__51 #if 0 //def RT_ARCH_AMD64 52 52 typedef struct SUPDRVEXECMEM 53 53 { … … 328 328 pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession)); 329 329 330 #ifdef __AMD64__330 #ifdef RT_ARCH_AMD64 331 331 /* Don't allow 32-bit processes to do any I/O controls. */ 332 332 if (!IoIs32bitProcess(pIrp)) … … 360 360 pStack->Parameters.DeviceIoControl.IoControlCode)); 361 361 } 362 #ifdef __AMD64__362 #ifdef RT_ARCH_AMD64 363 363 else 364 364 dprintf(("VBoxSupDrvDeviceControlSlow: WOW64 req - not supported\n")); … … 613 613 * Done, setup pMem and return values. 614 614 */ 615 #ifdef __AMD64__615 #ifdef RT_ARCH_AMD64 616 616 MmProtectMdlSystemAddress(pMem->u.cont.pMdl, PAGE_EXECUTE_READWRITE); 617 617 #endif … … 1069 1069 dprintf2(("supdrvOSGipSuspend:\n")); 1070 1070 KeCancelTimer(&pDevExt->GipTimer); 1071 #ifdef __AMD64__1071 #ifdef RT_ARCH_AMD64 1072 1072 ExSetTimerResolution(0, FALSE); 1073 1073 #endif … … 1084 1084 void *VBOXCALL supdrvOSExecAlloc(size_t cb) 1085 1085 { 1086 #if 0 //def __AMD64__1086 #if 0 //def RT_ARCH_AMD64 1087 1087 cb = RT_ALIGN_Z(cb, PAGE_SIZE); 1088 1088 void *pv = ExAllocatePoolWithTag(NonPagedPool, cb, SUPDRV_NT_POOL_TAG); -
trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm
r3542 r3672 26 26 27 27 BEGINCODE 28 %ifdef __AMD64__28 %ifdef RT_ARCH_AMD64 29 29 %define _DbgPrint DbgPrint 30 30 %endif
Note:
See TracChangeset
for help on using the changeset viewer.