[edit] it is compiled with as86, my ld86 instruction includes "-T 0x7c00
Thanks a lot, the bootloader code is as follows:
Code: Select all
entry start
start:
cli
call enableA20
mov ax, #0x0600
mov bh, #0x0F
mov cx, #0
mov dh, #25
mov dl, #80
int 0x10
lgdt[gdtr]
mov eax, cr0
or al, 1
mov cr0, eax
jmp cleareip
cleareip:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
enableA20:
call a20wait
mov al,#0xAD
out #0x64,al
call a20wait
mov al,#0xD0
out #0x64,al
call a20wait2
in al,#0x60
push eax
call a20wait
mov al,#0xD1
out #0x64,al
call a20wait
pop eax
or al,2
out #0x60,al
call a20wait
mov al,#0xAE
out #0x64,al
call a20wait
ret
a20wait:
in al,#0x64
test al,#2
jnz a20wait
ret
a20wait2:
in al,#0x64
test al,#1
jz a20wait2
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gdtr:
.word gdtend-gdt-1
.long gdt
gdt:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
nullsel equ *-gdt
.word 0x0000
.word 0x0000
.word 0x0000
.word 0x0000
kcode equ *-gdt
.word 0xFFFF ;limit 0-15
.word 0x0000 ;base 0-15
.byte 0x00 ;base 16-23
.byte 0x9A ;options
.byte 0xC0 ;flags and limit set to 256MB
.byte 0x00 ;base set to 0
kdata equ *-gdt
.word 0xFFFF ;limit 0-15
.word 0x0000 ;base 0-15
.byte 0x00 ;base 16-23
.byte 0x92 ;options
.byte 0xC0 ;flags and limit set to 256MB
.byte 0x00 ;base set to 0
gdtend: