problem in protected mode
Posted: Wed Oct 08, 2003 11:20 pm
in the following code when i changed base addresse of code descriptor
to 1000h insted of 0000h , nothing gets printed and system just restarts.
can you explain what's the problem.
"my loader code is"
"my kernel code is"
"my script file for jloc linker is"
to 1000h insted of 0000h , nothing gets printed and system just restarts.
can you explain what's the problem.
"my loader code is"
Code: Select all
[bits 16]
[ORG 0xC7c00]
jmp 0000:start
start:
mov ax,cs ;initialize the data segment
mov ds,ax
mov es,ax
mov ax,3 ;clear screen
int 10h
resetFloppy:
mov ah,0
int 13h
jc resetFloppy
;now read the kernel from the floppy
readFloppy:
;es:bx==> 1000:0000h
mov ax,1000h
mov es,ax
mov bx,0
mov ah,2
mov al,1 ;load 1 sectors
mov ch,0 ;cylinder=0
mov cl,3 ;sector=3
mov dh,0 ;head=0
mov dl,0 ;floppy drive
int 13h ;read it
jc readFloppy
jmp 0x1000:0x0000 ;jmp now
times 510- ($-$$) db 0
dw 0AA55h
"my kernel code is"
Code: Select all
[BITS 16] ; We need 16-bit intructions for Real mode
start:
cli
lgdt [gdt_desc]
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 08h:clear_pipe
[BITS 32]
clear_pipe:
mov ax, 10h
mov ds, ax
mov ss, ax
mov esp, 090000h
mov byte [ds:0B8000h], 'T'
mov byte [ds:0B8001h], 1Bh
hang:
jmp hang ; Loop, self-jump
gdt:
gdt_null: ; Null Segment
dd 0
dd 0
gdt_code:
dw 0FFFFh
dw 1000h
db 0
db 10011010b
db 11001111b
db 0
gdt_data:
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_end:
gdt_desc:
dw gdt_end - gdt - 1
dd gdt
"my script file for jloc linker is"
Code: Select all
ALL:
system1.o
VLOAD: 1000 0 0
*