Changeset 4178 in vbox
- Timestamp:
- Aug 16, 2007 3:07:51 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r4082 r4178 1238 1238 TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) 1239 1239 TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) 1240 TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic 1241 # temporarily, must fix the loader. 1242 TEMPLATE_VBOXGC_LDFLAGS += -S 1243 TEMPLATE_VBOXGC_LDFLAGS.release = -S 1240 ifeq ($(BUILD_TARGET),solaris) 1241 TEMPLATE_VBOXGC_LDFLAGS = -B symbolic 1242 else 1243 TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic 1244 # temporarily, must fix the loader. 1245 TEMPLATE_VBOXGC_LDFLAGS += -S 1246 TEMPLATE_VBOXGC_LDFLAGS.release = -S 1247 endif 1244 1248 TEMPLATE_VBOXGC_LIBS = \ 1245 1249 $(VBOX_GCC32_LIBGCC) # instricts … … 1335 1339 TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding 1336 1340 TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables 1337 TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic 1338 # temporarily, must fix the loader. 1339 TEMPLATE_VBOXR0_LDFLAGS += -S 1340 TEMPLATE_VBOXR0_LDFLAGS.release = -S 1341 ifeq ($(BUILD_TARGET),solaris) 1342 TEMPLATE_VBOXR0_LDFLAGS = -B symbolic 1343 else 1344 TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic 1345 # temporarily, must fix the loader. 1346 TEMPLATE_VBOXR0_LDFLAGS += -S 1347 TEMPLATE_VBOXR0_LDFLAGS.release = -S 1348 endif 1349 1341 1350 TEMPLATE_VBOXR0_LIBS = \ 1342 1351 $(VBOX_GCC_LIBGCC) # instricts … … 1456 1465 ## The Solaris /usr/include. 1457 1466 VBOX_SOLARIS_SYS_INCS ?= /usr/include 1458 1459 1467 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL) 1460 1468 TEMPLATE_VBOXR0DRV_DEFS = _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0 … … 1465 1473 # exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress!! 1466 1474 TEMPLATE_VBOXR0DRV_CFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \ 1467 -Wmissing-prototypes -Wstrict-prototypes \1475 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \ 1468 1476 -O2 -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99 1469 1477 ## *************************** SOLARISTODO ****************** -
trunk/src/VBox/Frontends/VBoxBFE/Makefile.kmk
r4071 r4178 80 80 SDLConsole.cpp \ 81 81 SDLFramebuffer.cpp 82 VBoxBFE_SOURCES.solaris = \ 83 SDLConsole.cpp \ 84 SDLFramebuffer.cpp 82 85 83 86 VBoxBFE_INCS = \ -
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r4163 r4178 250 250 vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) 251 251 vboxdrv_SOURCES = \ 252 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c 253 #SUPDRVShared.c252 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \ 253 SUPDRVShared.c 254 254 endif # solaris 255 255 -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r4071 r4178 32 32 #include <sys/ddi.h> 33 33 #include <sys/sunddi.h> 34 #include <sys/file.h> 34 35 35 36 #include "SUPDRV.h" … … 37 38 #include <iprt/process.h> 38 39 #include <iprt/initterm.h> 40 #include <iprt/alloc.h> 39 41 40 42 … … 54 56 static int VBoxDrvSolarisRead(dev_t Dev, struct uio* pUio, cred_t* pCred); 55 57 static int VBoxDrvSolarisWrite(dev_t Dev, struct uio* pUio, cred_t* pCred); 56 static int VBoxDrvSolarisI octl (dev_t Dev, int Cmd, intptr_t Arg, int mode,cred_t* pCred, int* pVal);58 static int VBoxDrvSolarisIOCtl (dev_t Dev, int Cmd, intptr_t pArgs, int mode, cred_t* pCred, int* pVal); 57 59 58 60 static int VBoxDrvSolarisAttach(dev_info_t* pDip, ddi_attach_cmd_t Cmd); 59 61 static int VBoxDrvSolarisDetach(dev_info_t* pDip, ddi_detach_cmd_t Cmd); 60 62 61 static int VBoxDrvSolarisErr2Native(int rc); 63 static int VBoxSupDrvErr2SolarisErr(int rc); 64 static int VBoxDrvSolarisIOCtlSlow(PSUPDRVSESSION pSession, int Cmd, int Mode, intptr_t pArgs); 62 65 63 66 … … 77 80 VBoxDrvSolarisRead, 78 81 VBoxDrvSolarisWrite, 79 VBoxDrvSolarisI octl,82 VBoxDrvSolarisIOCtl, 80 83 nodev, /* c devmap */ 81 84 nodev, /* c mmap */ … … 100 103 VBoxDrvSolarisAttach, 101 104 VBoxDrvSolarisDetach, 102 nodev, /* reset */105 nodev, /* reset */ 103 106 &g_VBoxDrvSolarisCbOps, 104 107 (struct bus_ops *)0, … … 126 129 }; 127 130 128 /** Track module instances */ 129 dev_info_t* g_pVBoxDrvSolarisDip; 131 /** State info. each our kernel module instances */ 132 typedef struct 133 { 134 dev_info_t* pDip; /* Device handle */ 135 } vbox_devstate_t; 130 136 131 137 /** Opaque pointer to state */ … … 152 158 cmn_err(CE_CONT, "VBoxDrvSolaris _init"); 153 159 154 int e = ddi_soft_state_init(&g_pVBoxDrvSolarisState, sizeof ( g_pVBoxDrvSolarisDip), 1);160 int e = ddi_soft_state_init(&g_pVBoxDrvSolarisState, sizeof (vbox_devstate_t), 1); 155 161 if (e != 0) 156 162 return e; … … 175 181 } 176 182 177 int _info (struct modinfo *pModInfo)183 int _info (struct modinfo *pModInfo) 178 184 { 179 185 cmn_err(CE_CONT, "VBoxDrvSolaris _info"); … … 184 190 * User context entry points 185 191 */ 186 static int VBoxDrvSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred)192 static int VBoxDrvSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred) 187 193 { 188 194 cmn_err(CE_CONT, "VBoxDrvSolarisOpen"); … … 193 199 /* 194 200 * Create a new session. 195 */ 196 #if 1 197 rc = VINF_SUCCESS; 198 #else 201 * Sessions in Solaris driver are mostly useless. It's however needed 202 * in VBoxDrvSolarisIOCtlSlow() while calling supdrvIOCtl() 203 */ 199 204 rc = supdrvCreateSession(&g_DevExt, &pSession); 200 205 if (RT_SUCCESS(rc)) 201 206 { 207 cmn_err(CE_NOTE,"supdrvCreateSession success"); 202 208 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 203 209 unsigned iHash; … … 216 222 g_apSessionHashTab[iHash] = pSession; 217 223 RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); 218 } 219 #endif 220 return VBoxDrvSolarisErr2Native(rc); 221 } 222 223 static int VBoxDrvSolarisClose(dev_t pDev, int flag, int otyp, cred_t* cred) 224 cmn_err(CE_NOTE,"VBoxDrvSolarisOpen success"); 225 } 226 227 return VBoxSupDrvErr2SolarisErr(rc); 228 } 229 230 static int VBoxDrvSolarisClose(dev_t pDev, int flag, int otyp, cred_t *cred) 224 231 { 225 232 cmn_err(CE_CONT, "VBoxDrvSolarisClose"); 233 234 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 235 const RTPROCESS Process = RTProcSelf(); 236 const unsigned iHash = SESSION_HASH(Process); 237 PSUPDRVSESSION pSession; 238 239 /* 240 * Remove from the hash table. 241 */ 242 RTSpinlockAcquireNoInts(g_Spinlock, &Tmp); 243 pSession = g_apSessionHashTab[iHash]; 244 if (pSession) 245 { 246 if (pSession->Process == Process) 247 { 248 g_apSessionHashTab[iHash] = pSession->pNextHash; 249 pSession->pNextHash = NULL; 250 } 251 else 252 { 253 PSUPDRVSESSION pPrev = pSession; 254 pSession = pSession->pNextHash; 255 while (pSession) 256 { 257 if (pSession->Process == Process) 258 { 259 pPrev->pNextHash = pSession->pNextHash; 260 pSession->pNextHash = NULL; 261 break; 262 } 263 264 /* next */ 265 pPrev = pSession; 266 pSession = pSession->pNextHash; 267 } 268 } 269 } 270 RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); 271 if (!pSession) 272 { 273 OSDBGPRINT(("VBoxDrvSolarisClose: WHAT?!? pSession == NULL! This must be a mistake... pid=%d (close)\n", 274 (int)Process)); 275 return DDI_FAILURE; 276 } 277 278 /* 279 * Close the session. 280 */ 281 supdrvCloseSession(&g_DevExt, pSession); 226 282 return DDI_SUCCESS; 227 283 } … … 252 308 int rc = VINF_SUCCESS; 253 309 int instance = 0; 254 310 vbox_devstate_t* pState; 311 255 312 switch (enmCmd) 256 313 { … … 258 315 { 259 316 instance = ddi_get_instance (pDip); 260 g_pVBoxDrvSolarisDip = pDip;261 317 262 318 if (ddi_soft_state_zalloc(g_pVBoxDrvSolarisState, instance) != DDI_SUCCESS) … … 265 321 return DDI_FAILURE; 266 322 } 267 323 324 pState = ddi_get_soft_state(g_pVBoxDrvSolarisState, instance); 325 268 326 /* 269 327 * Initialize IPRT R0 driver, which internally calls OS-specific r0 init. … … 281 339 * Initialize the session hash table. 282 340 */ 283 //memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab));284 //rc = RTSpinlockCreate(&g_Spinlock);341 memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); 342 rc = RTSpinlockCreate(&g_Spinlock); 285 343 if (RT_SUCCESS(rc)) 286 344 { … … 288 346 * Register ourselves as a character device, pseudo-driver 289 347 */ 290 if (ddi_create_minor_node( g_pVBoxDrvSolarisDip, "0", S_IFCHR,348 if (ddi_create_minor_node(pDip, "0", S_IFCHR, 291 349 instance, DDI_PSEUDO, 0) == DDI_SUCCESS) 292 350 { 351 pState->pDip = pDip; 352 ddi_report_dev(pDip); 353 293 354 cmn_err(CE_CONT, "VBoxDrvSolarisAttach: successful."); 294 355 return DDI_SUCCESS; … … 296 357 297 358 /* Is this really necessary? */ 298 ddi_remove_minor_node( g_pVBoxDrvSolarisDip, NULL);359 ddi_remove_minor_node(pDip, NULL); 299 360 cmn_err(CE_NOTE,"VBoxDrvSolarisAttach: ddi_create_minor_node failed."); 300 361 301 //RTSpinlockDestroy(g_Spinlock);302 //g_Spinlock = NIL_RTSPINLOCK;362 RTSpinlockDestroy(g_Spinlock); 363 g_Spinlock = NIL_RTSPINLOCK; 303 364 } 304 365 else 305 366 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: RTSpinlockCreate failed"); 306 //supdrvDeleteDevExt(&g_DevExt);367 supdrvDeleteDevExt(&g_DevExt); 307 368 } 308 369 else … … 312 373 else 313 374 cmn_err(CE_NOTE, "VBoxDrvSolarisAttach: failed to init R0Drv"); 314 //memset(&g_DevExt, 0, sizeof(g_DevExt));375 memset(&g_DevExt, 0, sizeof(g_DevExt)); 315 376 break; 316 377 } … … 331 392 * @return corresponding solaris error code. 332 393 */ 333 static int VBoxDrvSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)394 static int VBoxDrvSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd) 334 395 { 335 396 int rc = VINF_SUCCESS; 336 int instance = ddi_get_instance(pDip); 397 int instance; 398 register vbox_devstate_t* pState; 337 399 338 400 cmn_err(CE_CONT, "VBoxDrvSolarisDetach"); … … 341 403 case DDI_DETACH: 342 404 { 343 g_pVBoxDrvSolarisDip = NULL; 344 ddi_get_soft_state(g_pVBoxDrvSolarisState, instance); 405 instance = ddi_get_instance(pDip); 406 pState = ddi_get_soft_state(g_pVBoxDrvSolarisState, instance); 407 345 408 ddi_remove_minor_node(pDip, NULL); 346 409 ddi_soft_state_free(g_pVBoxDrvSolarisState, instance); 410 411 rc = supdrvDeleteDevExt(&g_DevExt); 412 AssertRC(rc); 413 414 rc = RTSpinlockDestroy(g_Spinlock); 415 AssertRC(rc); 416 g_Spinlock = NIL_RTSPINLOCK; 417 418 RTR0Term(); 419 420 memset(&g_DevExt, 0, sizeof(g_DevExt)); 347 421 cmn_err(CE_CONT, "VBoxDrvSolarisDetach: Clean Up Done."); 348 349 //rc = supdrvDeleteDevExt(&g_DevExt);350 //AssertRC(rc);351 352 //rc = RTSpinlockDestroy(g_Spinlock);353 //AssertRC(rc);354 //g_Spinlock = NIL_RTSPINLOCK;355 356 RTR0Term();357 358 memset(&g_DevExt, 0, sizeof(g_DevExt));359 360 422 return DDI_SUCCESS; 361 423 } … … 371 433 * @param Dev Device number 372 434 * @param Cmd Operation identifier 373 * @param ArgArguments from user to driver374 * @param Mode Information bitfield (read/write, address space etc )435 * @param pArg Arguments from user to driver 436 * @param Mode Information bitfield (read/write, address space etc.) 375 437 * @param pCred User credentials 376 438 * @param pVal Return value for calling process. … … 378 440 * @return corresponding solaris error code. 379 441 */ 380 static int VBoxDrvSolarisIoctl(dev_t Dev, int Cmd, intptr_t Arg, int Mode, cred_t* pCred, int* pVal) 381 { 382 cmn_err(CE_CONT, "VBoxDrvSolarisIoctl"); 383 return DDI_SUCCESS; 384 } 385 386 /** 387 * Converts an supdrv error code to a Solaris error code. 388 * 389 * @returns corresponding Solaris error code. 442 static int VBoxDrvSolarisIOCtl (dev_t Dev, int Cmd, intptr_t pArgs, int Mode, cred_t* pCred, int* pVal) 443 { 444 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 445 const RTPROCESS Process = RTProcSelf(); 446 const unsigned iHash = SESSION_HASH(Process); 447 PSUPDRVSESSION pSession; 448 449 cmn_err(CE_CONT, "VBoxDrvSolarisIOCtl\n"); 450 /* 451 * Find the session. 452 */ 453 RTSpinlockAcquireNoInts(g_Spinlock, &Tmp); 454 pSession = g_apSessionHashTab[iHash]; 455 if (pSession && pSession->Process != Process) 456 { 457 do pSession = pSession->pNextHash; 458 while (pSession && pSession->Process != Process); 459 } 460 RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); 461 if (!pSession) 462 { 463 OSDBGPRINT(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x\n", 464 (int)Process, Cmd)); 465 return EINVAL; 466 } 467 468 /* 469 * Deal with the two high-speed IOCtl that takes it's arguments from 470 * the session and iCmd, and only returns a VBox status code. 471 */ 472 #ifdef VBOX_WITHOUT_IDT_PATCHING 473 if ( Cmd == SUP_IOCTL_FAST_DO_RAW_RUN 474 || Cmd == SUP_IOCTL_FAST_DO_HWACC_RUN 475 || Cmd == SUP_IOCTL_FAST_DO_NOP) 476 return supdrvIOCtlFast(Cmd, &g_DevExt, pSession); 477 #endif 478 479 return VBoxDrvSolarisIOCtlSlow(pSession, Cmd, Mode, pArgs); 480 } 481 482 /** 483 * Worker for VBoxSupDrvIOCtl that takes the slow IOCtl functions. 484 * 485 * @returns Solaris errno. 486 * 487 * @param pSession The session. 488 * @param Cmd The IOCtl command. 489 * @param Mode Information bitfield (for specifying ownership of data) 490 * @param pArgs Pointer to the kernel copy of the SUPDRVIOCTLDATA buffer. 491 */ 492 static int VBoxDrvSolarisIOCtlSlow(PSUPDRVSESSION pSession, int Cmd, int Mode, intptr_t pArgs) 493 { 494 int rc; 495 void *pvBuf = NULL; 496 unsigned long cbBuf = 0; 497 unsigned cbOut = 0; 498 PSUPDRVIOCTLDATA pArgData = (PSUPDRVIOCTLDATA)pArgs; 499 500 cmn_err(CE_CONT, "VBoxDrvSolarisIOCtlSlow\n"); 501 /* 502 * Allocate and copy user space input data buffer to kernel space. 503 */ 504 if (pArgData->cbIn > 0 || pArgData->cbOut > 0) 505 { 506 cbBuf = max(pArgData->cbIn, pArgData->cbOut); 507 pvBuf = RTMemTmpAlloc(cbBuf); 508 509 if (pvBuf == NULL) 510 { 511 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: failed to allocate buffer of %d bytes.\n", cbBuf)); 512 return ENOMEM; 513 } 514 515 rc = ddi_copyin(pArgData->pvIn, pvBuf, cbBuf, Mode); 516 517 if (rc != 0) 518 { 519 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: ddi_copyin(%p,%d) failed.\n", pArgData->pvIn, cbBuf)); 520 521 RTMemTmpFree(pvBuf); 522 return EFAULT; 523 } 524 } 525 526 /* 527 * Process the IOCtl. 528 */ 529 rc = supdrvIOCtl(Cmd, &g_DevExt, pSession, pvBuf, pArgData->cbIn, pvBuf, pArgData->cbOut, &cbOut); 530 531 /* 532 * Copy ioctl data and output buffer back to user space. 533 */ 534 if (rc != 0) 535 rc = VBoxSupDrvErr2SolarisErr(rc); 536 else if (cbOut > 0) 537 { 538 if (pvBuf != NULL && cbOut <= cbBuf) 539 { 540 rc = ddi_copyout(pvBuf, pArgData->pvOut, cbOut, Mode); 541 if (rc != 0) 542 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: ddi_copyout(,%p,%d) failed.\n", pArgData->pvOut, cbBuf)); 543 } 544 else 545 { 546 OSDBGPRINT(("WHAT!?! supdrvIOCtl messed up! cbOut=%d cbBuf=%d pvBuf=%p\n", cbOut, cbBuf, pvBuf)); 547 rc = EPERM; 548 } 549 } 550 551 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: returns %d cbOut=%d\n", rc, cbOut)); 552 return rc; 553 } 554 555 556 /** 557 * Converts an supdrv error code to a solaris error code. 558 * 559 * @returns corresponding solaris error code. 390 560 * @param rc supdrv error code (SUPDRV_ERR_* defines). 391 561 */ 392 static int VBox DrvSolarisErr2Native(int rc)562 static int VBoxSupDrvErr2SolarisErr(int rc) 393 563 { 394 564 switch (rc) … … 408 578 return EPERM; 409 579 } 580 581 /** 582 * Initializes any OS specific object creator fields. 583 */ 584 void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession) 585 { 586 NOREF(pObj); 587 NOREF(pSession); 588 } 589 590 591 /** 592 * Checks if the session can access the object. 593 * 594 * @returns true if a decision has been made. 595 * @returns false if the default access policy should be applied. 596 * 597 * @param pObj The object in question. 598 * @param pSession The session wanting to access the object. 599 * @param pszObjName The object name, can be NULL. 600 * @param prc Where to store the result when returning true. 601 */ 602 bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc) 603 { 604 NOREF(pObj); 605 NOREF(pSession); 606 NOREF(pszObjName); 607 NOREF(prc); 608 return false; 609 } 610 611 RTDECL(int) SUPR0Printf(const char *pszFormat, ...) 612 { 613 va_list args; 614 char szMsg[512]; 615 616 va_start(args, pszFormat); 617 vsnprintf(szMsg, sizeof(szMsg) - 1, pszFormat, args); 618 va_end(args); 619 620 szMsg[sizeof(szMsg) - 1] = '\0'; 621 printf("%s", szMsg); 622 return 0; 623 } -
trunk/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp
r4071 r4178 1 /* $Id$ */ 1 2 /** @file 2 3 * … … 37 38 #include <sys/fcntl.h> 38 39 #include <sys/ioctl.h> 40 39 41 #include <fcntl.h> 40 42 #include <errno.h> 41 43 #include <unistd.h> 42 44 #include <stdlib.h> 45 #include <stdio.h> 43 46 44 47 … … 46 49 * Defined Constants And Macros * 47 50 *******************************************************************************/ 48 #define DEVICE_NAME "/dev /vboxdrv"51 #define DEVICE_NAME "/devices/pseudo/vboxdrv@0:0" 49 52 50 53 … … 150 153 151 154 if (ioctl(g_hDevice, uFunction, &Args) >= 0) 152 return 0; 153 /* This is the reverse operation of the one found in SUPDrv-linux.c */ 155 return 0; 156 157 /* This is the reverse operation of the one found in SUPDrv-solaris.c */ 154 158 switch (errno) 155 159 { 156 160 case EACCES: return VERR_GENERAL_FAILURE; 157 161 case EINVAL: return VERR_INVALID_PARAMETER; 158 case ENOSYS: return VERR_INVALID_MAGIC; 162 case EILSEQ: return VERR_INVALID_MAGIC; 163 case ENOSYS: return VERR_VERSION_MISMATCH; 159 164 case ENXIO: return VERR_INVALID_HANDLE; 160 165 case EFAULT: return VERR_INVALID_POINTER; 161 166 case ENOLCK: return VERR_LOCK_FAILED; 162 167 case EEXIST: return VERR_ALREADY_LOADED; 168 case EPERM: return VERR_PERMISSION_DENIED; 163 169 } 164 170 -
trunk/src/VBox/Runtime/Makefile.kmk
r4155 r4178 871 871 generic/RTAssertDoBreakpoint-generic.cpp \ 872 872 generic/RTLogWriteDebugger-generic.cpp \ 873 generic/RTTimerCreate-generic.cpp \ 873 874 RTErrConvertFromErrno.cpp \ 874 875 string/memchr.asm \ … … 880 881 r0drv/solaris/process-r0drv-solaris.c \ 881 882 r0drv/solaris/semevent-r0drv-solaris.c \ 883 r0drv/solaris/semeventmulti-r0drv-solaris.c \ 882 884 r0drv/solaris/semfastmutex-r0drv-solaris.c \ 883 885 r0drv/solaris/spinlock-r0drv-solaris.c \ 884 886 r0drv/solaris/thread-r0drv-solaris.c \ 885 r0drv/solaris/thread2-r0drv-solaris.c 887 r0drv/solaris/thread2-r0drv-solaris.c \ 888 r0drv/solaris/time-r0drv-solaris.c \ 889 generic/timer-generic.cpp 886 890 887 891 ## PORTME: Porters create and add their selection of platform specific Ring-0 Driver files here. -
trunk/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c
r4071 r4178 37 37 PRTMEMHDR pHdr; 38 38 if (fFlags & RTMEMHDR_FLAG_ZEROED) 39 pHdr = (PRTMEMHDR)kmem_zalloc(cb + sizeof(*pHdr), KM_ NOSLEEP);39 pHdr = (PRTMEMHDR)kmem_zalloc(cb + sizeof(*pHdr), KM_SLEEP); 40 40 else 41 pHdr = (PRTMEMHDR)kmem_alloc(cb + sizeof(*pHdr), KM_ NOSLEEP);41 pHdr = (PRTMEMHDR)kmem_alloc(cb + sizeof(*pHdr), KM_SLEEP); 42 42 if (pHdr) 43 43 { … … 74 74 RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb) 75 75 { 76 /* Solaris currently supports allocating contiguous memory 77 * only for DMA drivers which requires passing the driver's 78 * device ID, and upper/lower DMA memory limits 79 * Currently thus disabled since RTMemContAlloc isn't really used 80 * anywhere significant yet (only in GuestAdditions which is not 81 * there for Solaris) 82 * ddi_umem_alloc doesn't allocate contiguous memory! 83 */ 84 /**@todo Implement RTMemContAlloc on Solaris - there is no way around this. */ 76 /** @todo: implement RTMemContAlloc in Solaris */ 77 /* ddi_umem_alloc without PAGEABLE flag might produce contiguous physical memory, but 78 the documentation doesn't talk about contiguous at all :( 79 If we can use ddi_umem_alloc we need to keep track of the ddi_umem_cookie 80 which kernel allocates, but the ContFree() function only passes us back 81 the address. Maybe we could for each ContAlloc build a linked list of 82 structures that have the cookie and corresponding virtual address. */ 85 83 return NULL; 86 84 } -
trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
r4071 r4178 50 50 uint32_t volatile cWaking; 51 51 /** The Solaris mutex protecting this structure and pairing up the with the cv. */ 52 struct mutexMtx;52 kmutex_t Mtx; 53 53 /** The Solaris condition variable. */ 54 54 kcondvar_t Cnd; … … 104 104 { 105 105 mutex_exit(&pEventInt->Mtx); 106 cv_destroy(&pEventInt->Cnd); 106 107 mutex_destroy(&pEventInt->Mtx); 107 cv_destroy(&pEventInt->Cnd);108 108 RTMemFree(pEventInt); 109 109 } … … 166 166 else 167 167 cTicks = 0; 168 cTicks += timeout;168 timeout += cTicks; 169 169 170 170 ASMAtomicIncU32(&pEventInt->cWaiters); … … 178 178 { 179 179 rc = VERR_SEM_DESTROYED; 180 /** @todo r=bird: better make sure you're the last guy out before doing the cleanup.... */ 181 mutex_exit(&pEventInt->Mtx); 182 cv_destroy(&pEventInt->Cnd); 183 mutex_destroy(&pEventInt->Mtx); 184 RTMemFree(pEventInt); 185 return rc; 180 if (!ASMAtomicDecU32(&pEventInt->cWaking)) 181 { 182 mutex_exit(&pEventInt->Mtx); 183 cv_destroy(&pEventInt->Cnd); 184 mutex_destroy(&pEventInt->Mtx); 185 RTMemFree(pEventInt); 186 return rc; 187 } 186 188 } 187 189 -
trunk/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c
r4071 r4178 42 42 uint32_t u32Magic; 43 43 /** The Solaris mutex. */ 44 struct mutexMtx;44 kmutex_t Mtx; 45 45 } RTSEMFASTMUTEXINTERNAL, *PRTSEMFASTMUTEXINTERNAL; 46 46 -
trunk/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
r4071 r4178 41 41 uint32_t volatile u32Magic; 42 42 /** A Solaris spinlock. */ 43 struct mutexMtx;43 kmutex_t Mtx; 44 44 } RTSPINLOCKINTERNAL, *PRTSPINLOCKINTERNAL; 45 45 … … 59 59 */ 60 60 pSpinlockInt->u32Magic = RTSPINLOCK_MAGIC; 61 mutex_init(&pSpinlockInt->Mtx, " iprt-spinlock", MUTEX_SPIN, NULL);61 mutex_init(&pSpinlockInt->Mtx, "IPRT Spinlock", MUTEX_SPIN, NULL); 62 62 *pSpinlock = pSpinlockInt; 63 63 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
r4071 r4178 29 29 #include <sys/sdt.h> 30 30 #include <sys/schedctl.h> 31 #include <sys/time.h> 31 32 32 /* commented for now 33 /* commented for now 33 34 #include <iprt/cdefs.h> 34 35 35 __BEGIN_DECLS 36 extern int nanosleep(const struct timespec *, struct timespec *);37 36 38 37 __END_DECLS -
trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c
r4071 r4178 35 35 { 36 36 int cTicks; 37 37 unsigned long timeout; 38 38 39 if (!cMillies) 39 40 { … … 46 47 else 47 48 cTicks = 0; 48 49 /* hm, maybe we could also use nanosleep() */ 49 #if 0 50 timeout = ddi_get_lbolt(); 51 timeout += cTicks; 52 53 kcondvar_t cnd; 54 kmutex_t mtx; 55 mutex_init(&mtx, "IPRT Sleep Mutex", MUTEX_DRIVER, NULL); 56 cv_init(&cnd, "IPRT Sleep CV", CV_DRIVER, NULL); 57 mutex_enter(&mtx); 58 cv_timedwait (&cnd, &mtx, 9000 * timeout); 59 mutex_exit(&mtx); 60 cv_destroy(&cnd); 61 mutex_destroy(&mtx); 62 #endif 63 64 #if 1 50 65 delay(cTicks); 51 52 /* Hmm, no same effect as using delay() 66 #endif 67 68 #if 0 69 /* Hmm, no same effect as using delay() */ 53 70 struct timespec t; 54 71 t.tv_sec = 0; 55 72 t.tv_nsec = cMillies * 1000000L; 56 73 nanosleep (&t, NULL); 57 */ 74 #endif 75 58 76 return VINF_SUCCESS; 59 77 } -
trunk/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c
r4071 r4178 39 39 40 40 41 /** @todo Solaris native threading, when more info. on priority etc. (namely default prio value) is available */42 41 int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) 43 42 { … … 56 55 } 57 56 58 THREAD_CHANGE_PRI(curthread, iPriority); 57 pri_t threadPrio = iPriority; 58 curthread->t_pri = threadPrio; 59 59 return VINF_SUCCESS; 60 60 } … … 88 88 { 89 89 int rc; 90 /** @todo passing hardcoded priority: 52. Find what default priority to pass*/90 /** @todo Passing hardcoded priority of 52, Find correct default priority */ 91 91 /* We know its from 0 to 127 priority, but what's the default?? */ 92 92 kthread_t* pKernThread = thread_create(NULL, NULL, rtThreadNativeMain, pThreadInt, 0, 93 93 curproc, LMS_USER, 52); 94 if ( rc == 0)94 if (pKernThread) 95 95 { 96 96 *pNativeThread = (RTNATIVETHREAD)pKernThread; -
trunk/src/recompiler/InnoTek/crt/stdio.h
r4071 r4178 39 39 40 40 #if defined(RT_OS_SOLARIS) 41 /** @todo check solaris' floatingpoint.h as to why we do this */41 /** @todo Check solaris' floatingpoint.h as to why we do this */ 42 42 # define _FILEDEFED 43 43 #endif
Note:
See TracChangeset
for help on using the changeset viewer.