Changeset 331 in vbox for trunk/src/VBox/HostDrivers/Support/linux
- Timestamp:
- Jan 25, 2007 8:47:51 PM (18 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support/linux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.