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#include "types.h"
#include "user.h"
int
main(int argc, char **argv)
{
int x, y, z;
if (argc < 3){
printf(2, "usage: div x y\n");
exit();
}
x = atoi(argv[1]);
y = atoi(argv[2]);
z = x / y;
printf(1, "%d / %d = %d\n", x, y, z);
exit();
}%idtr register: base address of IDTcs:offset: entry pointtype
%eflags%eflagstrap.c: tvinit() - SETGATE, idtinit() - lidtvectors.S: can we use one entry instead of 256 entries?b idtinitp/x idt[0]source gdbutil & printdesc idt[0]vm.c: switchuvm() - ss0 and esp0div.asm and find the idivl instruction (e.g., at 0x62)idivl (e.g., b *0x62)info registers: esp. cs & espsix/6x $esptrap(): who set tf->trapnocase T_DIVIDE: return; and single-step until iretidivl