Help me boot my kernel
Posted: Fri Sep 19, 2003 11:00 pm
My Problem:
----------
I have these files
Kernel.c
--------
void print(char *text)
{
char *vidmem = (char *)0xB8000;
while(*text != 0)
{
*vidmem = *text;
vidmem++;
*vidmem = 0x07;
vidmem++;
text++;
}
}
void Dmain()
{
print("Hello World !!!");
}
Start.asm
---------
extern _Dmain
global _main
[SEGMENT .text]
[BITS 32]
_main:
call _Dmain
mov ax,0x0
ret
hlt
link.ld
-------
SECTIONS
{
.text 0x00100000 :
{
*(.text)
}
}
---------------------
Now I created coff files from these files and they are kernel.o and start.o.
And then I linked them using ld using the following command
ld -T link.ld kernel.o start.o --oformat binary -o kernel.bin
Now when I try to load my kernel I get a triple fault exception (definitely not what I expected).
I don't know what's the problem - something tells me that the problem is in my linker script.
Can someone tell me how to get 16-bit output from gcc( I tried the asm(".code16gcc") - didn't work)
Please help me.
cheers
ksk
----------
I have these files
Kernel.c
--------
void print(char *text)
{
char *vidmem = (char *)0xB8000;
while(*text != 0)
{
*vidmem = *text;
vidmem++;
*vidmem = 0x07;
vidmem++;
text++;
}
}
void Dmain()
{
print("Hello World !!!");
}
Start.asm
---------
extern _Dmain
global _main
[SEGMENT .text]
[BITS 32]
_main:
call _Dmain
mov ax,0x0
ret
hlt
link.ld
-------
SECTIONS
{
.text 0x00100000 :
{
*(.text)
}
}
---------------------
Now I created coff files from these files and they are kernel.o and start.o.
And then I linked them using ld using the following command
ld -T link.ld kernel.o start.o --oformat binary -o kernel.bin
Now when I try to load my kernel I get a triple fault exception (definitely not what I expected).
I don't know what's the problem - something tells me that the problem is in my linker script.
Can someone tell me how to get 16-bit output from gcc( I tried the asm(".code16gcc") - didn't work)
Please help me.
cheers
ksk