Esempio n. 1
0
static void
trap_dispatch(struct Trapframe *tf)
{

	// Handle processor exceptions.
	// LAB 3: Your code here.
//----------------------------------------  Lab3  ------------------------------------------------------------
    if (tf->tf_trapno == T_PGFLT) {
        //cprintf("pagefault!\n");
        page_fault_handler(tf);
        return;
    }
    if (tf->tf_trapno == T_BRKPT) {
        //cprintf("brkpt!\n");
        monitor(tf);
        return;
    }
    if (tf->tf_trapno == T_DEBUG) {
        my_monitor(tf);
        return;
    }
    if (tf->tf_trapno == T_SYSCALL) {
        //cprintf("Syscall!\n");
        tf->tf_regs.reg_eax = syscall(tf->tf_regs.reg_eax, tf->tf_regs.reg_edx, tf->tf_regs.reg_ecx, 
                              tf->tf_regs.reg_ebx, tf->tf_regs.reg_edi, tf->tf_regs.reg_esi);
        if (tf->tf_regs.reg_eax < 0)
            panic("syscall failed: %e\n", tf->tf_regs.reg_eax);
        return;
    }
//----------------------------------------  Lab3  ------------------------------------------------------------

	// Handle spurious interrupts
	// The hardware sometimes raises these because of noise on the
	// IRQ line or other reasons. We don't care.
	if (tf->tf_trapno == IRQ_OFFSET + IRQ_SPURIOUS) {
		cprintf("Spurious interrupt on irq 7\n");
		print_trapframe(tf);
		return;
	}

	// Handle clock interrupts. Don't forget to acknowledge the
	// interrupt using lapic_eoi() before calling the scheduler!
	// LAB 4: Your code here.
//------------  Lab4  ----------------------------------------------------------------------------------------      
	if (tf->tf_trapno == IRQ_OFFSET + IRQ_TIMER) {
		//	cprintf("clock interrupt!\n");
		lapic_eoi();
		sched_yield();
		return;
	}
//------------  Lab4  ----------------------------------------------------------------------------------------      

	// Unexpected trap: The user process or the kernel has a bug.
	print_trapframe(tf);
	if (tf->tf_cs == GD_KT)
		panic("unhandled trap in kernel");
	else {
		env_destroy(curenv);
		return;
	}
}
Esempio n. 2
0
void MonitorWindow::full_redraw() {
  // Do not call  PlatformWindow::full_redraw();
  // It does Begin/End Updates which mess up the spy.
  my_monitor()->full_redraw();
}
Esempio n. 3
0
void MonitorWindow::close() {
  if (pw->is_open())
    pw->close();
  if (my_monitor()->is_active())
    my_monitor()->deactivate(); 
}
Esempio n. 4
0
void MonitorWindow::adjust_after_resize() {
  my_monitor()->adjust_after_resize();
 pw->adjust_after_resize();
}
Esempio n. 5
0
int MonitorWindow::initial_height() { return  my_monitor()->contents_height() + pw->inset_top() + pw->inset_bottom(); }