You said:
Anyway, try to write some debugging functions and make sure that ur esp is positionned @ 0x90000
How would I make a debugging function? You mean with bochs? I'm using the win32 bochs, and havn't enabled debugging functuality. and don't know how. This is the kernel.c (so far) that calls print.c:
Code: Select all
extern int print(char *string);
int main(){
print("hello");
loop:
goto loop;
}
which calls print.c :
Code: Select all
int print(char *string) {
char *vidmem = (char *)0xB8000;
while(*string != 0) {
*vidmem++ = *string++;
*vidmem++ = 0x07;
}
return;
}
The kernel is compiled with->
gcc -c kernel.c
gcc -c print.c
ld -T link.ld kernel.o print.o
And here is my bootsector:
Code: Select all
[BITS 16]
[ORG 0X7C00]
jmp main
nop
main:
load_kernel:
.reset:
mov ah, 0x00
int 0x13
jc .reset
mov ah, 0x02 ; read sector function
mov al, 0x01
mov ch, 0x00
mov cl, 0x02 ; read second sector
mov dh, 0x00
mov dl, 0x00
mov bx, 0x00 ; segment
mov es, bx
mov bx, 0x1000
.read:
int 0x13
jc .read
.kill_motor:
mov dx, 0x3f2
xor al, al
out dx, al
cli
xor ax, ax
mov ds, ax
lgdt [gdtr]
mov eax, cr0
or eax, 1
mov cr0, eax
jmp .next
.next:
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esp, 0x90000
jmp 0x08:0x1000
gdtr:
dw (8*3)-1
dd gdt
gdt:
dw 0x0000
dw 0x0000
dw 0x0000
dw 0x0000
dw 0xFFFF ; code descriptor
dw 0x0000
db 0x00
db 10011010b
db 11001111b
db 0x00
dw 0xFFFF ; data descriptor
dw 0x0000
db 0x00
db 10010010b
db 11001111b
db 0x00
times 510-($-$$) db 0
dw 0xAA55
Sorry if this is too much code. I thought that maybe if you guys saw my bootsector too, that you might see a problem off the top of your head.
Thanks, and Merry Christmas!
tyler