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 9e49f1f4f2..769c12866d 100644 --- a/repos/base-foc/src/lib/base/x86/vm_session.cc +++ b/repos/base-foc/src/lib/base/x86/vm_session.cc @@ -152,6 +152,7 @@ struct Vcpu : Thread MSR_FMASK = 0x2842, MSR_LSTAR = 0x2844, + MSR_CSTAR = 0x2846, MSR_STAR = 0x284a, KERNEL_GS_BASE = 0x284c, @@ -614,6 +615,7 @@ struct Vcpu : Thread state.star.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_STAR)); state.lstar.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_LSTAR)); + state.cstar.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_CSTAR)); state.fmask.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_FMASK)); state.kernel_gs_base.value(l4_vm_vmx_read(vmcs, Vmcs::KERNEL_GS_BASE)); @@ -756,7 +758,7 @@ struct Vcpu : Thread error("pdpte not implemented"); } - if (state.star.valid() || state.lstar.valid() || + if (state.star.valid() || state.lstar.valid() || state.cstar.valid() || state.fmask.valid() || state.kernel_gs_base.valid()) { error("star, fstar, fmask, kernel_gs_base not implemented"); @@ -813,6 +815,9 @@ struct Vcpu : Thread if (state.lstar.valid()) l4_vm_vmx_write(vmcs, Vmcs::MSR_LSTAR, state.lstar.value()); + if (state.cstar.valid()) + l4_vm_vmx_write(vmcs, Vmcs::MSR_CSTAR, state.cstar.value()); + if (state.fmask.valid()) l4_vm_vmx_write(vmcs, Vmcs::MSR_FMASK, state.fmask.value()); @@ -1032,7 +1037,7 @@ struct Vcpu : Thread vmcb->control_area.tsc_offset = _tsc_offset; } - if (state.star.value() || state.lstar.value() || + if (state.star.value() || state.lstar.value() || state.cstar.value() || state.fmask.value() || state.kernel_gs_base.value()) error(__LINE__, " not implemented"); diff --git a/repos/base-nova/include/nova/syscall-generic.h b/repos/base-nova/include/nova/syscall-generic.h index 802c12d090..ac0ea8b8cd 100644 --- a/repos/base-nova/include/nova/syscall-generic.h +++ b/repos/base-nova/include/nova/syscall-generic.h @@ -566,6 +566,7 @@ namespace Nova { mword_t cr8, efer; unsigned long long star; unsigned long long lstar; + unsigned long long cstar; unsigned long long fmask; unsigned long long kernel_gs_base; unsigned tpr; @@ -625,6 +626,8 @@ namespace Nova { inline void write_star(mword_t value) { star = value; } inline mword_t read_lstar() { return lstar; } inline void write_lstar(mword_t value) { lstar = value; } + inline mword_t read_cstar() { return cstar; } + inline void write_cstar(mword_t value) { cstar = value; } inline mword_t read_fmask() { return fmask; } inline void write_fmask(mword_t value) { fmask = value; } inline mword_t read_kernel_gs_base() { return kernel_gs_base; } @@ -656,6 +659,8 @@ namespace Nova { inline void write_star(mword_t) { } inline mword_t read_lstar() { return 0UL; } inline void write_lstar(mword_t) { } + inline mword_t read_cstar() { return 0UL; } + inline void write_cstar(mword_t) { } inline mword_t read_fmask() { return 0UL; } inline void write_fmask(mword_t) { } inline mword_t read_kernel_gs_base() { return 0UL; } diff --git a/repos/base-nova/ports/nova.hash b/repos/base-nova/ports/nova.hash index e3069ac1e2..fce983590c 100644 --- a/repos/base-nova/ports/nova.hash +++ b/repos/base-nova/ports/nova.hash @@ -1 +1 @@ -e0a4960688b5e6aac8f77998dda98e891e19441c +c9523ea8553360b7d9732280817bb2ba1ef701de diff --git a/repos/base-nova/ports/nova.port b/repos/base-nova/ports/nova.port index b49e372139..5e2500dd6a 100644 --- a/repos/base-nova/ports/nova.port +++ b/repos/base-nova/ports/nova.port @@ -4,7 +4,7 @@ DOWNLOADS := nova.git # r10 branch URL(nova) := https://github.com/alex-ab/NOVA.git -REV(nova) := af931a15fc6b032615f076e946b6026a31dbacaf +REV(nova) := 7f9d73e3266c7cb7418c18fb37bb97e3c6b2442d DIR(nova) := src/kernel/nova PATCHES := $(sort $(wildcard $(REP_DIR)/patches/*.patch)) diff --git a/repos/base-nova/src/lib/base/vm_session.cc b/repos/base-nova/src/lib/base/vm_session.cc index 20fd4c2073..d9031d175f 100644 --- a/repos/base-nova/src/lib/base/vm_session.cc +++ b/repos/base-nova/src/lib/base/vm_session.cc @@ -191,6 +191,7 @@ struct Vcpu { if (utcb.mtd & Nova::Mtd::SYSCALL_SWAPGS) { state.star.value(utcb.read_star()); state.lstar.value(utcb.read_lstar()); + state.cstar.value(utcb.read_cstar()); state.fmask.value(utcb.read_fmask()); state.kernel_gs_base.value(utcb.read_kernel_gs_base()); } @@ -384,11 +385,13 @@ struct Vcpu { } if (state.star.valid() || state.lstar.valid() || - state.fmask.valid() || state.kernel_gs_base.valid()) { + state.cstar.valid() || state.fmask.valid() || + state.kernel_gs_base.valid()) { utcb.mtd |= Nova::Mtd::SYSCALL_SWAPGS; utcb.write_star(state.star.value()); utcb.write_lstar(state.lstar.value()); + utcb.write_cstar(state.cstar.value()); utcb.write_fmask(state.fmask.value()); utcb.write_kernel_gs_base(state.kernel_gs_base.value()); } @@ -671,7 +674,8 @@ struct Vcpu { mtd |= Nova::Mtd::PDPTE; if (state.star.valid() || state.lstar.valid() || - state.fmask.valid() || state.kernel_gs_base.valid()) + state.cstar.valid() || state.fmask.valid() || + state.kernel_gs_base.valid()) mtd |= Nova::Mtd::SYSCALL_SWAPGS; if (state.tpr.valid() || state.tpr_threshold.valid()) diff --git a/repos/base-sel4/src/lib/base/x86/vm_session.cc b/repos/base-sel4/src/lib/base/x86/vm_session.cc index 1ec704145a..2a1f8ca265 100644 --- a/repos/base-sel4/src/lib/base/x86/vm_session.cc +++ b/repos/base-sel4/src/lib/base/x86/vm_session.cc @@ -374,12 +374,12 @@ struct Vcpu : Genode::Thread #endif } - if (state.star.valid() || state.lstar.valid() || + if (state.star.valid() || state.lstar.valid() || state.cstar.valid() || state.fmask.valid() || state.kernel_gs_base.valid()) { if (_show_error_unsupported_star) { _show_error_unsupported_star = false; - Genode::error("star, lstar, fmask, gs_base not supported by seL4"); + Genode::error("star, lstar, cstar, fmask, gs_base not supported by seL4"); } } @@ -704,7 +704,7 @@ struct Vcpu : Genode::Thread state.efer.value(_read_vmcs(service, Vmcs::EFER)); - /* XXX star, lstar, fmask, kernel_gs_base not supported by seL4 */ + /* XXX star, lstar, cstar, fmask, kernel_gs_base not supported by seL4 */ /* XXX tpr and tpr_threshold not supported by seL4 */ } diff --git a/repos/base/include/spec/x86/cpu/vm_state.h b/repos/base/include/spec/x86/cpu/vm_state.h index 291120ad4b..67c7029905 100644 --- a/repos/base/include/spec/x86/cpu/vm_state.h +++ b/repos/base/include/spec/x86/cpu/vm_state.h @@ -134,6 +134,7 @@ struct Genode::Vm_state Register star; Register lstar; + Register cstar; Register fmask; Register kernel_gs_base; diff --git a/repos/ports/ports/seoul.hash b/repos/ports/ports/seoul.hash index bc2a02cc44..d6a3fd120a 100644 --- a/repos/ports/ports/seoul.hash +++ b/repos/ports/ports/seoul.hash @@ -1 +1 @@ -e8d6968e967852affc6a7290936466f032dc210b +e4c5e41a5d3b5398a310dbc39b52a5393526c816 diff --git a/repos/ports/ports/seoul.port b/repos/ports/ports/seoul.port index df1daca58f..945118f92c 100644 --- a/repos/ports/ports/seoul.port +++ b/repos/ports/ports/seoul.port @@ -3,8 +3,8 @@ VERSION := git DOWNLOADS := seoul.git URL(seoul) := https://github.com/alex-ab/seoul.git -# branch genode_20_02 -REV(seoul) := bcbb781d9412fe8c10d6e324e02116faf04b8d1f +# branch genode_20_11 +REV(seoul) := 9c009e7ad2b5ec9fbafdc731e8796f33ff90e921 DIR(seoul) := src/app/seoul # diff --git a/repos/ports/src/app/seoul/state.cc b/repos/ports/src/app/seoul/state.cc index 17d4523aac..d06d856557 100644 --- a/repos/ports/src/app/seoul/state.cc +++ b/repos/ports/src/app/seoul/state.cc @@ -373,10 +373,10 @@ unsigned Seoul::read_vm_state(Genode::Vm_state &state, CpuState &seoul) Genode::warning("pdpte not supported by Seoul"); } - if (state.star.valid() || state.lstar.valid() || + if (state.star.valid() || state.lstar.valid() || state.cstar.valid() || state.fmask.valid() || state.kernel_gs_base.valid()) { - Genode::warning("star, lstar, fmask, kernel_gs not supported by Seoul"); + Genode::warning("star, lstar, cstar, fmask, kernel_gs not supported by Seoul"); } if (state.tpr.valid() || state.tpr_threshold.valid()) { diff --git a/repos/ports/src/virtualbox5/spec/nova/vcpu.h b/repos/ports/src/virtualbox5/spec/nova/vcpu.h index e375e25425..e0951430e4 100644 --- a/repos/ports/src/virtualbox5/spec/nova/vcpu.h +++ b/repos/ports/src/virtualbox5/spec/nova/vcpu.h @@ -517,6 +517,7 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher, utcb->mtd |= Mtd::SYSCALL_SWAPGS; utcb->write_star(pCtx->msrSTAR); utcb->write_lstar(pCtx->msrLSTAR); + utcb->write_cstar(pCtx->msrCSTAR); utcb->write_fmask(pCtx->msrSFMASK); utcb->write_kernel_gs_base(pCtx->msrKERNELGSBASE); @@ -604,6 +605,9 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher, if (pCtx->msrLSTAR != utcb->read_lstar()) CPUMSetGuestMsr(pVCpu, MSR_K8_LSTAR, utcb->read_lstar()); + if (pCtx->msrCSTAR != utcb->read_cstar()) + CPUMSetGuestMsr(pVCpu, MSR_K8_CSTAR, utcb->read_cstar()); + if (pCtx->msrSFMASK != utcb->read_fmask()) CPUMSetGuestMsr(pVCpu, MSR_K8_SF_MASK, utcb->read_fmask()); diff --git a/repos/ports/src/virtualbox5/vcpu.h b/repos/ports/src/virtualbox5/vcpu.h index 707774c271..e2d3d05b14 100644 --- a/repos/ports/src/virtualbox5/vcpu.h +++ b/repos/ports/src/virtualbox5/vcpu.h @@ -345,6 +345,7 @@ class Vcpu_handler : public Genode::List::Element _state->star.value(pCtx->msrSTAR); _state->lstar.value(pCtx->msrLSTAR); + _state->cstar.value(pCtx->msrCSTAR); _state->fmask.value(pCtx->msrSFMASK); _state->kernel_gs_base.value(pCtx->msrKERNELGSBASE); @@ -437,6 +438,9 @@ class Vcpu_handler : public Genode::List::Element if (pCtx->msrLSTAR != _state->lstar.value()) CPUMSetGuestMsr(pVCpu, MSR_K8_LSTAR, _state->lstar.value()); + if (pCtx->msrCSTAR != _state->cstar.value()) + CPUMSetGuestMsr(pVCpu, MSR_K8_CSTAR, _state->cstar.value()); + if (pCtx->msrSFMASK != _state->fmask.value()) CPUMSetGuestMsr(pVCpu, MSR_K8_SF_MASK, _state->fmask.value());