|
Hi 各位高手好( e0 R5 w; s7 r
以下的程式是我修改網路的一段程式,我把他修改為,讀出memory的值,並顯示在螢幕上,但是我修改後,當我在DOS下執行它,電腦會自動開機,想請各位前輩幫我看一下,是哪邊出了問題,因為目前的我是沒有頭緒的,麻煩你們了,謝謝。
6 l0 R1 I0 A6 W;---------------------------------------
! [ f2 u4 _- a+ H- O: V r! `
' B8 A* \# Z) u* L1 J2 r+ O- \.model small
+ U- P3 ]8 `! X) X.586p* V0 Q+ s% u- m; K/ {1 {
.stack . `( H+ N( A0 \
7 b* K7 ^' k9 d.data
, @- {# B3 F7 l2 ^, a; x, ?5 W, d7 R0 w
7 G- u9 k% Z9 f2 ?0 e' cDESC STRUC; X8 \+ Q/ f' r+ B! A3 N: i! l+ y! m
LimitL DW 0 ! J& X( \& Z0 a$ w; [
BaseL DW 0 |" I& z$ r; R3 ^5 I! k) |2 C9 {
BaseM DB 0
, I( c9 v y X8 ~) u Attributes DB 0
+ c3 ^! r! V9 J% b" E LimitH DB 0 ) a' Q3 s6 j. ^' ?1 q1 L1 N
BaseH DB 0 Z" ?" y. y3 E9 q' D( p, e# H
DESC ENDS$ [/ I, ^7 f2 P j
1 y; c- q, y7 s9 u* v/ X2 l: q& H
PDesc STRUC3 ? s4 u0 o/ T8 N
Limit DW 0
6 x0 \* Z7 D1 y Base DD 0
- W7 q4 a6 A* I% K9 |$ Y! [PDesc ENDS% W& a6 ?0 C1 w
+ z( W. [) E5 z1 q5 u/ G8 T4 uGDT_def Label Fword
3 `$ r6 r7 R `* |+ O. S) p6 ~Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>/ B" b& h+ _! j4 Q, x# Y2 v
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>8 q: V( C7 ^" ]2 i" M: A
1 Y: X4 ?1 o& M: v/ v
GDT_Addr PDesc <$-GDT_def-1, >
% W/ Q$ j) `% K" E& j% Kcmd DD 255(0)
0 O8 v* D8 [9 g' D6 H% W* G/ z: N
. q. ~5 W* [) R3 H3 p9 g$ c.code9 I9 E0 a0 Q" B4 `' r
main proc
: Q( v# v! S( B call Set4gb2 Y: [5 K+ Y# F5 [, q2 c
, G2 Q. Q1 R! g3 q5 ?- c mov esi, 20000100h
! l2 X! \3 t* I/ C mov dword ptr fs:[esi], 055aa55aah
+ r+ Q. u8 L l6 U/ V+ M+ \ , `$ l2 Z' `! {+ E' [6 d
.exit
0 C U" ]5 _5 X$ N. e' umain endp
. O/ v/ l, h4 m1 P
/ |* W! K7 O* WSet4gb PROC NEAR& U2 D ]+ K; Q& G
in al, 92h9 v8 E4 R7 i4 v8 Z3 D; }/ B
or al, 002
& Y" k# b- Q4 \" u out 092h, al7 L% T, Z+ X# F h. K
out 0edh, al
% g$ M# s! ?2 i2 b/ f+ F1 S- x2 B1 I( e1 A( N; N! u' A$ F" c
cli
( J; s/ |# G1 ]: g2 D- X5 T# i _0 F1 ^, k8 [ d k
mov eax, ds6 G$ e" F0 G2 C" F
shl eax, 4
& p: Z! j6 A- `6 D xor ebx, ebx, C3 D$ l/ E9 f* K
mov bx, offset GDT_def% d" E" p6 b8 f; c0 l
add eax, ebx" c4 S: H% ]0 m0 m# }7 H( s: ?
mov dword ptr GDT_Addr.Base, eax% F5 d* p' A0 s7 q2 f8 a$ |/ r
lgdt fword ptr GDT_Addr) o; l5 B% c8 F+ Z! _
1 s8 A# i( p; v# `. l0 e$ d% |
mov bx, 8
9 T* w5 G! f7 t& ~ t0 [) s mov eax, cr0
- \! G% N( Q0 x or al, 1) Y# Z1 J C% }% g' c- J0 \
mov cr0, eax
0 S. t d/ |4 k) D9 W
6 C9 c% K7 U% X jmp pMod
( Y+ ]# D g; q' W* y5 X4 R pMod:/ q O4 q) l; o! }+ g' y
5 O0 L8 Y9 F4 `/ J1 i8 o' m
mov fs, bx
. L: z8 ^5 `9 V5 P7 Q* \# h! |2 H5 u/ e mov gs, bx
& R; \3 b6 c& u8 b and al, 0FEh8 i8 `( q3 ^/ v2 B# X0 y K
mov cr0, eax3 i8 @. ]7 ~9 J- l
) s# Q0 s( J- O( [ jmp rMod
6 y, ?3 o4 E# Q rMod:
. D7 j) [* o2 I4 r) g
! f& w- Z" {2 U; D$ O8 Q6 p. [ mov ax, 06 o/ z# E% e: v7 g: ]7 u) [7 N
mov fs, ax
- @1 a$ G$ {9 [8 r mov gs, ax
" y" }- O% {- C. |/ }6 Z
8 y! D' W l4 m% e# o t1 e8 R' P8 I* [/ v* t
( Z+ G5 T X$ T4 f1 k7 h sti
u9 y& @+ ?1 |* P5 F0 } ret
! \4 K6 Z( N6 C4 XSet4gb ENDP3 m0 z3 y: @/ i4 C! Q
1 X+ s/ @2 f4 T( j: A! y% Rend main |
|