Problem
Posted: Tue Aug 03, 2004 11:00 pm
;here is my code which goes into 32 bit protect mode now tell how will go back ;real mode
[org 0x0100]
jmp start
gdt: dd 0x00000000, 0x00000000 ; null descriptor
dd 0x0000FFFF, 0x00CF9A00 ; 32bit code descriptor
dd 0x0000FFFF, 0x00CF9200 ; data descriptor
gdtreg: dw 0x17 ;
dd 0 ; & the 32 bit base
strat:
mov ax,0x2401
int 0x15
xor eax, eax ;makes eax zero
mov ax, cs
shl eax, 4
mov [gdt+0x08+2], ax
shr eax, 16
mov [gdt+0x08+4], al ; set base of code desc
xor eax, eax
mov ax, cs
shl eax, 4
add eax, gdt
mov [gdtreg+2], eax ; set base of gdt
lgdt [gdtreg] ; load gdtr
mov eax, cr0 ;loading the control register 0 into eax
or eax, 1 ;setting the least significant bit of eax to zero
cli ; disableing the interrupts
mov cr0, eax ; enable's the protected mode
jmp 0x08:pmode
[bits 32]
; 32bit protected mode code
pmode: mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
;now how will go back to real mode
[org 0x0100]
jmp start
gdt: dd 0x00000000, 0x00000000 ; null descriptor
dd 0x0000FFFF, 0x00CF9A00 ; 32bit code descriptor
dd 0x0000FFFF, 0x00CF9200 ; data descriptor
gdtreg: dw 0x17 ;
dd 0 ; & the 32 bit base
strat:
mov ax,0x2401
int 0x15
xor eax, eax ;makes eax zero
mov ax, cs
shl eax, 4
mov [gdt+0x08+2], ax
shr eax, 16
mov [gdt+0x08+4], al ; set base of code desc
xor eax, eax
mov ax, cs
shl eax, 4
add eax, gdt
mov [gdtreg+2], eax ; set base of gdt
lgdt [gdtreg] ; load gdtr
mov eax, cr0 ;loading the control register 0 into eax
or eax, 1 ;setting the least significant bit of eax to zero
cli ; disableing the interrupts
mov cr0, eax ; enable's the protected mode
jmp 0x08:pmode
[bits 32]
; 32bit protected mode code
pmode: mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
;now how will go back to real mode