|
Hi 各位高手好% ]" }( _' K# E9 n$ c
以下的程式是我修改網路的一段程式,我把他修改為,讀出memory的值,並顯示在螢幕上,但是我修改後,當我在DOS下執行它,電腦會自動開機,想請各位前輩幫我看一下,是哪邊出了問題,因為目前的我是沒有頭緒的,麻煩你們了,謝謝。
7 F+ Z* J8 j, a0 e;---------------------------------------8 |, C; d i% s6 m* ?& c* x
+ k1 k; L+ O2 F6 m
.model small
! Y: k# W1 c- g0 s6 y2 y.586p
* ^5 x p9 j9 _5 M( M- {3 `.stack
' T0 N2 G* |7 b. p) i
: _& m+ {# O( b9 X.data3 e; {( t5 o: x% S. X; M
, E' ?9 y. R5 n/ v1 h5 y
DESC STRUC9 H; i: N8 O: ]4 F
LimitL DW 0
, M I) ?# x9 v% w BaseL DW 0
! Y5 Y1 v; F, r4 l BaseM DB 0 , ]8 @7 ]* K$ R6 ~7 a3 r; Q# T
Attributes DB 0
1 L$ Q5 W$ r* H( H LimitH DB 0
% D. O( n1 k3 @8 R# t BaseH DB 0 5 t$ G% |- Z+ J1 R' T% S1 f
DESC ENDS- N8 d G3 T; ]0 H
) e, b1 ]3 s6 i' xPDesc STRUC. M, g9 J: a+ k# R* J1 h( d) {9 L6 {/ O
Limit DW 0
0 Q0 Z+ v V4 e8 Y- n) ~) X Base DD 0
S# m6 ~( x. K: ZPDesc ENDS
) Q8 Z r* }4 k( k1 T: _' a# P) D8 m8 W
GDT_def Label Fword
5 H8 L T. q- |9 L% K2 @Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>9 n p& N: ?+ d6 p' `
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>3 C9 |! E8 ~6 M i0 D+ f @( {+ Z
0 n% K( ]: T- G9 g: |
GDT_Addr PDesc <$-GDT_def-1, >2 l* B5 C$ ^: F7 S) D2 h- o
cmd DD 255(0)
0 w! m# c% o' b9 l
9 v) P2 K: F- l! A.code7 F0 [' L3 ^+ Y& n7 j( L: |
main proc( O( y* R& [" G9 }; ^) j
call Set4gb3 }; P8 ^( \0 M( p# i8 z9 {! P
1 h! i1 A, j( {0 }# U/ r mov esi, 20000100h& b. F5 E) B- o; ~
mov dword ptr fs:[esi], 055aa55aah
) ~# U, ~* C1 e8 P6 f8 e 0 v7 F9 v: m8 F9 @) N5 K; R
.exit0 R& ^3 Y* f$ k# A. y+ o$ G
main endp
( K+ F; Q0 \$ P1 Q& R6 ]: u
* Z( r0 q& i; `! LSet4gb PROC NEAR
" C, c+ A4 i" b. m in al, 92h/ ?( [( d. k5 j
or al, 002) c% S5 ]& d: v- l. j& M5 B
out 092h, al8 F% L5 c- T B* d# T
out 0edh, al
/ H4 s3 d9 `6 Z& x0 b5 j# ~# G' L( S4 a8 j" @3 v6 l8 D
cli; o9 V K0 g8 p' {* w6 ?
5 }$ T+ ] }" {. O \) X# V7 k
mov eax, ds! }" q% r1 H+ I: ^4 H
shl eax, 4
. ?& U" T: G- t; Q! A$ p xor ebx, ebx* ~1 @- }7 V8 A0 X; e
mov bx, offset GDT_def
+ q. W+ Y* S. Q' r add eax, ebx1 k( J' L% I1 f0 Y+ u9 R
mov dword ptr GDT_Addr.Base, eax) v# R1 W: _8 B4 N" y5 [' o
lgdt fword ptr GDT_Addr$ G5 F( T- H5 ~# ?* N: m2 i. D
3 X0 A" u% e: r: t+ a
mov bx, 8* c8 |% z I% f; `8 E$ y" |$ q1 f) B% c
mov eax, cr05 n3 b2 G' Y2 |# v6 Z
or al, 1/ I, q; |5 C; J
mov cr0, eax& N0 K( J5 M# e! G
! c3 r$ ~( @0 m9 K q jmp pMod3 A8 ?' V, U# B# {$ m$ k* M
pMod:
# L5 C P- y8 ^1 Z* Q6 D- N3 r! h6 U& @5 i" m% k; e
mov fs, bx
( ~, I% {" Y' _) [ mov gs, bx: l& Q5 k4 H n x8 B
and al, 0FEh
( e. y w7 i g3 W mov cr0, eax
, t5 Z9 C4 ]7 U6 t' v
4 h3 |2 v- r, R& D; M; o jmp rMod3 P) J' s6 V/ r+ \1 F. S, O
rMod:
7 s: s: S/ B3 _7 C, }. r8 {+ u( n
mov ax, 0
$ q, L% b+ I' R4 q; x mov fs, ax
$ _5 |9 I& {! j( [+ b mov gs, ax
4 ?% q- H; b/ V1 A) y/ a: m
) ^; k" \/ i7 {( I
+ o+ i8 d' ]$ T1 `2 Q- ?$ C* B. Y
sti
) }" R5 m% `/ J0 o( \( Q6 y1 u ret
) v: t, j! Z" s- w( B9 U) z7 _Set4gb ENDP
% c& l# Q- s( _+ i' R0 c
) N9 C8 g- h; }9 \end main |
|