mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-02 03:39:26 +08:00
The kernel runs x86-64 ELF programs as their own tasks on kwemu's x86 front end (CONFIG_WASM_X86, on in kw_defconfig): exec picks the ISA from e_machine, and an x86 task gets x86-64's syscall table (through the same pt_regs wrappers, with translations where its ABI differs from arm64's: open flags, struct stat, clone's argument order, packed epoll events, uname, arch_prctl, MAP_32BIT, strict seccomp), signal frames, ptrace regsets and core notes, a vDSO, the vsyscall page, AT_PLATFORM, AT_HWCAP and /proc/cpuinfo in x86's format; kw.x86isa= masks its features. arm64 tasks are unchanged. The kernel patches are "wasm: run x86-64 user space beside arm64" after the arch patch and three generic ones (erofs without vmap on a flat vmalloc, eventpoll's packed events, seccomp's strict syscalls per task); the separate x86-only series (kernel/patches/linux-x64, KW_ARCH=x64) is gone, and so is the build switch. base-test.cpio has x86-64 builds of kwtest and abitest beside arm64's (kwtest-x86_64, abitest-x86_64; abitest_x64 finds itself under that name and checks the i386 cross exec only where there is an i386 build), and test/x64-kernel-audit.mjs runs them on the one kernel. i386 tasks are not there yet (no CONFIG_COMPAT). The distro images still register x86_64 with binfmt_misc (box64, qemu-x86_64), which comes before the kernel's ELF loader. Co-authored-by: JeremySu0818 <xinghong.su0818@gmail.com>