Re: quick questions: kernel stack size and call gates

From: Brian Gerst (bgerst@didntduck.org)
Date: Tue Oct 17 2000 - 13:27:52 EST


Chris Swiedler wrote:
>
> 1. Does Linux use call gates (as specified in the Intel SDK vol.3) when a
> user process makes a system call? From what I understand, call-gates let a
> ring-3 process execute ring-0 code, which sounds exactly like a system call.
> I've found all of the actual system call functions (sys_ni etc.) in sys.c,
> but where is the code which userland calls to transfer to "kernel mode" and
> execute a particular syscall?

Linux uses an interrupt gate (int $0x80). The code that handles the
entry to kernel mode is in arch/i386/kernel/entry.S

> 2. I've often heard that the kernel stack size is set small (4 or 8k?). Is
> this done by limiting the size of the stack segment itself for the kernel?
> Where is the code which sets up the limit?

The stack segment is a flat segment just like the code and data
segments. The stack size is fixed and is allocated to be two pages (8k
on x86). There is no mechanism in place to enforce the stack boundaries
other than a possible page fault. The task structure is located at the
bottom of the stack space so it would get overwritten before any fault
would occur anyways.

--

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



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:11 EST