OSDev.org
https://forum.osdev.org/

Where did I put the stack pointer of the exe files
https://forum.osdev.org/viewtopic.php?f=1&t=12882
Page 1 of 1

Author:  flash [ Wed Feb 07, 2007 10:20 am ]
Post subject:  Where did I put the stack pointer of the exe files

I'm writing a exe loader to play PE files

I read every sections that the program needs, and put them at the right positions.

But now I have a trouble, I don't know where I can put the stack pointer, the PE file seems to tell you the stack size only.

Author:  XCHG [ Wed Feb 07, 2007 12:05 pm ]
Post subject: 

I don't know if it helps but whenever a new program that I write in Win32 ASM, starts, the ESP register is set to 0x0012FFC4. It can be far from accurate but I just checked it in Win XP and 98 and every time I started the program, the stack pointer was set to that value.

Author:  Combuster [ Wed Feb 07, 2007 3:23 pm ]
Post subject: 

The location of the stack shouldn't matter - just put it somewhere where there's a hole in your virtual memory, and set ESP to point where you allocated the memory.

Author:  iammisc [ Wed Feb 07, 2007 6:54 pm ]
Post subject: 

i have hands-on experience with pe files(http://xpapi.sourceforge.net/) and loading them and you can put it anywhere; it doesn't matter, Just make sure the stack is big enough. Because you are not running Windows files all you have to do is make sure that you're programs that actually manipulate the stack directly(which they really shouldn't do) know where your kernel puts it.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/