- Timestamp:
- Jan 16, 2009 2:05:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r13939 r15992 299 299 #ifdef CONFIG_X86_LOCAL_APIC 300 300 # ifdef DO_DISABLE_NMI 301 302 301 /** Stop AMD NMI watchdog (x86_64 only). */ 303 static int stop_k7_watchdog(void)302 static int StopK7Watchdog(void) 304 303 { 305 304 wrmsr(MSR_K7_EVNTSEL0, 0, 0); … … 308 307 309 308 /** Stop Intel P4 NMI watchdog (x86_64 only). */ 310 static int stop_p4_watchdog(void)309 static int StopP4Watchdog(void) 311 310 { 312 311 wrmsr(MSR_P4_IQ_CCCR0, 0, 0); … … 317 316 318 317 /** The new method of detecting the event counter */ 319 static int stop_intel_arch_watchdog(void)318 static int StopIntelArchWatchdog(void) 320 319 { 321 320 unsigned ebx; … … 328 327 329 328 /** Stop NMI watchdog. */ 330 static void vbox_stop_apic_nmi_watchdog(void *unused)329 static void VBoxStopApicNmiWatchdog(void *unused) 331 330 { 332 331 int stopped = 0; … … 344 343 if (strstr(boot_cpu_data.x86_model_id, "Screwdriver")) 345 344 return; 346 stopped = stop_k7_watchdog();345 stopped = StopK7Watchdog(); 347 346 break; 348 347 case X86_VENDOR_INTEL: 349 348 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 350 349 { 351 stopped = stop_intel_arch_watchdog();350 stopped = StopIntelArchWatchdog(); 352 351 break; 353 352 } 354 stopped = stop_p4_watchdog();353 stopped = StopP4Watchdog(); 355 354 break; 356 355 default: … … 364 363 365 364 /** Disable LAPIC NMI watchdog. */ 366 static void disable_lapic_nmi_watchdog(void)365 static void DisableLapicNmiWatchdog(void) 367 366 { 368 367 BUG_ON(nmi_watchdog != NMI_LOCAL_APIC); … … 371 370 return; 372 371 373 on_each_cpu( vbox_stop_apic_nmi_watchdog, NULL, 1, 1);372 on_each_cpu(VBoxStopApicNmiWatchdog, NULL, 1, 1); 374 373 375 374 BUG_ON(nmi_atomic_read(&nmi_active) != 0); … … 380 379 381 380 /** Shutdown NMI. */ 382 static void nmi_cpu_shutdown(void * dummy)381 static void vboxdrvNmiCpuShutdown(void * dummy) 383 382 { 384 383 unsigned int vERR, vPC; … … 395 394 } 396 395 397 static void nmi_shutdown(void)398 { 399 on_each_cpu( nmi_cpu_shutdown, NULL, 0, 1);396 static void vboxdrvNmiShutdown(void) 397 { 398 on_each_cpu(vboxdrvNmiCpuShutdown, NULL, 0, 1); 400 399 } 401 400 # endif /* DO_DISABLE_NMI */ 402 401 #endif /* CONFIG_X86_LOCAL_APIC */ 403 402 403 404 DECLINLINE(RTUID) vboxdrvLinuxUid(void) 405 { 406 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) 407 return current->cred->uid; 408 #else 409 return current->uid; 410 #endif 411 } 412 413 DECLINLINE(RTGID) vboxdrvLinuxGid(void) 414 { 415 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) 416 return current->cred->gid; 417 #else 418 return current->gid; 419 #endif 420 } 421 422 DECLINLINE(RTUID) vboxdrvLinuxEuid(void) 423 { 424 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) 425 return current->cred->euid; 426 #else 427 return current->euid; 428 #endif 429 } 404 430 405 431 /** … … 436 462 { 437 463 case NMI_LOCAL_APIC: 438 disable_lapic_nmi_watchdog();464 DisableLapicNmiWatchdog(); 439 465 break; 440 466 case NMI_NONE: … … 445 471 if (nmi_atomic_read(&nmi_active) == 0) 446 472 { 447 nmi_shutdown();473 vboxdrvNmiShutdown(); 448 474 printk(KERN_DEBUG DEVICE_NAME ": Successfully done.\n"); 449 475 } … … 704 730 * Only root is allowed to access the device, enforce it! 705 731 */ 706 if ( current->euid != 0 /* root */ )707 { 708 Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", current->euid));732 if (vboxdrvLinuxEuid != 0 /* root */ ) 733 { 734 Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", vboxdrvLinuxEuid)); 709 735 return -EPERM; 710 736 } … … 717 743 if (!rc) 718 744 { 719 pSession->Uid = current->uid;720 pSession->Gid = current->gid;745 pSession->Uid = vboxdrvLinuxUid(); 746 pSession->Gid = vboxdrvLinuxGid(); 721 747 } 722 748 … … 963 989 * Initializes any OS specific object creator fields. 964 990 */ 965 void VBOXCALL 991 void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession) 966 992 { 967 993 NOREF(pObj); … … 981 1007 * @param prc Where to store the result when returning true. 982 1008 */ 983 bool VBOXCALL 1009 bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc) 984 1010 { 985 1011 NOREF(pObj); … … 991 1017 992 1018 993 bool VBOXCALL 1019 bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt) 994 1020 { 995 1021 return force_async_tsc != 0; … … 1003 1029 * @param rc supdrv error code (SUPDRV_ERR_* defines). 1004 1030 */ 1005 static int 1031 static int VBoxDrvLinuxErr2LinuxErr(int rc) 1006 1032 { 1007 1033 switch (rc)
Note:
See TracChangeset
for help on using the changeset viewer.