jos/user/faultbadhandler.c
Anish Athalye da1f8392b1 Lab 4
2018-10-08 21:32:14 -07:00

15 lines
440 B
C

// test bad pointer for user-level fault handler
// this is going to fault in the fault handler accessing eip (always!)
// so eventually the kernel kills it (PFM_KILL) because
// we outrun the stack with invocations of the user-level handler
#include <inc/lib.h>
void
umain(int argc, char **argv)
{
sys_page_alloc(0, (void*) (UXSTACKTOP - PGSIZE), PTE_P|PTE_U|PTE_W);
sys_env_set_pgfault_upcall(0, (void*) 0xDeadBeef);
*(int*)0 = 0;
}