Re: Differences between FreeBSD and Linux system call mechanism

H. Peter Anvin (hpa@transmeta.com)
4 Sep 1998 01:35:34 GMT


Followup to: <199809032355.TAA27962@hilfy.ece.cmu.edu>
By author: "Brandon S. Allbery KF8NH" <allbery@kf8nh.apk.net>
In newsgroup: linux.dev.kernel
>
> Amazing how Intel has so many ways to handle entry to privileged "contexts"
> that people easily get confused... yet all of them seem to lose in one
> fashion or another. Makes me wonder who they ripped the new "sysenter" off
> from. :-) (And how *it* will manage to lose, aside from the nonexistent
> backward compatibility.)
>

It loses because it throws away %eip and %esp, requiring those values
to be saved in user space, and giving you no indication where you came
from. Oh yes, and it loses because it works from V86 mode, with no
way to tell you were coming from V86 mode and hence shouldn't execute
arbitrary system calls. The only way around that is to zero the
SYSENTER MSR *in the scheduler*, slowing down a common path because
you can't put a needed test in an uncommon path.

(Actually, there is a better alternative: the vm86() system call
should set a flag in the process structure, and the signal handlers
should clear it; if you get a SYSENTER with the flag set you know you
were in V86 mode. Note that since %cs, %ss, %eip and %esp are
irrecoverably lost, all you can do is shut the V86 process down, or
emulate an 8086 reset.)

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html