Ejemplo n.º 1
0
/*
 * Trap handler
 * Invoke the exception handler if it is needed.
 */
void
trap_handler(struct cpu_regs *regs)
{
	uint32_t trap_no = regs->trap_no;

#ifdef CONFIG_MMU
	switch (trap_no) {
	case TRAP_DATA_TLB_MISS:
	case TRAP_INST_TLB_MISS:
		handle_tlb_miss(regs);
		return;
	};
#endif
#ifdef DEBUG
	printf("============================\n");
	printf("Trap %x: %s\n", trap_no, trap_name[trap_no]);
	printf("============================\n");

	trap_dump(regs);
	for (;;) ;
#endif
	if ((regs->srr1 & MSR_PR) != MSR_PR)
		panic("Kernel exception");

	exception_mark(exception_map[trap_no]);
	exception_deliver();
}
Ejemplo n.º 2
0
void trap_dump_die(struct trap_state *st)
{
	about_to_die(1);

	trap_dump(st);

	die("terminated due to trap\n");
}
Ejemplo n.º 3
0
void
context_dump(context_t ctx)
{

#ifdef DEBUG
	trap_dump(ctx->uregs);
#endif
}
Ejemplo n.º 4
0
void default_exception_handler(tf_t *tf)
{
	unsigned int cur_pid;

	cur_pid = get_curid();
	trap_dump(tf);

	KERN_PANIC("Trap %d @ 0x%08x.\n", tf -> trapno, tf -> eip);
}
Ejemplo n.º 5
0
void pgflt_handler(tf_t *tf)
{
	unsigned int cur_pid;
	unsigned int errno;
	unsigned int fault_va;

	cur_pid = get_curid();
	errno = tf -> err;
	fault_va = rcr2();

  //Uncomment this line if you need to see the information of the sequence of page faults occured.
	//KERN_DEBUG("Page fault: VA 0x%08x, errno 0x%08x, process %d, EIP 0x%08x.\n", fault_va, errno, cur_pid, tf -> eip);

	if (errno & PFE_PR) {
		trap_dump(tf);
		KERN_PANIC("Permission denied: va = 0x%08x, errno = 0x%08x.\n", fault_va, errno);
		return;
	}

	if (alloc_page(cur_pid, fault_va, PTE_W | PTE_U | PTE_P) == MagicNumber)
    KERN_PANIC("Page allocation failed: va = 0x%08x, errno = 0x%08x.\n", fault_va, errno);

}
Ejemplo n.º 6
0
void base_irq_softint_default_handler(struct trap_state *ts)
{
	trap_dump(ts);
	panic("unexpected software interrupt");
}