something stack
Posted: Wed Sep 10, 2003 1:41 pm
I always hate writing up these basic little questions, they seem so insignificant. Anyway, I started remodeling the structure from the bootloader up and ran into a doozy. I started with my own bootloader loading into a very very simple kernel.
All the sudden, k_printf doesn't work. What the hell, I think. So I try and boot the same very very simple kernel using John Fine's fat12 bootf02, confident that it will correct the problem (e.g. I had screwed up my own bootloader).
The problem doesn't go away. Damn. So I know the problem's within the kernel. I make sure that my kprint_f is functional by loading a string into a variable and then calling kprintf with the variable rather than the immediate value "hello". It prints fine.
This tells me that there's a stack problem, because when the function doesn't have to push "hello" to the stack (it can function straight from that variable) it works just fine.
Anyway, I thought it was because I misunderstood bootf02 and it wasn't setting up a 32 bit stack correctly, so I added:
mov ax, DATASEL ;<-from the GDT
mov ss, ax
mov esp, 0xFFFF
to the ASM tab at the beginning of my kernel to no effect. Now I'm completely at a loss... please take a look at the code, see if any of our code masters can see the problem...
NOTE: the attached .txt includes all the code, including John Fine's bootf02
[attachment deleted by admin]
All the sudden, k_printf doesn't work. What the hell, I think. So I try and boot the same very very simple kernel using John Fine's fat12 bootf02, confident that it will correct the problem (e.g. I had screwed up my own bootloader).
The problem doesn't go away. Damn. So I know the problem's within the kernel. I make sure that my kprint_f is functional by loading a string into a variable and then calling kprintf with the variable rather than the immediate value "hello". It prints fine.
This tells me that there's a stack problem, because when the function doesn't have to push "hello" to the stack (it can function straight from that variable) it works just fine.
Anyway, I thought it was because I misunderstood bootf02 and it wasn't setting up a 32 bit stack correctly, so I added:
mov ax, DATASEL ;<-from the GDT
mov ss, ax
mov esp, 0xFFFF
to the ASM tab at the beginning of my kernel to no effect. Now I'm completely at a loss... please take a look at the code, see if any of our code masters can see the problem...
NOTE: the attached .txt includes all the code, including John Fine's bootf02
[attachment deleted by admin]