[NSWI004] Stack Frame Allocation

Vojtech Horky horky at d3s.mff.cuni.cz
Wed Nov 18 21:14:54 CET 2020


Hello.

Dne 18. 11. 20 v 21:05 Krisztian Bokor napsal(a):
> I would like to ask a quick question that I forgot to ask on the 
> practials today. There are two different definitions regarding the stack 
> frame: ABI_STACK_FRAME and THREAD_STACK_SIZE. When allocating the stack 
> frame in the thread_t structure (in my case using a static array), do we 
> use only the ABI_STACK_FRAME (of course alongside with alignment), or 
> also the THREAD_STACK_SIZE constant? I found no mention of the 
> THREAD_STACK_SIZE in the assignment description so it might be used 
> somewhere else, but I figured I'd better ask.

There is a difference between a stack frame and a stack size. Stack 
frame is a record (information) about a function call (more or less). By 
stack size we mean the whole stack for a thread.

ABI_STACK_FRAME is required by the ABI we use.

THREAD_STACK_SIZE is used in several tests. You may use "git grep 
THREAD_STACK_SIZE" to find them.

I believe that when you look at their actual values, it would become 
clear which one you need to use to allocate stack inside your thread_t.

Hope this helps,
- VH


More information about the NSWI004 mailing list