1. 最满是什么意思?
就是堆栈中保存的内容最多的那一次?
这个 “各单元” 指的是什么?
是要堆栈中有效数据的地址和内容,还是32个dw都要?
堆栈中只有两个数据,一个是 0x12,另一个是 0x14
其他空间全部没有使用0x0000000000030000 <bogus+ 0>: 0x8955 0x50e5 0x0651 0x8b57 0x0a4e 0x09e3 0x7ec4 0x8a06
0x0000000000030010 <bogus+ 16>: 0x0446 0xf3fc 0x5faa 0x5907 0x5d58 0x55c3 0xe589 0x0651
0x0000000000030020 <bogus+ 32>: 0x1e57 0x8b56 0x0c4e 0x09e3 0x7ec4 0xc504 0x0876 0xf3fc
0x0000000000030030 <bogus+ 48>: 0x5ea4 0x5f1f 0x5907 0xc35d 0x8955 0x51e5 0x0014 0x0012
2. 这个程序可以执行完?
执行完是什么意思?这个程序可以返回给dos操作系统?
hlt指令要配合cli指令的话,可以认为是执行到这里就完成了,但是这个程序只有一个hlt指令
hlt指令执行后,一段时间之后程序会醒过来继续执行hlt后面的指令
这个程序不会执行完成
你非要认为执行了hlt指令后就算是执行完成的话
al 中的值一直都是 1
sp 执行到 hlt 的位置,sp 的值是 0x3e
rax: 00000000_00043001
rbx: 00000000_00000001
rcx: 00000000_0009001c
rdx: 00000000_00000000
rsp: 00000000_0000003e
下面是调试过程========================================================================
Bochs x86 Emulator 2.7
Built from SVN snapshot on August 1, 2021
Timestamp: Sun Aug 1 10:07:00 CEST 2021
========================================================================
00000000000i[ ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[ ] reading configuration from bochsrc
00000000000e[ ] bochsrc:16: ataX-master/slave CHS set to 0/0/0 - autodetection enabled
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file /dev/null
Next at t=0
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b ; ea5be000f0
<bochs:1> c
^CNext at t=2308337481
(0) [0x0000000f51ca] f000:51ca (unk. ctxt): ret ; c3
<bochs:2> b 0x11aa:0x0000
<bochs:3> c
(0) Breakpoint 1, 0x0000000000011aa0 in ?? ()
Next at t=2370828743
(0) [0x000000011aa0] 11aa:0000 (unk. ctxt): mov ax, 0x3000 ; b80030
<bochs:4> s
Next at t=2370828744
(0) [0x000000011aa3] 11aa:0003 (unk. ctxt): mov ss, ax ; 8ed0
<bochs:5>
Next at t=2370828745
(0) [0x000000011aa5] 11aa:0005 (unk. ctxt): mov sp, 0x0040 ; bc4000
<bochs:6>
Next at t=2370828746
(0) [0x000000011aa8] 11aa:0008 (unk. ctxt): xor al, al ; 32c0
<bochs:7>
Next at t=2370828747
(0) [0x000000011aaa] 11aa:000a (unk. ctxt): inc al ; fec0
<bochs:8>
Next at t=2370828748
(0) [0x000000011aac] 11aa:000c (unk. ctxt): mov bx, 0xffff ; bbffff
<bochs:9>
Next at t=2370828749
(0) [0x000000011aaf] 11aa:000f (unk. ctxt): call .+5 (0x00011ab7) ; e80500
<bochs:10> s
Next at t=2370828750
(0) [0x000000011ab7] 11aa:0017 (unk. ctxt): mov bx, 0x0014 ; bb1400
<bochs:11>
Next at t=2370828751
(0) [0x000000011aba] 11aa:001a (unk. ctxt): push bx ; 53
<bochs:12>
Next at t=2370828752
(0) [0x000000011abb] 11aa:001b (unk. ctxt): ret ; c3
<bochs:13>
Next at t=2370828753
(0) [0x000000011ab4] 11aa:0014 (unk. ctxt): mov bl, al ; 8ad8
<bochs:14>
Next at t=2370828754
(0) [0x000000011ab6] 11aa:0016 (unk. ctxt): hlt ; f4
<bochs:15> reg
CPU0:
rax: 00000000_00043001
rbx: 00000000_00000001
rcx: 00000000_0009001c
rdx: 00000000_00000000
rsp: 00000000_0000003e
rbp: 00000000_00000000
rsi: 00000000_000e0000
rdi: 00000000_00000000
r8 : 00000000_00000000
r9 : 00000000_00000000
r10: 00000000_00000000
r11: 00000000_00000000
r12: 00000000_00000000
r13: 00000000_00000000
r14: 00000000_00000000
r15: 00000000_00000000
rip: 00000000_00000016
eflags 0x00007202: id vip vif ac vm rf NT IOPL=3 of df IF tf sf zf af pf cf
<bochs:16> x/32hx 0x3000:0x0000
[bochs]:
0x0000000000030000 <bogus+ 0>: 0x8955 0x50e5 0x0651 0x8b57 0x0a4e 0x09e3 0x7ec4 0x8a06
0x0000000000030010 <bogus+ 16>: 0x0446 0xf3fc 0x5faa 0x5907 0x5d58 0x55c3 0xe589 0x0651
0x0000000000030020 <bogus+ 32>: 0x1e57 0x8b56 0x0c4e 0x09e3 0x7ec4 0xc504 0x0876 0xf3fc
0x0000000000030030 <bogus+ 48>: 0x5ea4 0x5f1f 0x5907 0xc35d 0x8955 0x51e5 0x0014 0x0012
<bochs:17> s
Next at t=2370828755
(0) [0x000000011ab7] 11aa:0017 (unk. ctxt): mov bx, 0x0014 ; bb1400
<bochs:18> s
Next at t=2371540006
(0) [0x000000006454] 04b3:1924 (unk. ctxt): cli ; fa
<bochs:19> u/10
0000000000006454: ( ): cli ; fa
0000000000006455: ( ): cmp word ptr cs:0x23b0, 0x0000 ; 2e833eb02300
000000000000645b: ( ): jnz .+16 (0x0000646d) ; 7510
000000000000645d: ( ): inc byte ptr cs:0x23ba ; 2efe06ba23
0000000000006462: ( ): callf cs:0x23c8 ; 2eff1ec823
0000000000006467: ( ): dec byte ptr cs:0x23ba ; 2efe0eba23
000000000000646c: ( ): iret ; cf
000000000000646d: ( ): push ax ; 50
000000000000646e: ( ): push es ; 06
000000000000646f: ( ): mov es, word ptr cs:0x1921 ; 2e8e062119
<bochs:20> n
Next at t=2371540007
(0) [0x000000006455] 04b3:1925 (unk. ctxt): cmp word ptr cs:0x23b0, 0x0000 ; 2e833eb02300
<bochs:21> n
Next at t=2371540008
(0) [0x00000000645b] 04b3:192b (unk. ctxt): jnz .+16 (0x0000646d) ; 7510
<bochs:22>
Next at t=2371540009
(0) [0x00000000645d] 04b3:192d (unk. ctxt): inc byte ptr cs:0x23ba ; 2efe06ba23
<bochs:23>
Next at t=2371540010
(0) [0x000000006462] 04b3:1932 (unk. ctxt): callf cs:0x23c8 ; 2eff1ec823
<bochs:24>
Next at t=2371540266
(0) [0x000000006467] 04b3:1937 (unk. ctxt): dec byte ptr cs:0x23ba ; 2efe0eba23
<bochs:25>
Next at t=2371540267
(0) [0x00000000646c] 04b3:193c (unk. ctxt): iret ; cf
<bochs:26>
Next at t=2371540268
(0) [0x000000011ab7] 11aa:0017 (unk. ctxt): mov bx, 0x0014 ; bb1400
<bochs:27> n
Next at t=2371540269
(0) [0x000000011aba] 11aa:001a (unk. ctxt): push bx ; 53
<bochs:28>
Next at t=2371540270
(0) [0x000000011abb] 11aa:001b (unk. ctxt): ret ; c3
<bochs:29>
Next at t=2371540271
(0) [0x000000011ab4] 11aa:0014 (unk. ctxt): mov bl, al ; 8ad8
<bochs:30>
Next at t=2371540272
(0) [0x000000011ab6] 11aa:0016 (unk. ctxt): hlt ; f4
<bochs:31> s
Next at t=2371540273
(0) [0x000000011ab7] 11aa:0017 (unk. ctxt): mov bx, 0x0014 ; bb1400
<bochs:32> s
Next at t=2371580004
(0) [0x000000006454] 04b3:1924 (unk. ctxt): cli ; fa
<bochs:33> n
Next at t=2371580005
(0) [0x000000006455] 04b3:1925 (unk. ctxt): cmp word ptr cs:0x23b0, 0x0000 ; 2e833eb02300
<bochs:34>
Next at t=2371580006
(0) [0x00000000645b] 04b3:192b (unk. ctxt): jnz .+16 (0x0000646d) ; 7510
<bochs:35>
Next at t=2371580007
(0) [0x00000000645d] 04b3:192d (unk. ctxt): inc byte ptr cs:0x23ba ; 2efe06ba23
<bochs:36>
Next at t=2371580008
(0) [0x000000006462] 04b3:1932 (unk. ctxt): callf cs:0x23c8 ; 2eff1ec823
<bochs:37>
Next at t=2371580253
(0) [0x000000006467] 04b3:1937 (unk. ctxt): dec byte ptr cs:0x23ba ; 2efe0eba23
<bochs:38>
Next at t=2371580254
(0) [0x00000000646c] 04b3:193c (unk. ctxt): iret ; cf
<bochs:39>
Next at t=2371580255
(0) [0x000000011ab7] 11aa:0017 (unk. ctxt): mov bx, 0x0014 ; bb1400
<bochs:40> n
Next at t=2371580256
(0) [0x000000011aba] 11aa:001a (unk. ctxt): push bx ; 53
<bochs:41>
Next at t=2371580257
(0) [0x000000011abb] 11aa:001b (unk. ctxt): ret ; c3
<bochs:42>
Next at t=2371580258
(0) [0x000000011ab4] 11aa:0014 (unk. ctxt): mov bl, al ; 8ad8
<bochs:43>
Next at t=2371580259
(0) [0x000000011ab6] 11aa:0016 (unk. ctxt): hlt ; f4
<bochs:44>
|