Stack Problems :(
Posted: Tue Jul 02, 2002 11:00 pm
Hi, i'm trying to set-up my stack but i don't know what to do eactly and i'm fed up with trial and error with my machine resetting every time.
At the moment im declaring an uninitialized variable and then counting how many bytes are after it. Add them together, and move into esp.
so...
stack RESB 10 ; Should be 10 bytes right?
stack_size equ $-stack ; And this will count how many bytes from $-stack up to this point (10 bytes) if i understand the nasm manual correctly.
Then above this code i do in the .text section i write...
mov eax, [stack+stack_size]
mov esp, eax
I keep changing it around a little, and looked inside the intel manuals but they don't tell me much about stacks.
Can anyone please help my create my stack?
Oh, and ss has the orginal segment register value that was given to my os when grub booted it.
At the moment im declaring an uninitialized variable and then counting how many bytes are after it. Add them together, and move into esp.
so...
stack RESB 10 ; Should be 10 bytes right?
stack_size equ $-stack ; And this will count how many bytes from $-stack up to this point (10 bytes) if i understand the nasm manual correctly.
Then above this code i do in the .text section i write...
mov eax, [stack+stack_size]
mov esp, eax
I keep changing it around a little, and looked inside the intel manuals but they don't tell me much about stacks.
Can anyone please help my create my stack?
Oh, and ss has the orginal segment register value that was given to my os when grub booted it.