How can I add a STACK to program writen in C, using GCC-LD to compile it?
Thank you
pepito
C Stack
RE:C Stack
Do you have a stub that calls your c code? If so, you can add assembly code to setup the stack. Basically with the nasm assembler, you would do:
mov esp, stack
stack: resd 1024 ; allocate 1024 bytes for the stack
Then if you use bochs, you can use the bochs debugger to print the contents of the stack for you.
Hope this helps.
mov esp, stack
stack: resd 1024 ; allocate 1024 bytes for the stack
Then if you use bochs, you can use the bochs debugger to print the contents of the stack for you.
Hope this helps.
RE:C Stack
Really, I need a stack for each application written for my OS because the 'task manager' need the ss/esp values to create a process. I need to know where C creates the application's stack.
By now, as you say, I add an ASM file with the line 'times 4096 db 0' at the end of the application, but maybe exist another stack into the C program compiled with GCC.
Thank you for your response,
pepito
P.D. How can I print the contents of the stack using bochs?
By now, as you say, I add an ASM file with the line 'times 4096 db 0' at the end of the application, but maybe exist another stack into the C program compiled with GCC.
Thank you for your response,
pepito
P.D. How can I print the contents of the stack using bochs?
RE:C Stack
[quote]P.S. How can I print the contents of the stack using bochs?[/quote]
type "print-stack"
type "print-stack"