tta
tta

Reputation: 1

Frame, Stack Frame in process Stacking Unstacking

Stacking process

When I talked about the stacking process I was talking about the frame that it would store the data of CPU registers like PC(Program counter) or LR but the advisor said it wasn't and didn't dig deep.

But when I look up on google, there is no information about the frame only information about the stack frame. So somebody can explain what is frame in this stacking process

Upvotes: 0

Views: 66

Answers (1)

Botje
Botje

Reputation: 31020

My best guess is that your advisor disagrees about a "frame" being a real thing you put on the stack. Formally, a process or thread stack is made up of "activation records", colloquially known as stack frames. At a minimum you need a return address, but the stack is almost always used to transport function arguments as well. However, nothing prevents an architecture from keeping the return addresses and arguments strictly separated.

Historically, modifications to local variables on the stack have caused problems such as stack overflows. To solve this, compilers can inject stack canaries or make use of shadow stacks as a modern security defense.

Finally, a frame pointer can be used to refer to the current and previous frame as a whole. This has the nice property that it never changes within a function, unlike the stack pointer. It also means that both function arguments and local variables are always located at a set distance from the frame pointer. This frame pointer is also very useful for debuggers, who do not have to do complex calculations to figure out where stack variables live.

Upvotes: 0

Related Questions