int
instruction)div.c
on xv6Makefile
: change -O2
to -O0
; add _div
to UPROGS
pid 4 div: trap 0 err 0 on cpu 0 eip 0x62 addr 0x0--kill proc
trap()
?struct trapframe
from?
alltraps
in trapasm.S
vector0
, …, vector255
in vectors.S
trap.c
for setting up the idt
traps.h
%idtr
register: base address of IDTcs:offset
: entry pointtype
%eflags
%eflags
trap.c
: tvinit()
- SETGATE
, idtinit()
- lidt
vectors.S
b idtinit
p/x idt[0]
source gdbutil
& printdesc idt[0]
div.asm
and find the idivl
instruction (e.g., at 0x62
)idivl
(e.g., b *0x62
)info registers
: esp. cs
& esp
cs
si
x/6x $esp
trap()
: who set tf->trapno
case T_DIVIDE: return;
and single-step until iret
idivl