views:

18

answers:

1

When is it decided where the stack, global, and frame pointers are in memory? I'm trying to load an ELF executable into a simulator and I can't figure out what instructions load the global, stack and frame pointers into the regfile.

A: 

It depends on the architecture, but generally the kernel sets up the initial stack and frame pointers before any user-space instructions execute, and the global pointer (if any) is established by the dynamic linker. The "initial process state" section of your architecture's ABI supplement will explain a lot of this stuff, but for the rest you will probably need to read the source code for your dynamic linker.

If your simulator is user-space only it has to do the kernel's job.

Zack