You need to set the stack segment registers to point to theHow exactly does one create the stack? Does it have to be done in assembly (if so, why)?
stack, so yes it must be done in assembly.
In my OS, I set my stack from 09000h to 0FFFFh. Coinsidering the
importance of the stack, we have to insure we have enough memory
for it, so the more the better.
To set the stack, just set SS and SP:
Code: Select all
mov ax, 09000h
mov ss, ax
mov sp, 0FFFFh
This is dependent on the compilier. With GCC, I prefer using inline asm.What method(s) do you recommend for accessing the x86 CPU registers in C/C++?