- does not generate code bloat if the kernel is compiled for a CPU that cannot have a fast system call

- is 8 cycles faster :-) can certainly still be improved, working on it.

> RESTORING EFLAGS

yep, fixed. We definitely want X to use fast system calls.

> SIGNAL HANDLING> SYSCALL RESTARTING

works just fine here without going into the slow iret path, this was justa matter of generating a stack layout where pregs->eip and pregs->esp ispopped into %ecx and %edx by sysexit. signal handlers do not need fancyregister state, they need a good %esp and %eip, plus they need theirstackframe.

signals generated after interrupts _need_ to restore all registersexactly, but after interrupts we are not in the fastcall path anyway, soiret is used.

> EXEC

yep, exec is such a heavy function that it can be called int $80 justfine.

fortunately most of these are rarely used system calls. The ones we worryabout are mmap() and select(). Fortunately mmap() already has a trampolinein the x86 architecture, thus parameter preparation can be done cheaply(see sys_mmap2_4arg()). The other system-calls have to be trampolinedsimilarly.

this method enables us to support these few system calls without slowingdown the fast-path!

> KERNEL STACK

> (1) it means a SEP capable cpu needs a different switch_to from one> w/o sysenter. I'd like to have sysenter not dependendent on any> compilation flags and this means extra if()s to check for SE> support. (while fixups tricks may work on older cpus i wouldn't> trust clones) If support for other methods emerge it could make> things even more complex.> (2) an MSR write takes at least 80 cycles.

not a problem i believe. fast system calls are an optimization, just likeeg. the 'Good APIC' flag is an optimization, the 'INVLPG' instruction is acompilation-time flag as well - it's perfectly fine to have fast-syscallsupport as a compilation flag i believe. Since it's not a mandatoryinterface, no need to slow down the context-switch path for CPUs whichhave no support for this.

> VM86 MODE

vm86() mode is clearly hard to handle, i believe it's acceptable to linkdosemu against the int $80 library of glibc. It's simply not possible toreturn to a 16-bit CS with sysexit. The VM flag itself can be set though.