Problem Outputing Proper Text
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
I dont use linker scripts , I just compile it to an executable native to my os, but thats probably not what you want.Fear wrote:Can you post the linker script you used to compile it? Because I tried some examples with the rodata section in it, and it still compiled the same way....
What i do wonder, is HOW you try to load and execute the code, as plainly running it in userspace will go horribly wrong. Perhaps you are loading your code at the wrong linear address causing the data pointers to be pointing into nowhere. I hope you tried using Bochs' and its debugger, it can help you solve this sort of problems easily.
btw, the convention is to use "int main()", not "void Main()" (notice the capitalisation)
I see you posted an upload during this wiriting
One thing i noticed is the fact that your own bootloader dumps the image at 0x10000 [0x1000 segment], jumps to the code at 0x1000 linear, and neither address can be used by grub (since i see multiboot stuff...). I'll probably assume you use grub as you do get into kernel code somewhere.
I dont see a floppy image so i cant quickly run it, as I don't have grub anywhere on floppy. (also, i don't feel like opening a hex editor right now to dump the kernels contents)
Things to check:
- where do you have grub load it, and to where do you map the actual image
- what format are you compiling to, binary or something else?
- do you have bochs
edit: i cant type fast enough to keep up with you guys
Well, all that multiboot stuff in Kernel.asm is for GRUB (which is another bootloader). As Combuster said, Boot.asm isn't quite right: It will load the kernel to address 0x10000 (0x1000:0) but then jump to address 0x1000. Also, your linker script is wrong - the line "phys = 0x100000" tells the linker that your kernel will be loaded at address 0x100000. So, you have three different addresses in three different places, and they need to be the same
You could either:
You could either:
- Make all the addresses the same. For example, by changing "mov bx, 0x1000" in Boot.asm to "mov bx, 0x100", and changing "phys = 0x100000" to "phys = 0x1000" (and removing the multiboot stuff from Kernel.asm - you won't need it). Or...
Use GRUB instead of Boot.asm to boot your kernel.
One other thing, the screen (80x25) has 2000 slots for text, and when I clear it, it works perfectly. Then, after I write 6 lines of text, it stops working. I can't write anymore, and Bochs reports the error: interrupt(): gate descriptor is not valid sys seg. What does this mean, and whats going on?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Since it occurs at at a regular point in time, its probably the PIT at IRQ0. It'll just pick a clock cycle to interrupt your code. How much you can do before that depends on how well you optimized your code.
Still, you should handle all IRQs - it isnt really professional if anybody is able to crash your kernel by just hitting the keyboard or touching the mouse.
Still, you should handle all IRQs - it isnt really professional if anybody is able to crash your kernel by just hitting the keyboard or touching the mouse.