function stack frames in the kernel

Carter Cheng cartercheng at gmail.com
Mon Nov 12 11:43:20 EST 2018


Thanks for the clarification.

On Mon, Nov 12, 2018 at 3:09 PM <valdis.kletnieks at vt.edu> wrote:

> On Mon, 12 Nov 2018 02:00:02 +0800, Carter Cheng said:
> > Thanks for the reply but the link doesn't quite answer the question. I am
> > wondering how the pointer is handled so that there is one per thread by
> the
> > compiler. I perhaps was under the perhaps mistaken impression that the
> > stack pointer frame pointer management inside the compiler makes certain
> > assumptions in user space- but i am unsure how this applies to kernel
> space.
>
> For regular function calls, a kernel stack works exactly the same as a
> function
> stack in userspace (remember, it's the same compiler, and other tools like
> the
> linker and gdb need to be able to understand function calls).
>
> Where things are different are what happens if an interrupt or a call to
> schedule() or enter/exit the kernel (or a few other similar situations I
> can't
> remember at 2AM) causes a different thread to start running - for those
> cases,
> there's architecture-dependent shim code (usually involving at least a bit
> of
> assembler) to do the register swapping needed.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181113/9dc7a70c/attachment.html>


More information about the Kernelnewbies mailing list