Page 1 of 1

How can i put my kernel to 1000h:000 ?!

Posted: Sun Mar 27, 2005 5:39 am
by KiBOrG
I have bootloader a it loaded some soctors from diskette
a then jump to 1000h:0000 and i dont know how i can put my kernet there.

Please Help me,

when you know some url with os turorials
please send me it.

Thank

KiBOrG

Re:How can i put my kernel to 1000h:000 ?!

Posted: Sun Mar 27, 2005 7:35 am
by Kershplat
Why not just tell the BIOS, instead of loading it wherever you told it to, to load it to 0x1000:0 ?

If you're looking to relocate data loaded with the BIOS, look into the stosb instruction. Although really, the address you're using isn't above the 1 meg mark, so you don't need to, just tell the BIOS to put it there; it can, and you don't have to move it.

es:bx, I think it is for the BIOS.

Re:How can i put my kernel to 1000h:000 ?!

Posted: Mon Mar 28, 2005 3:01 am
by slash
To put your kernel at 1000h:000 you should compile it and relocate its "text" segment to 10000h(segment*10 + offset).For example linking the kernel using GNU "ld" you should use the following command :

ld -Ttext 0x00010000

Re:How can i put my kernel to 1000h:000 ?!

Posted: Mon Mar 28, 2005 11:32 am
by DennisCGc
To put your kernel at 1000h:000 you should compile it and relocate its "text" segment to 10000h(segment*10 + offset).For example linking the kernel using GNU "ld" you should use the following command :

ld -Ttext 0x00010000
That doesn't put the kernel to 0x1000:0000, now does it ? If I'll do that, but the bootloader does load it to 0x2000:0000 it will be put to 0x2000:0000.
To put it to 0x1000:0000 you should set es to 0x1000 and bx to 0 before the actually loading.
And if you're using C/C++/any high level programming language/ you should link it to 0x10000.

Re:How can i put my kernel to 1000h:000 ?!

Posted: Mon Mar 28, 2005 12:20 pm
by Candy
[joke, don't try]
dd if=kernel.sys of=/dev/mem seek=65536
[/joke, don't try]

Re:How can i put my kernel to 1000h:000 ?!

Posted: Mon Mar 28, 2005 11:51 pm
by slash
And if you're using C/C++/any high level programming language/ you should link it to 0x10000
Thats what I meant.I didn't say the kernel will be put there I only meant that when the bootloader puts the kernel at 1000:000 and execute it,the kernel will look for code at 0x1000.

Re:How can i put my kernel to 1000h:000 ?!

Posted: Tue Mar 29, 2005 1:17 am
by B.E
KiBOrG wrote: I have bootloader a it loaded some soctors from diskette
a then jump to 1000h:0000 and i dont know how i can put my kernel there.
I think you blindly copied the loading sectors (if not the whole bootloader) code from somewhere and said you have a bootloader. I suggest you write your own or even just study the code.

By the way to put the kernal at 1000h:000 do what DennisCGc said:
To put it to 0x1000:0000 you should set es to 0x1000 and bx to 0 before the actually loading.