Re: [PATCH] add sysenter/syscall emulation for 32bit compat mode

Andre Przywara
2009-06-17T07:49:14Z

Amit Shah wrote:
> Hi Andre,
>
> On (Tue) Jun 16 2009 [15:25:13], Andre Przywara wrote:
>> sysenter/sysexit are not supported on AMD's 32bit compat mode, whereas
>> syscall is not supported on Intel's 32bit compat mode. To allow cross
>> vendor migration we emulate the missing instructions by setting up the
>> processor state accordingly.
>> The sysenter code was originally sketched by Amit Shah, it was completed,
>> debugged, syscall added and made-to-work by Christoph Egger and polished
>> up by Andre Przywara.
>> Please note that sysret does not need to be emulated, because it will be
>> exectued in 64bit mode and returning to 32bit compat mode works on Intel.
>
> Thanks for picking this up. You also had a testcase for this, right?
Yes. We started a Linux 64bit guest on an AMD host and migrated it to an
Intel box. On both boxes we ran a test benchmark which is measuring the
time needed for a few million syscalls (GETPID via syscall()), both as a
64bit and a 32bit binary. Then we repeated the test the other way round
(started on Intel, migrated to AMD).
Without the patch the 32bit test was aborted with SIGILL. With the patch
everything went well, excecpt that the execution time was much longer.
Earlier we observed that this shouldn't be much of an issue in real
life, as a tight-loop execution of GETPID is a real corner case.

Regards,
Andre.

--
Andre Przywara
AMD-OSRC (Dresden)
Tel: x29712