Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Kernel: distinct stack?

30 views
Skip to first unread message

Collin Fair

unread,
May 11, 2016, 5:21:22 PM5/11/16
to
The explanation given today in class seemed to suggest that the kernel
should have a separate stack, with parameters copied between the kernel
and task stacks as necessary. However, I've seen several RTOSes run
kernel code entirely on the calling task's stack, simplifying syscalls
somewhat. Is there a preferred/required method for our kernel?

Theo Belaire

unread,
May 12, 2016, 11:55:20 AM5/12/16
to
So, if you look at the ARM spec, in particular A2.4.2, you can see that in interrupts, the stack pointer is swapped out for you.
I think it'd actually be pretty hard to re-use the stack, you'd need to save the stack pointer in a different register.

Ben Cassell

unread,
May 12, 2016, 2:11:15 PM5/12/16
to
This is correct. The hardware is set up in such a way that it encourages
using a different stack.

This is probably safer too: You run fewer risks of stomping task stack
data this way.
0 new messages