示例#1
0
void
random_trap (int trap, int errcode)
{
  tfp tf;

  printf ("just got TRAP %d in env 0x%x on CPU %d", trap,
	  curenv ? curenv->env_id : -1, cpu_id);

  if (trap >= 8 && trap < 32) {
    printf ("; error code = 0x%x\n", errcode);
    tfp_set (tf, errcode, tf_edx);
  }
  else {
    printf ("\n");
    tfp_set (tf, trap, tf_edx);
  }

  printf ("  eip = 0x%x;", tf->tf_eip);
  printf (" cs = 0x%x;", tf->tf_cs & 0xffff);
  printf (" eflags = 0x%x\n", tf->tf_eflags);
  printf ("  esp = 0x%x;", tf->tf_esp);
  printf (" ebp = 0x%x;", tf->tf_ebp);
  printf (" ss = 0x%x;", tf->tf_ss & 0xffff);
  printf (" ds = 0x%x;", tf->tf_ds & 0xffff);
  printf (" es = 0x%x\n", tf->tf_es & 0xffff);

  if (tf->tf_cs == GD_KT && trap == 13) {
    tfp t = &curenv->env_tf;
    struct seg_desc *dp;
    printf ("TF: eip = 0x%x, esp = 0x%x, cs = 0x%x, ss = 0x%x\n",
	    t->tf_eip, t->tf_esp, t->tf_cs, t->tf_ss);
    dp = &gdt[t->tf_cs >> 3];
    printf ("CS:  type: 0x%x, base: 0x%x, lim: 0x%x\n",
	    dp->sd_type, ((dp->sd_base_31_24 << 24)
			  | (dp->sd_base_23_16 << 16) | dp->sd_base_15_0),
	    (dp->sd_lim_19_16 << 16) | dp->sd_lim_15_0);
    dp = &gdt[t->tf_ss >> 3];
    printf ("SS:  type: 0x%x, base: 0x%x, lim: 0x%x\n",
	    dp->sd_type, ((dp->sd_base_31_24 << 24)
			  | (dp->sd_base_23_16 << 16) | dp->sd_base_15_0),
	    (dp->sd_lim_19_16 << 16) | dp->sd_lim_15_0);
  }
示例#2
0
  __XOK_SYNC(UAREA only modified when localized)
{
  int stat;

  irq_eoi (8);

  /* MUST read to acknowledge the interrupt */
  stat = mc146818_read(NULL, MC_REGC);
  if (stat & MC_REGC_PF) 
    {
      if ((!UAREA.u_pendrtc) && UAREA.u_entrtc)
	{
	  tfp tf;
	  u_int *esp;
	  u_int tt_eip;
	  u_int old_pfm = page_fault_mode;
	  tfp_set (tf, trapno, tf_edi);

	  tt_eip = tf->tf_eip; /* trap time eip */

	  /* copy interrupt stack frame on to user stack */
	  page_fault_mode = PFM_PROP;
	  tf->tf_esp -= 12;
	  esp = trup ((u_int *)tf->tf_esp);
	  esp[2] = tf->tf_eflags;
	  esp[1] = tf->tf_cs;
	  esp[0] = tf->tf_eip;
	  page_fault_mode = old_pfm;

	  tf->tf_eip = UAREA.u_entrtc;
	  UAREA.u_pendrtc = 1; 

	  env_upcall();
	}
    }
}