Hi, I get a problem when I try to load kernel to 0c00:0000.(linear=c000) In fact I cannot understand why, I think it is about size of kernel, it is now about 28K when we add this to 0c000: 0c000h + 6d60h = 12d60h. is that linear address something that we must not touch? Because when I reduce size of kernel by taking out some of it, then it works fine.
Extra Information:
Working in real mode when I get the error, I think problem is about boot loader, I simply read kernel file from fat12 floppy and then jump to it.
size problem :)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:size problem :)
not to my knowledge. Did you made sure you load everything (no problems with computing the next sector or something alike ? isn't your file fragmented ? ...)
Re:size problem :)
What is it that you mean by "fragmented"? I think it should not be about computing next sector to load -because until yesterday it worked fine without problem, it did what I wanted and suddenly yesterday it crashed and Im stuck.- however it is a good point, I think I should check it in more detail... Thanx...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:size problem :)
you have no guarantee a file will be contiguous in FAT filesystem, especially when the file grows. Consider the following scenario
- you format a disk. It looks like <root><free space>
- you allocate 4 blocks for file X, so it now looks like <root><X X X X><free space>
- you allocate 2 blocks for file Y, your floppy is <root><X X X X><Y Y><free>
- now if you want to write a 6-sectors content over file X, you start opening it and overwrite the 4 blocks, but when the 5th block is to be written, DOS will have to extend the file, and picks up the first free sector it can find (after Y) and uses the File Allocation Table to chain the two parts of your file: it is now fragmented:
<root><X' X' X' X'><Y Y><X' X'><free>
Re:size problem :)
Well I got problem fixed but I could not find where the problem is... It might be in fat reading stuff but it seems to work fine... I am still confused, when I tried to load kernel to 10000h instead of c000h it started working correctly(of course I had to change gdt, idt and mm stuff accordingly) but intersting thing is that when I try to load code to fff0h instead of 10000h(BTW these are all linear addresses) I get same error, I cannot understand it, only 16 bytes of difference but I could not figure it out... When I tried to dissect the problem I saw that what caused the problem was int 13h however I could not find problem... (When loading to c000, I could not read more than 24 sectors using int 13h, any ideas?) As a result when I create a 36k of kernel it is loaded correctly for now, this means that I can go on for 8 K more now... Anyway, thanx...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:size problem :)
did you by any chance initialize your stack with SS=0, SP=FFFE ?
If this is the case, then there are chances the start of your kernel get overwritten by your stack when you make your kernel loaded below 64K barrier (top of stack)
pure speculation from me, anyway
If this is the case, then there are chances the start of your kernel get overwritten by your stack when you make your kernel loaded below 64K barrier (top of stack)
pure speculation from me, anyway
Re:size problem :)
Hey cool man!!! When I read your post I realized the problem myself... Thanx a lot... I was just overwriting stack...When I change esp from 0xffff to 0x7bff (in boot loader ss=0000) it started working... thanx a lot. BTW I have...
Re:size problem :)
I had sent previous post unfinished but I was not gonna say anything valuable... Anyway thanx again...