|
@@ -278,7 +278,7 @@ cleanup:
|
|
*
|
|
*
|
|
* This routine is called normally during driver unloading or exiting.
|
|
* This routine is called normally during driver unloading or exiting.
|
|
*/
|
|
*/
|
|
-void hv_cleanup(void)
|
|
|
|
|
|
+void hv_cleanup(bool crash)
|
|
{
|
|
{
|
|
union hv_x64_msr_hypercall_contents hypercall_msr;
|
|
union hv_x64_msr_hypercall_contents hypercall_msr;
|
|
|
|
|
|
@@ -288,7 +288,8 @@ void hv_cleanup(void)
|
|
if (hv_context.hypercall_page) {
|
|
if (hv_context.hypercall_page) {
|
|
hypercall_msr.as_uint64 = 0;
|
|
hypercall_msr.as_uint64 = 0;
|
|
wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
|
|
wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
|
|
- vfree(hv_context.hypercall_page);
|
|
|
|
|
|
+ if (!crash)
|
|
|
|
+ vfree(hv_context.hypercall_page);
|
|
hv_context.hypercall_page = NULL;
|
|
hv_context.hypercall_page = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -308,7 +309,8 @@ void hv_cleanup(void)
|
|
|
|
|
|
hypercall_msr.as_uint64 = 0;
|
|
hypercall_msr.as_uint64 = 0;
|
|
wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
|
|
wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
|
|
- vfree(hv_context.tsc_page);
|
|
|
|
|
|
+ if (!crash)
|
|
|
|
+ vfree(hv_context.tsc_page);
|
|
hv_context.tsc_page = NULL;
|
|
hv_context.tsc_page = NULL;
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|