Problems with krnl.sys
Problems with krnl.sys
Hi! I've notice a problem. When my kernel is biggest than 50kb, my second stage (part of it, taken by brokenthorn.com) isn't able to load it. i'm using a FAT12 floppy, and the file is correctly loaded in it.
Does anyone have some ideas?
Does anyone have some ideas?
Re: Problems with krnl.sys
Hi,
Does that help?
Cheers,
Brendan
All of the code you posted above is wrong!!!Karlosoft wrote:Hi! I've notice a problem. When my kernel is biggest than 50kb, my second stage (part of it, taken by brokenthorn.com) isn't able to load it. i'm using a FAT12 floppy, and the file is correctly loaded in it.
Does anyone have some ideas?
Does that help?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Problems with krnl.sys
Karlosoft wrote:my second stage [...] isn't able to load it.
Is it or isn't it?Karlosoft wrote:and the file is correctly loaded in it.
Re: Problems with krnl.sys
Hi,
Cheers,
Brendan
I assumed Karlosoft meant "the file is correctly copied into the file system".Hobbes wrote:Karlosoft wrote:my second stage [...] isn't able to load it.Is it or isn't it?Karlosoft wrote:and the file is correctly loaded in it.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Problems with krnl.sys
Yes I meant copied
Well I can't post all the sources of the kernel. The code of the bootloader-stage2 that load my kernel is the same of this. I've just add some routines to enable vesa and save information from real mode.
Well I can't post all the sources of the kernel. The code of the bootloader-stage2 that load my kernel is the same of this. I've just add some routines to enable vesa and save information from real mode.
Re: Problems with krnl.sys
Hello,
Are their any errors or warnings displayed in the bochs crash log or on display?
Are their any errors or warnings displayed in the bochs crash log or on display?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: Problems with krnl.sys
Hi,
At the end of "ReadSectors" it does this:
You might be able to change it to something like:
Not sure if that'd cause problems elsewhere, but it'd be a start - if it doesn't cause problems elsewhere you'd be able to load about 512 KiB before it fails.
Cheers,
Brendan
That code uses 16-bit registers to keep track of where to load the next sector into RAM. If you call "LoadFile" with BP = 0, then it'll wrap around after 65536 bytes (and if you call "LoadFile" with BP = 0x8000 you'd only be able to load 32 KiB before it fails).Karlosoft wrote:The code of the bootloader-stage2 that load my kernel is the same of this.
At the end of "ReadSectors" it does this:
Code: Select all
pop cx
pop bx
pop ax
add bx, WORD [bpbBytesPerSector] ; queue next buffer
inc ax ; queue next sector
loop .MAIN ; read next sector
ret
Code: Select all
pop cx
pop bx
mov ax,es
add ax,512/16
mov es,ax
pop ax
inc ax ; queue next sector
loop .MAIN ; read next sector
ret
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Problems with krnl.sys
I'll try it in the next days... my computer is dead . I'm coping my sources on the old.
No error, no warning only a flat black screen
No error, no warning only a flat black screen
Re: Problems with krnl.sys
Wow, I've just tried this code but it doesn't work. I did some test and I've found the limit. It is C000 in hex, so 49152... well strange. The filesystem that I'm using is FAT12, I don't remember any restriction on the size of a file. This is my link.ld file... maybe the mistake is here...
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
__CTOR_LIST__ = .; LONG((__CTOR_END__ -
__CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) __CTOR_END__
= .;
__DTOR_LIST__ = .; LONG((__DTOR_END__ -
__DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) __DTOR_END__ =
.;
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
Re: Problems with krnl.sys
I have never write nothing in assembly except a pair of line in the C++ code, so it's not easy for me to understand what doesn't work. However i think the problem is in one of the point noticed by Brendan.
The strange thing is that the limit of the copy isn't the register bx that I'm using, but the maximal lenght of the offset. I can copy my kernel up to c000 because c000+3000 (the start offset) is less than ffff. If I move this start limit to 4000 in fact it doesn't work. So how to change the value of the segment pointer??? (I'm not very good to write assembly).
The strange thing is that the limit of the copy isn't the register bx that I'm using, but the maximal lenght of the offset. I can copy my kernel up to c000 because c000+3000 (the start offset) is less than ffff. If I move this start limit to 4000 in fact it doesn't work. So how to change the value of the segment pointer??? (I'm not very good to write assembly).