|
|
Hi 各位高手好& h8 W2 x, E( b, }
以下的程式是我修改網路的一段程式,我把他修改為,讀出memory的值,並顯示在螢幕上,但是我修改後,當我在DOS下執行它,電腦會自動開機,想請各位前輩幫我看一下,是哪邊出了問題,因為目前的我是沒有頭緒的,麻煩你們了,謝謝。. Z2 U$ c5 b* A1 V( U
;---------------------------------------5 ?# o/ {7 v7 P! X
: E0 C. w/ U; b, j# i+ W0 C.model small3 z: `# i: v2 V6 J
.586p
" G. z5 n% p, m( ]2 P& Y.stack
& U) F* w$ t: K& B7 K }' q* ^( ^* D ! a9 q U1 e8 N% ^" K2 ^9 M9 Q
.data
' f% P. T; n$ c- ^# n( e* o7 a# O' ]+ ]. `8 r+ c' {
DESC STRUC
; L! u& l2 q( _! W LimitL DW 0 1 H8 X' _( E5 S! H& }0 e8 {
BaseL DW 0
. ?# t x# J5 O8 K' `* l BaseM DB 0
9 Z/ H9 h0 h& H$ F Attributes DB 0
7 i" P8 I4 Y+ h5 [ LimitH DB 0
! a5 N0 k" k% f+ q: V# L BaseH DB 0 6 z, ~1 b% s/ H( a
DESC ENDS
; ?( m) \$ u- C$ m1 `- d: @
5 z/ `! f: p# e3 U* k' {1 r6 jPDesc STRUC( r3 w- b+ ?" O# ^8 T5 z& X+ E6 O( `
Limit DW 0
+ I* J4 U0 G# }7 V9 G Base DD 0 7 b* u9 R8 V( A
PDesc ENDS9 d* Q+ c3 [& @& z! @- Q* g/ |
* }3 H9 K( |1 h6 J8 wGDT_def Label Fword
# s6 [! v5 b2 b' NNull_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>* c5 H3 A' f* }; s8 `$ D2 }
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>8 P% n& Q: F* z) H# d! W
6 P4 ]" o* M0 F6 w9 F# ]
GDT_Addr PDesc <$-GDT_def-1, >& z8 S& J4 N( z
cmd DD 255(0)9 Z* r- }# h7 S8 R
9 g2 p1 Z0 ^% M- Y, V4 a.code% u" \( w5 O9 l( b; }7 a
main proc& ]% e" A; Y k9 N# N
call Set4gb
4 I$ L! L3 u# B3 O, W5 @& c, |- M5 b- n$ V m) w4 I
mov esi, 20000100h
' Y, l% T" L: y2 ]/ _! i5 g mov dword ptr fs:[esi], 055aa55aah
: ~& _, `' P4 t# m: K3 k# |
8 y8 u+ }! }. h. O2 k7 Y .exit0 |0 t6 {5 [. W6 I
main endp
3 \. F$ `( s3 O' O, t( B! ]6 w/ y
Set4gb PROC NEAR
: Z9 H5 e% L7 M q0 o( l6 N6 ^ in al, 92h
$ Z P! Q1 T% D( ^% M6 K2 l or al, 0022 }' b+ f! Q3 V3 U
out 092h, al
# ?9 h& b' m2 L. ^( l: V out 0edh, al
" P- y" S) S. N! o. }# L7 C4 ^8 C# d4 J: Y* N( B
cli3 B) C( ~, b$ P; ^( }8 K/ L
Y4 i( k* S9 j5 Q% A+ o( p& {7 x- _
mov eax, ds l+ o3 r) q/ Q8 u3 G
shl eax, 4+ r) S& X2 S) C% P; h
xor ebx, ebx
$ i: y. o7 e% @( z0 i7 n& A3 B mov bx, offset GDT_def
0 w9 B" @; r2 k add eax, ebx7 V, ^& u4 f1 i3 V1 }+ n' q1 h4 R
mov dword ptr GDT_Addr.Base, eax+ s: \/ g0 z/ ~% N" J4 n3 R3 t
lgdt fword ptr GDT_Addr5 c; h# t; O+ f$ k9 U1 N
$ S4 d: w: D# p- |* _6 x" O- Y( }
mov bx, 8; y0 I3 Z. }, K4 u- r$ B6 C
mov eax, cr0
0 o! x" h+ j* T. Z" k l- m or al, 1
" ~! P3 m, G1 R mov cr0, eax7 G" i/ G: }2 G
+ L- `3 j7 i3 X( x# {/ U9 C9 T' y
jmp pMod
) ?. ~% H! o r2 q$ a6 u pMod:
+ i& W. C( z) V1 {: ]
5 ~2 |- T4 r6 z7 \ w; k mov fs, bx. s. [; z+ _# u6 n4 t
mov gs, bx
/ _. g% M3 ~: n, ?* ? and al, 0FEh
0 f- O- F9 w, S! h7 S8 @" D/ O mov cr0, eax
1 y- {& E2 {, Y) x* k9 i- A
/ D& a/ x$ \: B5 T* L' c# w jmp rMod. l4 y/ k8 S( L' l+ y
rMod:
7 h c6 h) `. O" h9 a7 L: }7 u& D" \7 K& X3 _; n
mov ax, 0* p0 N" A! t; b* F# m
mov fs, ax
4 f2 S4 H% S! m4 f' [& [ mov gs, ax
3 a+ J2 _* k* } % W3 J' R7 `! u/ Y* C: K
( _9 g; n; ~- l v9 T# V; a! E6 x* Q; M5 m) K* b1 m& h
sti
. V$ k; E' z i5 r5 {6 ] ret- o3 R- n5 S# e- z# ?4 Z
Set4gb ENDP% X* }) F# D' n# G* x; t/ h! B" i) a
! C( }& u; t, \9 Z9 Q! O4 Xend main |
|