I am recently trying to wrote a simple kernel in pmode. The sequence goes like:
1) A boot loader loads a pure binary file into memory location 0x1000. And passes the control to this file.
2) This binary file loads simple kernel file into memory, enters pmode, and passes control to kernel. The assembly kernel stub of kernel is:
[bits 32]
[EXTERN _kernel_main]
[GLOBAL start]
[GLOBAL _sayhello]
start:
mov ax,SYS_DATA_SEL_KERNEL
mov ds,ax ; not segments anymore: SELECTORS
mov ss,ax
nop
mov es,ax
mov fs,ax
mov ax,LINEAR_SEL
mov gs,ax
jmp SYS_CODE_SEL_KERNEL:jumpEmpty
jumpEmpty:
jmp $ ; halt
_sayhello:
mov ax,LINEAR_SEL
mov gs,ax
mov byte [gs:0xB8000],'H'
mov byte [gs:0xB8001],07h
mov byte [gs:0xB8002],'E'
mov byte [gs:0xB8003],07h
mov byte [gs:0xB8004],'L'
mov byte [gs:0xB8005],07h
mov byte [gs:0xB8006],'L'
mov byte [gs:0xB8007],07h
mov byte [gs:0xB8008],'O'
mov byte [gs:0xB8009],07h
ret
In that code,
jmp SYS_CODE_SEL_KERNEL:jumpEmpty
jumpEmpty:
makes the cpu triple faulted.???. Any ideas about where the problem can be? The gdt is loaded by file loaded into 0x1000. It is copy-pasted into this kernel stub but I did not include it here. Also I checked that the problem was not about the value of SYS_CODE_SEL_KERNEL. I mean it has the value that it should have: It contains the selector which points to segment of the kernel. 10x...
triple fault problem
-
Ozguxxx
Re:triple fault problem
I had forgot to say that the kernel is loaded into 0x5000... Also forgive me about bad English... ;D