调试main()到init()到setup()

<bochs:3> b 0x54a7
<bochs:4> c
(0) Breakpoint 2, 0x54a7 in ?? ()
Next at t=16677775
(0) [0x000054a7] 0008:000054a7 (unk. ctxt): retn                      ; c3
<bochs:5> s
Next at t=16677776
(0) [0x0000664c] 0008:0000664c (unk. ctxt): push ebp                  ; 55
<bochs:6> u /100
0000664c: (                    ): push ebp                  ; 55
0000664d: (                    ): mov ebp, esp              ; 89e5
0000664f: (                    ): movzx ecx, word ptr [ds:0x901fc] ; 0fb70dfc010900
00006656: (                    ): mov dword ptr [ds:0x1a964], ecx ; 890d64a90100
0000665c: (                    ): mov eax, 0x90080          ; b880000900
00006661: (                    ): mov edx, 0x1dd6c          ; ba6cdd0100
00006666: (                    ): mov ecx, dword ptr ds:[eax] ; 8b08
00006668: (                    ): mov dword ptr ds:[edx], ecx ; 890a
0000666a: (                    ): mov ecx, dword ptr ds:[eax+0x4] ; 8b4804
0000666d: (                    ): mov dword ptr ds:[edx+0x4], ecx ; 894a04
00006670: (                    ): mov ecx, dword ptr ds:[eax+0x8] ; 8b4808
00006673: (                    ): mov dword ptr ds:[edx+0x8], ecx ; 894a08
00006676: (                    ): mov ecx, dword ptr ds:[eax+0xc] ; 8b480c
00006679: (                    ): mov dword ptr ds:[edx+0xc], ecx ; 894a0c
0000667c: (                    ): mov ecx, dword ptr ds:[eax+0x10] ; 8b4810
0000667f: (                    ): mov dword ptr ds:[edx+0x10], ecx ; 894a10
00006682: (                    ): mov ecx, dword ptr ds:[eax+0x14] ; 8b4814
00006685: (                    ): mov dword ptr ds:[edx+0x14], ecx ; 894a14
00006688: (                    ): mov ecx, dword ptr ds:[eax+0x18] ; 8b4818
0000668b: (                    ): mov dword ptr ds:[edx+0x18], ecx ; 894a18
0000668e: (                    ): mov ecx, dword ptr ds:[eax+0x1c] ; 8b481c
00006691: (                    ): mov dword ptr ds:[edx+0x1c], ecx ; 894a1c
00006694: (                    ): movzx eax, word ptr [ds:0x90002] ; 0fb70502000900
0000669b: (                    ): shl eax, 0xa              ; c1e00a
0000669e: (                    ): add eax, 0x100000         ; 0500001000
000066a3: (                    ): mov [ds:0x18000], ax      ; a300800100
000066a8: (                    ): and dword ptr [ds:0x18000], 0xfffff000 ; 81250080010000f0ffff
000066b2: (                    ): cmp dword ptr [ds:0x18000], 0x1000000 ; 813d0080010000000001
000066bc: (                    ): jle 0x66c8                ; 7e0a
000066be: (                    ): mov dword ptr [ds:0x18000], 0x1000000 ; c7050080010000000001
000066c8: (                    ): cmp dword ptr [ds:0x18000], 0xc00000 ; 813d008001000000c000
000066d2: (                    ): jle 0x66e0                ; 7e0c
000066d4: (                    ): mov dword ptr [ds:0x18004], 0x400000 ; c7050480010000004000
000066de: (                    ): jmp 0x6702                ; eb22
000066e0: (                    ): cmp dword ptr [ds:0x18000], 0x600000 ; 813d0080010000006000
000066ea: (                    ): jle 0x66f8                ; 7e0c
000066ec: (                    ): mov dword ptr [ds:0x18004], 0x200000 ; c7050480010000002000
000066f6: (                    ): jmp 0x6702                ; eb0a
000066f8: (                    ): mov dword ptr [ds:0x18004], 0x100000 ; c7050480010000001000
00006702: (                    ): mov ecx, dword ptr [ds:0x18004] ; 8b0d04800100
00006708: (                    ): mov dword ptr [ds:0x18008], ecx ; 890d08800100
0000670e: (                    ): push dword ptr [ds:0x18000] ; ff3500800100
00006714: (                    ): push dword ptr [ds:0x18004] ; ff3504800100
0000671a: (                    ): call 0xba30               ; e811530000
0000671f: (                    ): call 0x8e94               ; e870270000
00006724: (                    ): call 0x11244              ; e81bab0000
00006729: (                    ): call 0x14efc              ; e8cee70000
0000672e: (                    ): call 0x145dc              ; e8a9de0000
00006733: (                    ): call 0x64b8               ; e880fdffff
00006738: (                    ): call 0x72bc               ; e87f0b0000
0000673d: (                    ): push dword ptr [ds:0x18004] ; ff3504800100
00006743: (                    ): call 0xd55c               ; e8146e0000
00006748: (                    ): call 0x14028              ; e8dbd80000
0000674d: (                    ): call 0x12db0              ; e85ec60000
00006752: (                    ): sti                       ; fb
00006753: (                    ): mov eax, esp              ; 89e0
00006755: (                    ): push 0x17                 ; 6a17
00006757: (                    ): push eax                  ; 50
00006758: (                    ): pushf                     ; 9c
00006759: (                    ): push 0xf                  ; 6a0f
0000675b: (                    ): push 0x6761               ; 6861670000
00006760: (                    ): iret                      ; cf              move_to_user_mode()
00006761: (                    ): mov eax, 0x17             ; b817000000
00006766: (                    ): opsize mov ds, ax         ; 668ed8
00006769: (                    ): opsize mov es, ax         ; 668ec0
0000676c: (                    ): opsize mov fs, ax         ; 668ee0
0000676f: (                    ): opsize mov gs, ax         ; 668ee8
00006772: (                    ): add esp, 0xc              ; 83c40c
00006775: (                    ): mov eax, 0x2              ; b802000000
0000677a: (                    ): int 0x80                  ; cd80               fork()
0000677c: (                    ): test eax, eax             ; 85c0
0000677e: (                    ): jnl 0x678c                ; 7d0c
00006780: (                    ): neg eax                   ; f7d8
00006782: (                    ): mov [ds:0x1fae4], ax      ; a3e4fa0100
00006787: (                    ): mov eax, 0xffffffff       ; b8ffffffff
0000678c: (                    ): test eax, eax             ; 85c0
0000678e: (                    ): jnz 0x6795                ; 7505
00006790: (                    ): call 0x6884               ; e8ef000000          init()
00006795: (                    ): mov edx, 0x1fae4          ; bae4fa0100
0000679a: (                    ): mov eax, 0x1d             ; b81d000000
0000679f: (                    ): int 0x80                  ; cd80
000067a1: (                    ): test eax, eax             ; 85c0
000067a3: (                    ): jnl 0x679a                ; 7df5
000067a5: (                    ): neg eax                   ; f7d8
000067a7: (                    ): mov dword ptr ds:[edx], eax ; 8902
000067a9: (                    ): jmp 0x679a                ; ebef
000067ab: (                    ): add cl, cl                ; 00c9
000067ad: (                    ): retn                      ; c3
000067ae: (                    ): add byte ptr ds:[eax], al ; 0000
000067b0: (                    ): push ebx                  ; 53
000067b1: (                    ): lea eax, dword ptr ss:[esp+0xc] ; 8d44240c
000067b5: (                    ): push eax                  ; 50
000067b6: (                    ): push dword ptr ss:[esp+0xc] ; ff74240c
000067ba: (                    ): push 0x1d1e0              ; 68e0d10100
000067bf: (                    ): call 0x99e4               ; e820320000
000067c4: (                    ): mov ebx, eax              ; 89c3
000067c6: (                    ): push ebx                  ; 53
000067c7: (                    ): push 0x1d1e0              ; 68e0d10100
000067cc: (                    ): push 0x1                  ; 6a01
000067ce: (                    ): call 0x171e0              ; e80d0a0100

<bochs:7> b 0x6884
<bochs:8> c
(0) Breakpoint 3, 0x4006884 in ?? ()
Next at t=16797174
(0) [0x00006884] 000f:00006884 (unk. ctxt): push ebp                  ; 55
<bochs:9> u /50
04006884: (                    ): push ebp                  ; 55
04006885: (                    ): mov ebp, esp              ; 89e5
04006887: (                    ): sub esp, 0x4              ; 83ec04
0400688a: (                    ): push edi                  ; 57
0400688b: (                    ): push esi                  ; 56
0400688c: (                    ): push ebx                  ; 53
0400688d: (                    ): xor eax, eax              ; 31c0
0400688f: (                    ): mov ebx, 0x1dd6c          ; bb6cdd0100
04006894: (                    ): int 0x80                  ; cd80             setup()
04006896: (                    ): test eax, eax             ; 85c0
04006898: (                    ): jnl 0x40068a1             ; 7d07
0400689a: (                    ): neg eax                   ; f7d8
0400689c: (                    ): mov [ds:0x1fae4], ax      ; a3e4fa0100
040068a1: (                    ): push 0x0                  ; 6a00
040068a3: (                    ): push 0x2                  ; 6a02
040068a5: (                    ): push 0x6801               ; 6801680000
040068aa: (                    ): call 0x4017198            ; e8e9080100
040068af: (                    ): push 0x0                  ; 6a00
040068b1: (                    ): call 0x4017208            ; e852090100
040068b6: (                    ): push 0x0                  ; 6a00
040068b8: (                    ): call 0x4017208            ; e84b090100
040068bd: (                    ): mov eax, [ds:0x1a960]     ; a160a90100
040068c2: (                    ): shl eax, 0xa              ; c1e00a
040068c5: (                    ): push eax                  ; 50
040068c6: (                    ): push dword ptr [ds:0x1a960] ; ff3560a90100
040068cc: (                    ): push 0x680b               ; 680b680000
040068d1: (                    ): call 0x40067b0            ; e8dafeffff
040068d6: (                    ): add esp, 0x20             ; 83c420
040068d9: (                    ): mov eax, [ds:0x18000]     ; a100800100
040068de: (                    ): sub eax, dword ptr [ds:0x18008] ; 2b0508800100
040068e4: (                    ): push eax                  ; 50
040068e5: (                    ): push 0x6830               ; 6830680000
040068ea: (                    ): call 0x40067b0            ; e8c1feffff
040068ef: (                    ): add esp, 0x8              ; 83c408
040068f2: (                    ): mov eax, 0x2              ; b802000000
040068f7: (                    ): int 0x80                  ; cd80
040068f9: (                    ): test eax, eax             ; 85c0
040068fb: (                    ): jl 0x4006904              ; 7c07
040068fd: (                    ): mov edi, eax              ; 89c7
040068ff: (                    ): jmp 0x4006910             ; eb0f
04006901: (                    ): add byte ptr ds:[eax], al ; 0000
04006903: (                    ): add bh, dh                ; 00f7
04006905: (                    ): fsub dword ptr ds:[ebx+0x1fae4] ; d8a3e4fa0100
0400690b: (                    ): mov edi, 0xffffffff       ; bfffffffff
04006910: (                    ): test edi, edi             ; 85ff
04006912: (                    ): jnz 0x4006954             ; 7540
04006914: (                    ): push 0x0                  ; 6a00
04006916: (                    ): call 0x40171c0            ; e8a5080100
0400691b: (                    ): push 0x0                  ; 6a00
0400691d: (                    ): push 0x0                  ; 6a00
<bochs:10>

你可能感兴趣的:(main,init,setup,linux-0.11,调试教程)