mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-02 12:39:50 +08:00
The x86 front end no longer replaces A64 at build time: libkwemu exports the A64 ABI and the x86 one (kw_x64_run, kw_x64_set_isa, kw_x64_isa_supported, kw_x64_complete_entropy, kw_x64_load_segment) on the same struct kw_cpu, and include/kw_emu.h (ABI 5) describes both (struct kw_x64_regs; KW_EV_FPE, KW_EV_GPF and KW_EV_ENTROPY for x86). kw_cpu_init and kw_host_reset set up both. x86 blocks have their own sets in the block cache (blockSetFor: the top set bit flipped), so the blocks of the two ISAs at one pc never share a set and switching between an arm64 and an x86 task needs no flush. The compile-time is_x64 switches in src/emu become comptime hooks of the tier that looks a block up (Blocks.x86): the i386 key strip, the A64 stats hooks, and the shared x86 code-page set, which only x86 decodes mark (A64 keeps IC IVAU); a write-TLB fill reads it only once some x86 code has been marked. zig build test runs the A64 tests as before; zig build test-x64 runs the x86 ones (kwemu-x64-harness*, installed with the x86 guests by install-x64). The object bundles compiler-rt (the x86 front end's 128-bit and x87 arithmetic). Co-authored-by: JeremySu0818 <xinghong.su0818@gmail.com>