3 ms·
Hm. Is that code using the user's stack to handle an exception or interrupt? That's unsafe. If there's not enough user stack space (something the user can forc
by Animats 10y ago
Hm. Is that code using the user's stack to handle an exception or interrupt? That's unsafe. If there's not enough user stack space (something the user can force), the kernel will get a double fault, usually a kernel panic condition. Normally, OSs above the DOS level switch to a kernel stack on an exception or interrupt.
There's hardware support to help with this; see "Task state segment" (16 and 32 bit x86 only, amd64 is different).
- monocasa 10y agoHe doesn't have user mode yet AFAICT.
- amluto 10y agoNo. In fact, that hardware support is mandatory. The SP0 field is used unconditionally on a cross-privilege exception. Sadly, AMD64 came up with a terrible design for SYSCALL, and an exception right after SYSCALL will not automatically switch stacks. The result is a big mess.