int
)%idtr
: point to the base address of IDTss0
& esp0
iret
: user → kerneldiv 1 0
: user → kernel
idivl
againb vector0
x/6x $esp
when entering kernelstruct trapframe
man signal
int z = 0; ticks = ticks / z;
to idtinit()
b vector0
x/6x $esp
eip
/cs
/eflags
; no ss
/esp
for kernel → kerneldiv.c
: memset
somethingb vector14
x/6x $esp
kern/trap.c
int 0x40
(64)usys.S
(user) and syscall.c
(kernel)gcc -nostdlib
strace
#include <sys/syscall.h>
#include <unistd.h>
void _start(void)
{
int fd = 1;
char buf[] = "hello world!\n";
size_t count = sizeof(buf) - 1;
asm volatile ("int $0x80"
: /* ignore output */
: "a"(__NR_write), "b"(fd), "c"(buf), "d"(count)
: "cc", "edi", "esi", "memory"
);
asm volatile ("int $0x80"
: /* no output */
: "a"(__NR_exit), "b"(0)
);
}
sysenter
/syscall
instructions (lab3 challenge)gettimeofday
int
int $14
from user space to confuse the kernel?