AArch64 EL2 hypervisor for QEMU virt that boots at EL2
1

Configure Feed

Select the types of activity you want to include in your feed.

Harden EL1 context serialisation across vCPU exits

+35
+2
core/selftest.c
··· 8 8 #include "hv/selftest.h" 9 9 #include "hv/stage2.h" 10 10 #include "hv/sysreg.h" 11 + #include "hv/vcpu.h" 11 12 12 13 static void require(bool ok, const char *name) 13 14 { ··· 26 27 "selftest guest memory bounds"); 27 28 require(policy_selftest(), "selftest policy table"); 28 29 require(sysreg_selftest(), "selftest sysreg decoder"); 30 + require(vcpu_frame_selftest(), "selftest vcpu frame serialisation"); 29 31 require(log_selftest(), "selftest log wraparound"); 30 32 require(allocator_selftest(), "selftest allocator"); 31 33
+32
core/vcpu.c
··· 147 147 } 148 148 uart_puts("\n"); 149 149 } 150 + 151 + bool vcpu_frame_selftest(void) 152 + { 153 + struct trap_frame frame; 154 + struct trap_frame out; 155 + struct vcpu vcpu; 156 + 157 + hv_memset(&frame, 0, sizeof(frame)); 158 + hv_memset(&out, 0, sizeof(out)); 159 + hv_memset(&vcpu, 0, sizeof(vcpu)); 160 + for (uint32_t i = 0; i < 31u; i++) { 161 + frame.x[i] = 0x1000u + i; 162 + } 163 + frame.sp_el0 = 0x2000u; 164 + frame.sp_el1 = 0x3000u; 165 + frame.elr_el2 = 0x4000u; 166 + frame.spsr_el2 = 0x3c5u; 167 + frame.esr_el2 = 0x96000000u; 168 + frame.far_el2 = 0x5000u; 169 + frame.hpfar_el2 = 0x6000u; 170 + 171 + vcpu_load_frame(&vcpu, &frame); 172 + vcpu_store_frame(&vcpu, &out); 173 + return hv_memcmp(frame.x, out.x, sizeof(frame.x)) == 0 && 174 + frame.sp_el0 == out.sp_el0 && 175 + frame.sp_el1 == out.sp_el1 && 176 + frame.elr_el2 == out.elr_el2 && 177 + frame.spsr_el2 == out.spsr_el2 && 178 + vcpu.last_esr == frame.esr_el2 && 179 + vcpu.last_far == frame.far_el2 && 180 + vcpu.last_hpfar == frame.hpfar_el2; 181 + }
+1
include/hv/vcpu.h
··· 86 86 struct vcpu *vcpu_current(void); 87 87 void vcpu_set_current(struct vcpu *vcpu); 88 88 void vcpu_dump(const struct vcpu *vcpu); 89 + bool vcpu_frame_selftest(void); 89 90 90 91 #endif