6.828: Operating System Engineering (86)

gdb で確認できない (割り込みで停まらない) ので困っていたのですが、Homework: xv6 and Interrupts and Exceptions の以下の記述に沿ってリトライしてみます。

Assignment
In xv6, set a breakpoint at the first instruction of syscall() to catch the very first system call (e.g., br syscall). What values are on the stack at this point?
Submit: The output of x/37x $esp at that breakpoint with each value labeled as to what it is (e.g., saved %ebp for trap, trapframe.eip, scratch space, etc.). If your stack dump doesn't reach a page boundary, you'll have to print more than 37 words.

syscall.c の syscall() 手続きか。

(gdb) list syscall
122     [SYS_uptime]  sys_uptime,
123     };
124
125     void
126     syscall(void)
127     {
128       int num;
129       
130       num = proc->tf->eax;
131       if(num >= 0 && num < NELEM(syscalls) && syscalls[num])
(gdb) b 130
Breakpoint 1 at 0x103f77: file syscall.c, line 130.
(gdb) c
Continuing.

停まらないorz
何か見落としてるのかなぁ。物凄いナチュラルをカマしている気がしますのでもっかい諸々確認してみます。

そもそも

syscall() 手続きは trap() 手続きから呼び出されてるので trap() で停まらん、ということが分かってる時点でアレ。

tvinit() 手続き呼び出し直後で

p idt[32], then set a breakpoint at vector32

すりゃ良いのかな。その後に vector32 じゃなくて syscall() で云々なのかどうか。

以下がナニ。

(gdb) list mainc
38
39      // Set up hardware and software.
40      // Runs only on the boostrap processor.
41      void
42      mainc(void)
43      {
44        cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
45        picinit();       // interrupt controller
46        ioapicinit();    // another interrupt controller
47        consoleinit();   // I/O devices & their interrupts
(gdb) list
48        uartinit();      // serial port
49        kvmalloc();      // initialize the kernel page table
50        pinit();         // process table
51        tvinit();        // trap vectors
52        binit();         // buffer cache
53        fileinit();      // file table
54        iinit();         // inode cache
55        ideinit();       // disk
56        if(!ismp)
57          timerinit();   // uniprocessor timer
(gdb) b 51
Breakpoint 1 at 0x102790: file main.c, line 51.
(gdb) c
Continuing.

停まらない。これってやっぱコンパイルスイッチが微妙なのではないかと。さすがに上記はコンテキスト云々とは別問題なので。
やっぱナチュラルだったかorz