6.828: Operating System Engineering (11)
昨晩のエントリを見直してみたのですが、あまりの gdgd っぷりにびっくり仰天。とりあえず晩メシ担当の作業は完了したので確認作業着手。現時点でスデに酒が入っているので gdgd になる可能性は大きいッス。
起動
端末でカレントディレクトリを 6.828/lab にしといて
$ make qemu-gdb *** *** Now run 'gdb'. *** /opt/bin/qemu -hda obj/kern/kernel.img -serial mon:stdio -S -gdb tcp::26000
で、screen でもう一枚端末作ってカレントを 6.828/lab にして gdb 起動。
$ gdb GNU gdb (GDB) 7.2-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. + target remote localhost:26000 The target architecture is assumed to be i8086 [f000:fff0] 0xffff0: ljmp $0xf000,$0xe05b 0x0000fff0 in ?? () + symbol-file obj/kern/kernel (gdb) b *0x7c00 Breakpoint 1 at 0x7c00 (gdb) c Continuing. [ 0:7c00] => 0x7c00: cli Breakpoint 1, 0x00007c00 in ?? () (gdb)
で、とりあえず何を要求されてるのか、をもう少しきちんと確認した方が良いな。ちなみに動かすだけであれば obj/boot/boot.asm 見ればなんとかなりそう。
とりあえず、*0x7d7a に breakpoint 張ったんですが、そのまま si してみるか。
7d7a: a1 18 00 01 00 mov 0x10018,%eax 7d7f: 25 ff ff ff 00 and $0xffffff,%eax 7d84: ff d0 call *%eax
上記は boot.asm の該当部分。gdb なソレが以下です。
(gdb) b *0x7d7a Breakpoint 2 at 0x7d7a (gdb) c Continuing. => 0x7d7a: mov 0x10018,%eax Breakpoint 2, 0x00007d7a in ?? () (gdb) si => 0x7d7f: and $0xffffff,%eax 0x00007d7f in ?? () (gdb) si => 0x7d84: call *%eax 0x00007d84 in ?? () (gdb) si => 0x10000c: movw $0x1234,0x472 0x0010000c in ?? () (gdb)
上記の jmp 先は obj/kern/kernel.asm によれば _start なナニ。
.globl _start _start: movw $0x1234,0x472 # warm boot
うーん。流れてきにはビンゴな気がするけど細かい部分でダウト感満点。