- Timestamp:
- Mar 24, 2009 11:01:41 AM (16 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGuest
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.cpp
r18022 r18170 1 1 /** @file 2 *3 2 * VBoxGuest -- VirtualBox Win32 guest support driver 4 * 3 */ 4 5 /* 5 6 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 6 7 * … … 27 28 28 29 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 29 #ifndef TARGET_NT430 #include <aux_klib.h>31 #endif30 # ifndef TARGET_NT4 31 # include <aux_klib.h> 32 # endif 32 33 #endif 33 34 … … 254 255 255 256 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 256 NTSTATUS hlpRegisterBugCheckCallback (PVBOXGUESTDEVEXT pDevExt) 257 { 258 int rc = STATUS_SUCCESS; 259 260 #ifndef TARGET_NT4 257 /** 258 * Called when a bug check occurs. 259 * 260 * @param pvBuffer Pointer to our device extension, just in case it 261 * comes in handy some day. 262 * @param cbBuffer The size of our device extension. 263 */ 264 static VOID hlpVBoxGuestBugCheckCallback(PVOID pvBuffer, ULONG cbBuffer) 265 { 266 /*PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvBuffer;*/ 267 268 LogRelBackdoor(("Windows bug check (bluescreen) detected!\n")); 269 270 # ifndef TARGET_NT4 271 /* 272 * Try get details. 273 */ 274 KBUGCHECK_DATA bugCheckData; 275 bugCheckData.BugCheckDataSize = sizeof(KBUGCHECK_DATA); 276 NTSTATUS rc = AuxKlibGetBugCheckData(&bugCheckData); 277 if (NT_SUCCESS(rc)) 278 { 279 LogRelBackdoor(("Bug check code: 0x%08x\n", bugCheckData.BugCheckCode)); 280 LogRelBackdoor(("Bug check parameters: 1=0x%p 2=0x%p 3=0x%p 4=0x%p\n", 281 bugCheckData.Parameter1, 282 bugCheckData.Parameter2, 283 bugCheckData.Parameter3, 284 bugCheckData.Parameter4)); 285 LogRelBackdoor(("For details run \"!analyze -show %x %p %p %p %p\" in WinDbg.\n", 286 bugCheckData.BugCheckCode, 287 bugCheckData.Parameter1, 288 bugCheckData.Parameter2, 289 bugCheckData.Parameter3, 290 bugCheckData.Parameter4)); 291 } 292 else 293 LogRelBackdoor(("Unable to retrieve bugcheck details! Error: %#x\n", rc)); 294 # else /* NT4 */ 295 LogRelBackdoor(("No additional information for Windows NT 4.0 bugcheck available.\n")); 296 # endif /* NT4 */ 297 298 /* 299 * Notify the host that we've panicked. 300 */ 301 /** @todo Notify the host somehow over DevVMM. */ 302 303 NOREF(pvBuffer); NOREF(cbBuffer); 304 } 305 306 NTSTATUS hlpRegisterBugCheckCallback(PVBOXGUESTDEVEXT pDevExt) 307 { 308 NTSTATUS rc = STATUS_SUCCESS; 309 pDevExt->bBugcheckCallbackRegistered = FALSE; 310 311 # ifndef TARGET_NT4 312 /* 313 * This is required for calling AuxKlibGetBugCheckData() in hlpVBoxGuestBugCheckCallback(). 314 */ 261 315 rc = AuxKlibInitialize(); 262 316 if (NT_ERROR(rc)) 263 317 { 264 dprintf(("VBoxGuest::hlpRegisterBugCheckCallback: Unabled to initialize AuxKlib! \n"));318 dprintf(("VBoxGuest::hlpRegisterBugCheckCallback: Unabled to initialize AuxKlib! rc=%#x\n", rc)); 265 319 return STATUS_DRIVER_UNABLE_TO_LOAD; 266 320 } 267 #endif321 # endif 268 322 269 323 /* 270 * Setup bugcheck callback routine ASAP.324 * Setup bugcheck callback routine. 271 325 */ 272 326 pDevExt->bBugcheckCallbackRegistered = FALSE; 273 pDevExt->bugcheckContext = (VBOXBUGCHECKCONTEXT*)ExAllocatePool(NonPagedPool, sizeof(VBOXBUGCHECKCONTEXT)); 274 if(!pDevExt->bugcheckContext) 275 { 276 dprintf(("VBoxGuest::hlpRegisterBugCheckCallback: Not enough memory for bugcheck context!\n")); 277 return STATUS_INSUFFICIENT_RESOURCES; 278 } 279 280 KeInitializeCallbackRecord(&pDevExt->bugcheckContext->bugcheckRecord); 281 if (FALSE == KeRegisterBugCheckCallback(&pDevExt->bugcheckContext->bugcheckRecord, 282 &hlpVBoxGuestBugCheckCallback, 283 pDevExt->bugcheckContext, 284 sizeof(VBOXBUGCHECKCONTEXT), 285 (PUCHAR)"VBoxGuest")) 286 { 287 LogRelBackdoor(("Could not register bugcheck callback routine!\n")); 288 } 289 else 327 KeInitializeCallbackRecord(&pDevExt->bugcheckRecord); 328 if (KeRegisterBugCheckCallback(&pDevExt->bugcheckRecord, 329 &hlpVBoxGuestBugCheckCallback, 330 pDevExt, 331 sizeof(*pDevExt), 332 (PUCHAR)"VBoxGuest")) 290 333 { 291 334 pDevExt->bBugcheckCallbackRegistered = TRUE; 292 335 dprintf(("VBoxGuest::hlpRegisterBugCheckCallback: Bugcheck callback registered.\n")); 293 336 } 337 else 338 LogRelBackdoor(("Could not register bugcheck callback routine!\n")); 294 339 295 340 return rc; 296 341 } 297 342 298 VOID hlpVBoxGuestBugCheckCallback(PVOID pvBuffer, ULONG ulLength) 299 { 300 NTSTATUS rc = 0; 301 PVBOXBUGCHECKCONTEXT pContext = (PVBOXBUGCHECKCONTEXT)pvBuffer; 302 303 LogRelBackdoor(("Windows bugcheck (bluescreen) detected!\n")); 304 305 #ifndef TARGET_NT4 306 KBUGCHECK_DATA bugcheckData; 307 bugcheckData.BugCheckDataSize = sizeof(KBUGCHECK_DATA); 308 rc = AuxKlibGetBugCheckData(&bugcheckData); 309 if (!RT_SUCCESS(rc)) 310 { 311 LogRelBackdoor(("Unable to retrieve bugcheck details! Error: %d\n", rc)); 312 return; 313 } 314 315 LogRelBackdoor(("Bugcheck code: 0x%08x\n", bugcheckData.BugCheckCode)); 316 LogRelBackdoor(("Bugcheck parameters: 1=%ld 2=%ld 3=%ld 4=%ld\n", 317 bugcheckData.Parameter1, 318 bugcheckData.Parameter2, 319 bugcheckData.Parameter3, 320 bugcheckData.Parameter4)); 321 #else 322 LogRelBackdoor(("No additional information for Windows NT 4.0 bugcheck available.\n")); 343 void hlpDeregisterBugCheckCallback(PVBOXGUESTDEVEXT pDevExt) 344 { 345 if (pDevExt->bBugcheckCallbackRegistered) 346 { 347 if (!KeDeregisterBugCheckCallback(&pDevExt->bugcheckRecord)) 348 dprintf(("VBoxGuest::VBoxGuestUnload: Unregistering bugcheck callback routine failed!\n")); 349 pDevExt->bBugcheckCallbackRegistered = FALSE; 350 } 351 } 323 352 #endif 324 325 if (pvBuffer)326 {327 /* @todo - Not used yet. */328 }329 330 /* @todo Notify the host somehow over DevVMM. */331 }332 #endif -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.h
r18019 r18170 64 64 NTSTATUS hlpRegisterBugCheckCallback (PVBOXGUESTDEVEXT pDevExt); 65 65 66 VOID hlpVBoxGuestBugCheckCallback (PVOID pvBuffer, ULONG ulLength); 66 /** 67 * Helper for deregistering the bugcheck callback rountine(s). 68 * 69 * @param pDevExt VMMDev device extension 70 */ 71 void hlpDeregisterBugCheckCallback (PVBOXGUESTDEVEXT pDevExt); 67 72 #endif 68 73 } -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Makefile.kmk
r18037 r18170 37 37 #VBoxGuest_DEFS += LOG_ENABLED 38 38 VBoxGuest_INCS = \ 39 ../include 39 ../include 40 40 VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8 41 41 VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry … … 52 52 53 53 ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 54 #VBoxGuest_SDKS = WINDDKWLH54 VBoxGuest_SDKS = WINDDKWLH 55 55 VBoxGuest_LIBS = \ 56 56 $(PATH_SDK_WINDDKWLH_LIB)/ksecdd.lib \ -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest.cpp
r18022 r18170 32 32 #include "Helper.h" 33 33 #include <excpt.h> 34 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION35 #ifndef TARGET_NT436 #include <aux_klib.h>37 #endif38 #endif39 34 #include <VBox/err.h> 40 35 #include <VBox/log.h> … … 47 42 48 43 #ifdef TARGET_NT4 49 /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so... 50 * The same for ExAllocatePool. 44 /* 45 * XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist 46 * on NT4, so... The same for ExAllocatePool. 51 47 */ 52 48 #undef ExAllocatePool … … 247 243 248 244 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 249 rc = hlpRegisterBugCheckCallback(pDevExt);245 hlpRegisterBugCheckCallback(pDevExt); /* ignore failure! */ 250 246 #endif 251 247 … … 293 289 294 290 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 295 /* Unregister bugcheck callback. */ 296 if (pDevExt->bugcheckContext) 297 { 298 if (pDevExt->bBugcheckCallbackRegistered) 299 { 300 if (FALSE == KeDeregisterBugCheckCallback(&pDevExt->bugcheckContext->bugcheckRecord)) 301 dprintf(("VBoxGuest::VBoxGuestUnload: Unregistering bugcheck callback routine failed!\n")); 302 } 303 304 ExFreePool(&pDevExt->bugcheckContext); 305 pDevExt->bugcheckContext = NULL; 306 pDevExt->bBugcheckCallbackRegistered = FALSE; 307 } 291 hlpDeregisterBugCheckCallback(pDevExt); /* ignore failure! */ 308 292 #endif 309 293 … … 1713 1697 1714 1698 /* align at 4MB */ 1715 req->hypervisorStart = ( RTGCPTR)RT_ALIGN_P(pDevExt->hypervisorMapping, 0x400000);1699 req->hypervisorStart = (uintptr_t)RT_ALIGN_P(pDevExt->hypervisorMapping, 0x400000); 1716 1700 1717 1701 req->header.requestType = VMMDevReq_SetHypervisorInfo; -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest_Internal.h
r18019 r18170 125 125 } BASE_ADDRESS, *PBASE_ADDRESS; 126 126 127 typedef struct128 {129 KBUGCHECK_CALLBACK_RECORD bugcheckRecord;130 } VBOXBUGCHECKCONTEXT, *PVBOXBUGCHECKCONTEXT;131 127 132 128 /** … … 220 216 VMMDevPowerStateRequest *powerStateRequest; 221 217 222 /* Bugcheck context.*/218 /** Is the bugcheck callback registered? */ 223 219 BOOLEAN bBugcheckCallbackRegistered; 224 PVBOXBUGCHECKCONTEXT bugcheckContext; 220 /** The bugcheck registration record. */ 221 KBUGCHECK_CALLBACK_RECORD bugcheckRecord; 225 222 226 223 } VBOXGUESTDEVEXT, *PVBOXGUESTDEVEXT; … … 246 243 { 247 244 /** Array containing HGCM client IDs associated with this session. 248 * This will be automatically disconnected when the session is closed. 245 * This will be automatically disconnected when the session is closed. 249 246 * Note that array size also affects/is maximum number of supported opengl threads per guest process. 250 247 */
Note:
See TracChangeset
for help on using the changeset viewer.