Hi everyone,
I've recently started getting back into OSDev, and I'm at a point with my kernel where I can start implementing ELF loading.
There's one thing that's tripping me up, and that's finding out information about the stack with regards to ELF files.
I need to know if it's the kernel's responsibility to allocate a stack to the process and ensure that it's valid and active, or whether a suitable stack is defined within the program headers and the _start function sets this up accordingly.
(I have searched to see if this topic has been posted previously, but didn't find anything. I apologise if it indeed has been asked already!)
Thanks,
NFSGamer
ELF loading and the stack
-
- Posts: 4
- Joined: Sun Mar 18, 2012 9:06 am
- Libera.chat IRC: StereoRocker
- Location: At the computer
- Contact:
Re: ELF loading and the stack
It's a design issue. And that's why it means you have to decide it on your own.NFSGamer wrote:I need to know if it's the kernel's responsibility to allocate a stack to the process and ensure that it's valid and active, or whether a suitable stack is defined within the program headers and the _start function sets this up accordingly.
Generally the kernel manages processes and the management includes process's stack and some data structures. But you can implement a system where some external entity has created the stack and data structures. It's, of course, looks very inefficient, because you lose control over many essential parts of your system. But if you want to create something "new" then why not?
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability
-
- Posts: 4
- Joined: Sun Mar 18, 2012 9:06 am
- Libera.chat IRC: StereoRocker
- Location: At the computer
- Contact:
Re: ELF loading and the stack
I see. I think I'll go with kernel managed stack space then. Though it would be interesting to see the alternative put to use.
Thanks for your help!
Thanks for your help!