進入 big real mode 會重新開機
Hi 各位高手好以下的程式是我修改網路的一段程式,我把他修改為,讀出memory的值,並顯示在螢幕上,但是我修改後,當我在DOS下執行它,電腦會自動開機,想請各位前輩幫我看一下,是哪邊出了問題,因為目前的我是沒有頭緒的,麻煩你們了,謝謝。
;---------------------------------------
.model small
.586p
.stack
.data
DESC STRUC
LimitL DW 0
BaseL DW 0
BaseM DB 0
Attributes DB 0
LimitH DB 0
BaseH DB 0
DESC ENDS
PDesc STRUC
Limit DW 0
Base DD 0
PDesc ENDS
GDT_def Label Fword
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>
GDT_Addr PDesc <$-GDT_def-1, >
cmd DD 255(0)
.code
main proc
call Set4gb
mov esi, 20000100h
mov dword ptr fs:, 055aa55aah
.exit
main endp
Set4gb PROC NEAR
in al, 92h
or al, 002
out 092h, al
out 0edh, al
cli
mov eax, ds
shl eax, 4
xor ebx, ebx
mov bx, offset GDT_def
add eax, ebx
mov dword ptr GDT_Addr.Base, eax
lgdt fword ptr GDT_Addr
mov bx, 8
mov eax, cr0
or al, 1
mov cr0, eax
jmp pMod
pMod:
mov fs, bx
mov gs, bx
and al, 0FEh
mov cr0, eax
jmp rMod
rMod:
mov ax, 0
mov fs, ax
mov gs, ax
sti
ret
Set4gb ENDP
end main
页:
[1]