OS compiles fine but wont run
OS compiles fine but wont run
Hello there fellow OS Developers. I have recently revamped my desire to work on my os, and went back to coding some of the basics. But I'm having a particularly awful time getting it working! At the bottom of this post I link to my kernel, if anyone would like to take a look at it and try to guess what i did wrong. Here is the error at hand:
Everything compiles great, seems to be working fine. I use
the makeos.bat in the zip posted below. It compiles, assembles, links, and cats without problem. Then I rawwrite it to a floppy, which also goes fine. I boot it in my other box, and no dice whatsoever. Anyone who can help has my greatfulness forever.
If you need more information, email me:
[email protected]
ossrc: http://asbestos.freeservers.com/asbestos.zip
(the file is also attached to the post)
[attachment deleted by admin]
Everything compiles great, seems to be working fine. I use
the makeos.bat in the zip posted below. It compiles, assembles, links, and cats without problem. Then I rawwrite it to a floppy, which also goes fine. I boot it in my other box, and no dice whatsoever. Anyone who can help has my greatfulness forever.
If you need more information, email me:
[email protected]
ossrc: http://asbestos.freeservers.com/asbestos.zip
(the file is also attached to the post)
[attachment deleted by admin]
Re:OS compiles fine but wont run
Hi,
in your linker script you have
also add
*(.common*) to the .data section of your linker script.
hope that helps
in your linker script you have
but in your boot.asm file you are jumping to.text 0x10000
you are jumping to an address with 5 ZEROs in stead of 4.jmp CODESEL:0x100000
also add
*(.common*) to the .data section of your linker script.
hope that helps
Re:OS compiles fine but wont run
nope - it now spits out a load of gibberish to the second half of the first line and the first half of the second line of the screen. I changed the 10000 in link.ld to 100000 and added under .data the *(.common*) thing. we're getting closer - i know it. Thanks again, Jimferd.
Re:OS compiles fine but wont run
hi,
the problem it seems(i think) is in the c code i.e kernel.bin
I just used it in my own os as the kernel and also got about 3 lines of gibberish. You need to look at you printing function. I'm examinging it...
I think you should change in stdio.c
the problem it seems(i think) is in the c code i.e kernel.bin
I just used it in my own os as the kernel and also got about 3 lines of gibberish. You need to look at you printing function. I'm examinging it...
I think you should change in stdio.c
also try replacing '\n' with 0x0a, sometimes '\n' is not recognised properly. happened to me.i=(line*25*2);
to
i=(line*160); /* 80x25 so a line is 160bytes long*/
Re:OS compiles fine but wont run
ergg still gibberish!
also, change '\n' to '0x0a' or just 0x0a ? I changed it to just 0x0a .
Jimferd
thanks a lot
not working still tho :-[
also, change '\n' to '0x0a' or just 0x0a ? I changed it to just 0x0a .
Jimferd
thanks a lot
not working still tho :-[
Re:OS compiles fine but wont run
Okay,
in your boot code try removing
also
That eb:bx combo ends up as 0x10000 (1mb). I don't think bios can handle addresses above 1mb even though you have enabled the A20 line.
Try reading the kernel to memory below 1mb (also linking in to that address) until you are sure the kernel is bug free(affter dev) then you can copy it to memory above 1mb.
in your boot code try removing
its not needed.sti ; re-enable interrupts for BIOS fdd read
also
is not a good idea. Bochs returnsmov ax,0xffff
mov es,ax ; Data buffer for file
mov bx,0x10 ; Start of segment
continuously.[FDD ] read() on floppy image returns 0
That eb:bx combo ends up as 0x10000 (1mb). I don't think bios can handle addresses above 1mb even though you have enabled the A20 line.
Try reading the kernel to memory below 1mb (also linking in to that address) until you are sure the kernel is bug free(affter dev) then you can copy it to memory above 1mb.
Re:OS compiles fine but wont run
just looked over the boot code again and
you are reading 17 sectors from track 0 in the first read,
and then 18 sectors from track 0 in the second read
Don't you mean, read 18 sectors from track 1 in the second read?
you are reading 17 sectors from track 0 in the first read,
and then 18 sectors from track 0 in the second read
Don't you mean, read 18 sectors from track 1 in the second read?
mov ax,0xffff
mov es,ax ; Data buffer for file
mov bx,0x10 ; Start of segment
mov ah,2 ; Function to read disk
mov al,17 ; Total sectors to read
mov ch,0 ; Track <---------------------this is what i mean
mov cl,2 ; Sector
mov dh,0 ; Head | Drive is already loaded
int 0x13 ; Call BIOS read disk function
jc read
mov ax,0xffff
mov es,ax
mov bx, 0x2210
mov ah,2 ; Function to read disk
mov al,18 ; Total sectors to read
mov ch,0 ; Track <-------------------here is the other one
mov cl,1 ; Sector
mov dh,1 ; Head | Drive is already loaded
int 0x13 ; Call BIOS read disk function
Re:OS compiles fine but wont run
I changed all of the aforementioned, (loading os at 0x1000) but not the thing just boots, reboots, boots, reboots, etc.
Ergg
Thanks for your help!
:'(
Ergg
Thanks for your help!
:'(
Re:OS compiles fine but wont run
why don't you try running it with bochs? It might give you a better idea of what's going on. A regular computer will just reset if there is a big enough problem, and bochs will crash too, but it will give you more information why.
Re:OS compiles fine but wont run
Code: Select all
; -[move GDT to 0x500]- ;
xor ax,ax
mov ds,ax
mov es,ax
mov si,GDT ; Move From [DS:SI]
mov di,[GDTbase] ; Move to [ES:DI]
mov cx,[GDTsize] ; size of GDT
cld ; Clear the Direction Flag
rep movsb ; Move it
Re:OS compiles fine but wont run
Code: Select all
; -[move GDT to 0x500]- ;
xor ax,ax
mov ds,ax
mov es,ax
Re:OS compiles fine but wont run
The null selector (the first segment selector descriptor in the GDT) is reserved in protected mode only. In real mode, it behaves as a normal segment... 16 bytes wide etc...bkilgore wrote:why are you moving 0 into the ds and es segment selectors? isn't segment 0 the null segment and reserved? could this be causing problems?Code: Select all
; -[move GDT to 0x500]- ; xor ax,ax mov ds,ax mov es,ax
Re:OS compiles fine but wont run
ah, right. I keep forgetting there is a world beyond protected mode...
Re:OS compiles fine but wont run
Hehe... Well, it's rather _before_ protected mode...bkilgore wrote: ah, right. I keep forgetting there is a world beyond protected mode...
Re:OS compiles fine but wont run
Ha! fine word games these are *g*
ere long everyone will go hither and tither spreading word about peters stress on 'BEFORE p_mode'
but doesnt fit beyond in both directions? In german there is no real aequivalent for this word. Maybe "jenseits" fits best for it but with this odd feeling that it doesn't really express what one means...
and no, don't prick my butt with bits, i'm just in a queer mood.
ere long everyone will go hither and tither spreading word about peters stress on 'BEFORE p_mode'
but doesnt fit beyond in both directions? In german there is no real aequivalent for this word. Maybe "jenseits" fits best for it but with this odd feeling that it doesn't really express what one means...
and no, don't prick my butt with bits, i'm just in a queer mood.