3 ms·
Hmm. Do any JITs actually emit syscalls directly? I would’ve guessed most JITs won’t even emit direct libc calls directly, since there tends to be layers of abs
by jchw 7y ago
Hmm. Do any JITs actually emit syscalls directly? I would’ve guessed most JITs won’t even emit direct libc calls directly, since there tends to be layers of abstraction between it and the software.
- notaplumber 7y agoIndeed. This appears to be the case for stuff encountered thus far.
- pm215 7y agoQEMU does for its user-mode-only code, but not in JITted code. We have a little shim that directly executes a syscall instruction because we want to be able to wind the PC forward/backward across it to avoid a race condition with a signal arriving after the guest thinks it's made the syscall but before we've made the syscall in the host. But that's currently only done by linux-user; bsd-user should ideally have a similar mechanism but is basically dead/dying for lack of maintainers who care about the BSDs. In any case, that falls under "in the binary's text segment" rather than JIT output. (code at https://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/host/x86_64/safe-syscall.inc.S;h=f36992daa34e0f59c621d506bdda00e281e437be;hb=HEAD https://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/host/x8... )