diff --git a/repos/base-foc/ports/foc.hash b/repos/base-foc/ports/foc.hash index 271498149..267df27b2 100644 --- a/repos/base-foc/ports/foc.hash +++ b/repos/base-foc/ports/foc.hash @@ -1 +1 @@ -9db0c4985349d47251e91e4e61145526668278fc +23f5b19a4853073d9cde790709f5e8d9a6c401d7 diff --git a/repos/base-foc/ports/foc.port b/repos/base-foc/ports/foc.port index 5066bb426..98e936afb 100644 --- a/repos/base-foc/ports/foc.port +++ b/repos/base-foc/ports/foc.port @@ -2,5 +2,5 @@ LICENSE := GPLv2 VERSION := git DOWNLOADS := foc.git URL(foc) := https://github.com/alex-ab/foc.git -REV(foc) := a8411389dffc3c55dc5809d2e849b3afac94ee5d +REV(foc) := 45bf2c699552d1e2891d322bea479d95f8c93d02 DIR(foc) := src/kernel/foc diff --git a/repos/base-foc/src/lib/base/x86/vm_session.cc b/repos/base-foc/src/lib/base/x86/vm_session.cc index 1ec2f839e..40da74426 100644 --- a/repos/base-foc/src/lib/base/x86/vm_session.cc +++ b/repos/base-foc/src/lib/base/x86/vm_session.cc @@ -173,13 +173,13 @@ struct Vcpu : Genode::Thread CR0_PG = 0 /* 1U << 31 - not needed in case of UG */ }; - addr_t const _cr0_mask { CR0_CP | CR0_NM | CR0_NE | CR0_CD }; + addr_t const _cr0_mask { CR0_NM | CR0_CD }; addr_t const vmcb_ctrl0 { CTRL0_IO | CTRL0_MSR }; addr_t const vmcb_ctrl1 { 0 }; addr_t vmcb_cr0_shadow { 0 }; addr_t vmcb_cr4_shadow { 0 }; - addr_t const vmcb_cr0_mask { _cr0_mask | CR0_TS }; + addr_t const vmcb_cr0_mask { _cr0_mask }; addr_t const vmcb_cr0_set { 0 }; addr_t const vmcb_cr4_mask { 0 }; addr_t const vmcb_cr4_set { 0 }; @@ -187,7 +187,7 @@ struct Vcpu : Genode::Thread enum { EXIT_ON_HLT = 1U << 7 }; addr_t const _vmcs_ctrl0 { EXIT_ON_HLT }; - addr_t const vmcs_cr0_mask { _cr0_mask | CR0_PE | CR0_PG }; + addr_t const vmcs_cr0_mask { _cr0_mask | CR0_CP | CR0_NE | CR0_PE | CR0_PG }; addr_t const vmcs_cr0_set { 0 }; addr_t const vmcs_cr4_mask { CR4_VMX }; @@ -273,14 +273,17 @@ struct Vcpu : Genode::Thread state.efer.value(state.efer.value() | AMD_SVM_ENABLE); } if (_vm_type == Virt::SVM) { + vmcb->control_area.intercept_instruction0 = vmcb_ctrl0; + vmcb->control_area.intercept_instruction1 = vmcb_ctrl1; + /* special handling on missing NPT support */ vmcb->control_area.np_enable = svm_np(); - if (!vmcb->control_area.np_enable) + if (!vmcb->control_area.np_enable) { vmcb->control_area.intercept_exceptions |= 1 << 14; - - vmcb->control_area.intercept_instruction0 = vmcb_ctrl0; - vmcb->control_area.intercept_rd_crX = 0x0001; /* cr0 */ - vmcb->control_area.intercept_wr_crX = 0x0001; /* cr0 */ + vmcb->control_area.intercept_rd_crX = 0x0001; /* cr0 */ + vmcb->control_area.intercept_wr_crX = 0x0001; /* cr0 */ + } else + vmcb->state_save_area.g_pat = 0x7040600070406ull; } if (_vm_type == Virt::VMX) { Fiasco::l4_vm_vmx_write(vmcs, Vmcs::CR0_MASK, vmcs_cr0_mask);