trap()
? where is struct trapframe
from?
alltraps
in trapasm.S
vector0
, …, vector255
in vectors.S
%cs
registerinit
) and more
int
instruction)div.c
on xv6 and trigger division by zero%idtr
register: base address of IDTcs:offset
: entry pointtype
%eflags
%eflags
trap.c
: tvinit()
- SETGATE
, idtinit()
- lidt
vectors.S
: can we use one entry instead of 256 entries?b idtinit
p/x idt[0]
source gdbutil
& printdesc idt[0]
vm.c
: switchuvm()
- ss0
and esp0
div.asm
and find the idivl
instruction (e.g., at 0x62
)idivl
(e.g., b *0x62
)info registers
: esp. cs
& esp
si
x/6x $esp
trap()
: who set tf->trapno
case T_DIVIDE: return;
and single-step until iret
idivl