- Timestamp:
- Jan 25, 2007 8:47:51 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 17884
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/Makefile
r314 r331 51 51 include/iprt/cdefs.h=$(PATH_ROOT)/include/iprt/cdefs.h \ 52 52 include/iprt/err.h=$(PATH_ROOT)/include/iprt/err.h \ 53 include/iprt/heap.h=$(PATH_ROOT)/include/iprt/heap.h \ 54 include/iprt/initterm.h=$(PATH_ROOT)/include/iprt/initterm.h \ 53 55 include/iprt/log.h=$(PATH_ROOT)/include/iprt/log.h \ 54 56 include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \ … … 65 67 include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \ 66 68 include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \ 69 include/internal/initterm.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/initterm.h \ 67 70 linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \ 68 71 Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \ 72 alloc/heapsimple.c=$(PATH_ROOT)/src/VBox/Runtime/alloc/heapsimple.cpp \ 69 73 r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \ 70 74 r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \ 75 r0drv/initterm-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/initterm-r0drv.cpp \ 71 76 r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \ 77 r0drv/linux/initterm-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c \ 72 78 r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \ 73 79 r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \ -
trunk/src/VBox/HostDrivers/Support/linux/Makefile
r213 r331 21 21 # 22 22 23 # 24 # First, figure out which architecture we're targeting. 25 # (We have to support basic cross building (ARCH=i386|x86_64).) 26 # 27 ifeq ($(filter amd64 x86,$(BUILD_TARGET_ARCH)),) 28 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.) 29 BUILD_TARGET_ARCH := 30 endif 31 ifeq ($(BUILD_TARGET_ARCH),) 32 ifeq ($(ARCH),x86_64) 33 BUILD_TARGET_ARCH := amd64 34 else ifeq ($(ARCH),i386) 35 BUILD_TARGET_ARCH := x86 36 else ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),) 37 BUILD_TARGET_ARCH := amd64 38 else 39 BUILD_TARGET_ARCH := x86 40 endif 41 endif 42 43 23 44 MODULE = vboxdrv 24 45 OBJS = \ … … 26 47 SUPDRVShared.o \ 27 48 r0drv/alloc-r0drv.o \ 49 r0drv/initterm-r0drv.o \ 28 50 r0drv/linux/alloc-r0drv-linux.o \ 51 r0drv/linux/initterm-r0drv-linux.o \ 29 52 r0drv/linux/semaphore-r0drv-linux.o \ 30 53 r0drv/linux/spinlock-r0drv-linux.o \ 31 r0drv/linux/thread-r0drv-linux.o \ 54 r0drv/linux/thread-r0drv-linux.o 55 ifeq ($(BUILD_TARGET_ARCH),amd64) 56 OBJS += alloc/heapsimple.o 57 endif 58 32 59 33 60 ifneq ($(MAKECMDGOALS),clean) … … 94 121 KFLAGS += -DCONFIG_VBOXDRV_AS_MISC 95 122 endif 96 ifeq ($( filter-out x86_64 amd64 AMD64,$(shell uname -m)),)123 ifeq ($(BUILD_TARGET_ARCH),amd64) 97 124 KFLAGS += -D__AMD64__ 98 125 else -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r260 r331 1 1 /** @file 2 * 3 * VBox host drivers - Ring-0 support drivers - Linux host: 4 * Linux host driver code 2 * The VirtualBox Support Driver - Linux hosts. 5 3 */ 6 4 … … 28 26 #include <iprt/spinlock.h> 29 27 #include <iprt/semaphore.h> 28 #include <iprt/initterm.h> 29 #include <iprt/err.h> 30 #include <iprt/mem.h> 30 31 31 32 #include <linux/module.h> … … 213 214 #define DEVICE_MAJOR 234 214 215 /** Saved major device number */ 215 static int 216 static int g_iModuleMajor; 216 217 #endif /* !CONFIG_VBOXDRV_AS_MISC */ 217 218 … … 219 220 #define DEVICE_NAME "vboxdrv" 220 221 221 222 #ifdef __AMD64__ 223 /** 224 * Memory for the executable memory heap (in IPRT). 225 */ 226 extern uint8_t g_abExecMemory[1572864]; /* 1.5 MB */ 227 __asm__(".section execmemory, \"awx\", @progbits\n\t" 228 ".align 32\n\t" 229 ".globl g_abExecMemory\n" 230 "g_abExecMemory:\n\t" 231 ".zero 1572864\n\t" 232 ".type g_abExecMemory, @object\n\t" 233 ".size g_abExecMemory, 1572864\n\t" 234 ".text\n\t"); 235 #endif 222 236 223 237 … … 242 256 static struct file_operations gFileOpsVBoxDrv = 243 257 { 244 owner:THIS_MODULE,245 open:VBoxSupDrvCreate,246 release:VBoxSupDrvClose,247 ioctl:VBoxSupDrvDeviceControl,258 owner: THIS_MODULE, 259 open: VBoxSupDrvCreate, 260 release: VBoxSupDrvClose, 261 ioctl: VBoxSupDrvDeviceControl, 248 262 }; 249 263 … … 378 392 if (rc < 0) 379 393 { 380 394 dprintf(("VBOX_REGISTER_DEVICE failed with rc=%#x!\n", rc)); 381 395 return rc; 382 396 } … … 398 412 if (g_hDevFsVBoxDrv == NULL) 399 413 { 400 414 dprintf(("devfs_register failed!\n")); 401 415 rc = -EINVAL; 402 416 } … … 406 420 { 407 421 /* 408 * Initialize the device extension. 422 * Initialize the runtime. 423 * On AMD64 we'll have to donate the high rwx memory block to the exec allocator. 409 424 */ 410 rc = supdrvInitDevExt(&g_DevExt);411 if ( !rc)425 rc = RTR0Init(0); 426 if (RT_SUCCESS(rc)) 412 427 { 428 #ifdef __AMD64__ 429 rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory)); 430 #endif 413 431 /* 414 * Create the GIP page.432 * Initialize the device extension. 415 433 */ 416 rc = VBoxSupDrvInitGip(&g_DevExt); 434 if (RT_SUCCESS(rc)) 435 rc = supdrvInitDevExt(&g_DevExt); 417 436 if (!rc) 418 437 { 419 dprintf(("VBoxDrv::ModuleInit returning %#x\n", rc)); 420 return rc; 438 /* 439 * Create the GIP page. 440 */ 441 rc = VBoxSupDrvInitGip(&g_DevExt); 442 if (!rc) 443 { 444 dprintf(("VBoxDrv::ModuleInit returning %#x\n", rc)); 445 return rc; 446 } 447 448 supdrvDeleteDevExt(&g_DevExt); 421 449 } 422 supdrvDeleteDevExt(&g_DevExt); 450 else 451 rc = -EINVAL; 452 RTR0Term(); 423 453 } 424 454 else … … 476 506 477 507 /* 478 * Destroy GIP and delete the device extension.508 * Destroy GIP, delete the device extension and terminate IPRT. 479 509 */ 480 510 VBoxSupDrvTermGip(&g_DevExt); 481 511 supdrvDeleteDevExt(&g_DevExt); 512 RTR0Term(); 482 513 } 483 514 … … 540 571 { 541 572 int rc; 542 SUPDRVIOCTLDATA 573 SUPDRVIOCTLDATA Args; 543 574 void *pvBuf = NULL; 544 575 int cbBuf = 0; … … 686 717 int VBOXCALL supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages) 687 718 { 688 int 719 int rc; 689 720 struct page **papPages; 690 721 unsigned iPage; … … 1481 1512 { 1482 1513 #if 1 1483 va_list 1484 char 1514 va_list args; 1515 char szMsg[512]; 1485 1516 1486 1517 va_start(args, pszFormat); … … 1513 1544 RTDECL(void) AssertMsg2(const char *pszFormat, ...) 1514 1545 { /* forwarder. */ 1515 va_list 1516 char 1546 va_list ap; 1547 char msg[256]; 1517 1548 1518 1549 va_start(ap, pszFormat); -
trunk/src/VBox/Runtime/Makefile
r289 r331 533 533 VBox/strformat-vbox.cpp \ 534 534 r0drv/alloc-r0drv.cpp \ 535 r0drv/initterm-r0drv.cpp \ 535 536 generic/RTLogWriteStdErr-stub-generic.cpp \ 536 537 generic/RTLogWriteStdOut-stub-generic.cpp \ … … 541 542 542 543 RuntimeR0Drv_SOURCES.linux = \ 544 alloc/heapsimple.cpp \ 543 545 r0drv/linux/alloc-r0drv-linux.c \ 546 r0drv/linux/initterm-r0drv-linux.c \ 544 547 r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \ 545 548 r0drv/linux/semaphore-r0drv-linux.c \ 546 549 r0drv/linux/spinlock-r0drv-linux.c \ 547 550 r0drv/linux/thread-r0drv-linux.c 548 RuntimeR0Drv_SOURCES.linux.amd64 = \549 alloc/heapsimple.cpp550 551 551 552 RuntimeR0Drv_SOURCES.win = \ 552 553 nt/RTErrConvertFromNtStatus.cpp \ 553 554 r0drv/nt/alloc-r0drv-nt.cpp \ 555 r0drv/nt/initterm-r0drv-nt.cpp \ 554 556 r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp \ 555 557 r0drv/nt/semaphore-r0drv-nt.cpp \ … … 564 566 RTErrConvertFromErrno.cpp \ 565 567 string/memchr.asm \ 566 r0drv/initterm-r0drv.cpp \567 568 r0drv/memobj-r0drv.cpp \ 568 569 r0drv/thread-r0drv.cpp \ -
trunk/src/VBox/Runtime/alloc/heapsimple.cpp
r329 r331 311 311 - sizeof(RTHEAPSIMPLEINTERNAL); 312 312 pHeapInt->pFreeTail = pHeapInt->pFreeHead = (PRTHEAPSIMPLEFREE)(pHeapInt + 1); 313 for (unsigned i = 0; i < ELEMENTS(pHeapInt->auAlignment); i++) 313 unsigned i; 314 for (i = 0; i < ELEMENTS(pHeapInt->auAlignment); i++) 314 315 pHeapInt->auAlignment[i] = ~(size_t)0; 315 316 … … 448 449 */ 449 450 PRTHEAPSIMPLEBLOCK pRet = NULL; 450 for (PRTHEAPSIMPLEFREE pFree = pHeapInt->pFreeHead; 451 PRTHEAPSIMPLEFREE pFree; 452 for (pFree = pHeapInt->pFreeHead; 451 453 pFree; 452 454 pFree = pFree->pNext) … … 768 770 PRTHEAPSIMPLEFREE pPrev = NULL; 769 771 PRTHEAPSIMPLEFREE pPrevFree = NULL; 770 for (PRTHEAPSIMPLEFREE pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1); 772 PRTHEAPSIMPLEFREE pBlock; 773 for (pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1); 771 774 pBlock; 772 775 pBlock = (PRTHEAPSIMPLEFREE)pBlock->Core.pNext) … … 881 884 Heap, pHeapInt->cbHeap, pHeapInt->cbFree); 882 885 883 for (PRTHEAPSIMPLEFREE pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1); 886 PRTHEAPSIMPLEFREE pBlock; 887 for (pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1); 884 888 pBlock; 885 889 pBlock = (PRTHEAPSIMPLEFREE)pBlock->Core.pNext) -
trunk/src/VBox/Runtime/include/internal/initterm.h
r207 r331 23 23 #define __internal_initterm_h_ 24 24 25 #include < sys/cdefs.h>25 #include <iprt/cdefs.h> 26 26 27 27 __BEGIN_DECLS -
trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
r291 r331 25 25 *******************************************************************************/ 26 26 #include "the-linux-kernel.h" 27 #include <iprt/ alloc.h>27 #include <iprt/mem.h> 28 28 #include <iprt/assert.h> 29 29 #include "r0drv/alloc-r0drv.h" … … 60 60 * This is as RTMemExecDonate specific to AMD64 Linux/GNU. 61 61 */ 62 RTDECL(void) RTMemExecCleanup(void)62 void rtR0MemExecCleanup(void) 63 63 { 64 64 RTSpinlockDestroy(g_HeapExecSpinlock); … … 82 82 * @param cb The size of the memory block. 83 83 */ 84 RT DECL(int) RTMemExecDonate(void *pvMemory, size_t cb)84 RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb) 85 85 { 86 86 int rc; … … 92 92 rc = RTHeapSimpleInit(&g_HeapExec, pvMemory, cb); 93 93 if (RT_FAILURE(rc)) 94 RTMemExecCleanup();94 rtR0MemExecCleanup(); 95 95 } 96 96 return rc; -
trunk/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
r303 r331 1 1 /* $Id$ */ 2 2 /** @file 3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Darwin.3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Linux. 4 4 */ 5 5 … … 24 24 * Header Files * 25 25 *******************************************************************************/ 26 #include "the- darwin-kernel.h"26 #include "the-linux-kernel.h" 27 27 #include <iprt/err.h> 28 28 #include <iprt/assert.h> … … 31 31 32 32 /******************************************************************************* 33 * Global Variables*33 * Internal Functions * 34 34 *******************************************************************************/ 35 /** Pointer to the lock group used by IPRT. */ 36 lck_grp_t *g_pDarwinLockGroup = NULL; 37 35 #ifdef __AMD64__ 36 /* in alloc-r0drv0-linux.c */ 37 extern void rtR0MemExecCleanup(void); 38 #endif 38 39 39 40 40 41 int rtR0InitNative(void) 41 42 { 42 /*43 * Create the lock group.44 */45 g_pDarwinLockGroup = lck_grp_alloc_init("IPRT", LCK_GRP_ATTR_NULL);46 AssertReturn(g_pDarwinLockGroup, VERR_NO_MEMORY);47 48 43 return VINF_SUCCESS; 49 44 } … … 52 47 void rtR0TermNative(void) 53 48 { 54 /* 55 * Free the lock group. 56 */ 57 if (g_pDarwinLockGroup) 58 { 59 lck_grp_free(g_pDarwinLockGroup); 60 g_pDarwinLockGroup = NULL; 61 } 49 #ifdef __AMD64__ 50 rtR0MemExecCleanup(); 51 #endif 62 52 } 63 53 -
trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
r260 r331 23 23 #define __the_linux_kernel_h__ 24 24 25 #ifndef bool /* Linux 2.6.19 C++ nightmare */ 26 #define bool bool_type 27 #define true true_type 28 #define false false_type 29 #define _Bool int 30 #define bool_type_r0drv_the_linux_kernel_h__ 31 #endif 25 /* 26 * Include iprt/types.h to install the bool wrappers. 27 * Then use the linux bool type for all the stuff include here. 28 */ 29 #include <iprt/types.h> 30 #define bool linux_bool 32 31 33 32 #include <linux/autoconf.h> … … 54 53 # define KBUILD_STR(s) #s 55 54 # endif 56 #endif57 #include <iprt/cdefs.h>58 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)59 # undef ALIGN60 55 #endif 61 56 #include <linux/string.h> … … 90 85 #include <asm/div64.h> 91 86 92 #ifdef bool_type_r0drv_the_linux_kernel_h__93 #undef bool94 #undef true95 #undef false96 #undef _Bool97 #undef bool_type_r0drv_the_linux_kernel_h__98 #endif99 100 87 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 101 88 # ifndef page_to_pfn … … 228 215 #endif 229 216 230 #endif 231 217 /* 218 * Stop using the linux bool type. 219 */ 220 #undef bool 221 222 #endif 223 -
trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
r303 r331 1 1 /* $Id$ */ 2 2 /** @file 3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, Darwin.3 * InnoTek Portable Runtime - Initialization & Termination, R0 Driver, NT. 4 4 */ 5 5 … … 24 24 * Header Files * 25 25 *******************************************************************************/ 26 #include "the- darwin-kernel.h"26 #include "the-nt-kernel.h" 27 27 #include <iprt/err.h> 28 28 #include <iprt/assert.h> 29 29 #include "internal/initterm.h" 30 30 31 32 /*******************************************************************************33 * Global Variables *34 *******************************************************************************/35 /** Pointer to the lock group used by IPRT. */36 lck_grp_t *g_pDarwinLockGroup = NULL;37 38 39 40 31 int rtR0InitNative(void) 41 32 { 42 /*43 * Create the lock group.44 */45 g_pDarwinLockGroup = lck_grp_alloc_init("IPRT", LCK_GRP_ATTR_NULL);46 AssertReturn(g_pDarwinLockGroup, VERR_NO_MEMORY);47 48 33 return VINF_SUCCESS; 49 34 } … … 52 37 void rtR0TermNative(void) 53 38 { 54 /*55 * Free the lock group.56 */57 if (g_pDarwinLockGroup)58 {59 lck_grp_free(g_pDarwinLockGroup);60 g_pDarwinLockGroup = NULL;61 }62 39 } 63 40
Note:
See TracChangeset
for help on using the changeset viewer.