|
Hi 各位高手好
$ E* G, M! D) ]# j6 ?" x: _, g! U( q以下的程式是我修改網路的一段程式,我把他修改為,讀出memory的值,並顯示在螢幕上,但是我修改後,當我在DOS下執行它,電腦會自動開機,想請各位前輩幫我看一下,是哪邊出了問題,因為目前的我是沒有頭緒的,麻煩你們了,謝謝。" O3 [, x+ H+ Z8 E d* x( B" E1 X# r
;---------------------------------------) k2 M! M' r. z8 g" [
! P( o X$ b" i8 }. a- s n5 c' ]
.model small
8 W3 Y4 I9 R& [8 Q5 l1 _.586p* T3 m6 _9 d2 N
.stack
S( E8 ~0 v. d7 } }3 X, N5 y# ^- S: S
.data }9 K$ V. Y# B9 Q7 H; V3 E
7 I5 l* Q' { D, ^* W# y) |DESC STRUC
' j' J( i" O- H LimitL DW 0
6 X7 l" m4 G1 w! W5 s/ c. U4 L: y BaseL DW 0
. S( J2 j' H' k$ {. q4 ^' M BaseM DB 0
4 t' Q' `4 ^. b3 q Attributes DB 0
1 X' h+ ^% f' v( m$ i, G; h LimitH DB 0
$ B* N1 \& r, Q4 H7 P4 m BaseH DB 0 3 ?2 S+ U+ ~; H2 W( C+ i
DESC ENDS
2 `( C8 j! d! w: M) [; L3 L5 p3 X3 ]5 ~ W/ c% N) C
PDesc STRUC* x- S# g* m) Y
Limit DW 0 6 C9 {( I" p. N5 r: n7 I* u
Base DD 0
7 `/ T3 ^. d$ U* E. pPDesc ENDS( b( I7 p) u" M4 `# _
# K$ e5 E; x* l5 V% @; h+ j
GDT_def Label Fword
$ a# b) }+ g7 c: ?% |* ~Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>
6 K8 E6 q8 Q- l, T* }+ IData_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>
& }! i; h, s; T( u6 X6 C9 M' j) T9 w' j O' {
GDT_Addr PDesc <$-GDT_def-1, >4 X8 \ S. K- v' r7 q% o2 ?
cmd DD 255(0)- u: I2 Z3 W+ V
" A( X& R, P1 K. I& K- `3 W
.code
0 J$ c3 |# M3 Z# S, F6 p) ~ t* E2 dmain proc
! b0 ?9 i" n6 @' l# {: n2 ` call Set4gb
# S8 ]+ d, |1 @7 D: Q0 G
1 p3 T- U6 j2 @* P) d% i* f3 `. G mov esi, 20000100h
) P+ W& R5 j& y a- `( I mov dword ptr fs:[esi], 055aa55aah7 o- z' B1 \- G$ a+ W3 d4 v, [
' K5 W' V$ |) n; p0 I& |
.exit: @7 j( W' k5 E8 ~7 Q
main endp
- H9 R. v: { h9 J1 C
( Y. f6 W" V4 BSet4gb PROC NEAR
" w" p3 p6 l% H* J* w in al, 92h
6 z5 }6 T5 a0 X# R4 @5 P; D or al, 0022 X4 Y, I/ M9 b4 ^9 L/ B
out 092h, al1 G# f: V7 K6 `/ [, {! c% {
out 0edh, al
& v2 e4 m% s* h3 G8 j( @2 N! F# \
cli
2 N4 }2 G& i/ f( L5 B
/ @0 L( o' C( k C* D mov eax, ds
* {9 k) n' u; q$ A4 Y shl eax, 48 |" v" D1 f. v; ^ Z+ H1 ]
xor ebx, ebx
9 s1 Z- f6 ]" k/ s mov bx, offset GDT_def6 f& o# k0 B2 |
add eax, ebx9 i$ R: ` Z+ u9 G- d$ X0 B" E
mov dword ptr GDT_Addr.Base, eax
& \# i3 U, ~& f( t1 _% i8 a6 v lgdt fword ptr GDT_Addr& Z3 V4 M) ~7 g# w1 c( r
: C9 D: I9 j! e" d r$ f! i mov bx, 8) q! y4 U1 s [ l% o1 b$ Y
mov eax, cr06 x7 f, y& U, \% j3 K
or al, 1* c: a- W$ Q/ E+ e* r+ q
mov cr0, eax
( J+ H' V: p- g M; E0 N/ b7 |
! ?; Y: @0 `5 Q$ L# N; q; B( H jmp pMod
1 N$ p1 c( j) G' [$ S# | pMod:
0 ^. ~! L4 F4 ~" N4 f4 h
* E u, K" j5 J3 } mov fs, bx
. f, }5 U; G. ?! r mov gs, bx
8 t6 W$ X) _+ B( { and al, 0FEh; L) l9 ~. S9 g, \
mov cr0, eax
; T0 o8 ]* P! b0 F5 q 7 U1 ]$ m/ B) }1 u; q0 s6 u4 \, E
jmp rMod, P s6 _! H4 \" C$ R4 \
rMod:; y2 [$ ~5 e% ?) [ {. W
& ~. T( m% c3 T2 d9 Y
mov ax, 0) h$ k0 W* A4 A' c8 p' V3 l( c0 I
mov fs, ax; z( |1 q1 \! H
mov gs, ax
2 n% ?7 c; r2 X5 m0 s7 h ' a- n( ? k0 n$ C% d. a
. t( D+ ^( C9 _, W$ U
$ r4 s+ l- c- Z1 X' P4 O% ]3 o
sti
$ V1 x$ m1 U' W7 t/ A% o. Q ret
) ~$ @. m W1 FSet4gb ENDP
0 s/ r& X$ r: b0 [( B4 J5 ?. L, w$ e
" w8 K/ E: s& oend main |
|