Changeset 12644


Ignore:
Timestamp:
Aug 22, 2009, 1:58:31 AM (10 years ago)
Author:
rme
Message:

Clean up x86-exceptions.c a little bit by getting rid of some
X8632/X8664 conditionalization.

This is done by introducting a register index Ifp which is used
in lieu of Irbp or Iebp. (We already do a similar thing with Isp.)

Also rename the tcr field save_rbp/save_ebp to save_fp and update
users acccordingly.

These changes are (theoretically) cosmetic only.

Location:
trunk/source/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-constants32.h

    r11710 r12644  
    7474#define Inargs Itemp1
    7575#define Ixfn Itemp1
     76#define Ifp Iebp
    7677
    7778/* MMX register offsets from where mm0 is found in uc_mcontext.fs */
     
    424425  LispObj save2;
    425426  LispObj save3;
    426   LispObj *save_ebp;            /* EBP when in foreign code */
     427  LispObj *save_fp;             /* EBP when in foreign code */
    427428  u32_t lisp_mxcsr;
    428429  u32_t foreign_mxcsr;
  • trunk/source/lisp-kernel/x86-constants64.h

    r11675 r12644  
    109109#define Inargs Iimm2
    110110#define Ixfn Itemp1
     111#define Ifp Irbp
    111112
    112113
     
    484485  } single_float_convert;
    485486  struct tcr* linear;
    486   LispObj *save_rbp;            /* RBP when in foreign code */
     487  LispObj *save_fp;            /* RBP when in foreign code */
    487488  u32_t lisp_mxcsr;
    488489  u32_t foreign_mxcsr;
  • trunk/source/lisp-kernel/x86-exceptions.c

    r12601 r12644  
    480480  push_on_lisp_stack(xp,nominal_function);
    481481  push_on_lisp_stack(xp,0);
    482 #ifdef X8664
    483   push_on_lisp_stack(xp,xpGPR(xp,Irbp));
    484   xpGPR(xp,Irbp) = xpGPR(xp,Isp);
    485 #else
    486   push_on_lisp_stack(xp,xpGPR(xp,Iebp));
    487   xpGPR(xp,Iebp) = xpGPR(xp,Isp);
    488 #endif
     482  push_on_lisp_stack(xp,xpGPR(xp,Ifp));
     483  xpGPR(xp,Ifp) = xpGPR(xp,Isp);
    489484  return xpGPR(xp,Isp);
    490485}
     
    597592
    598593  /* Put the active stack pointers where .SPcallback expects them */
    599 #ifdef X8664
    600   tcr->save_vsp = (LispObj *) xpGPR(xp, Isp);
    601   tcr->save_rbp = (LispObj *) xpGPR(xp, Irbp);
    602 #else
     594#ifdef X8632
    603595  tcr->node_regs_mask = X8632_DEFAULT_NODE_REGS_MASK;
    604596
     
    609601  *--vsp = tcr->next_method_context;
    610602  xpGPR(xp, Isp) = (LispObj)vsp;
    611 
     603#endif
    612604  tcr->save_vsp = (LispObj *)xpGPR(xp, Isp);
    613   tcr->save_ebp = (LispObj *)xpGPR(xp, Iebp);
    614 #endif
     605  tcr->save_fp = (LispObj *)xpGPR(xp, Ifp);
    615606
    616607  /* Call back.  The caller of this function may have modified stack/frame
     
    643634  LispObj *save_vsp = (LispObj *)xpGPR(xp,Isp),
    644635    word_beyond_vsp = save_vsp[-1],
    645 #ifdef X8664
    646     save_rbp = xpGPR(xp,Irbp),
    647 #else
    648     save_ebp = xpGPR(xp,Iebp),
    649 #endif
     636    save_fp = xpGPR(xp,Ifp),
    650637    xcf = create_exception_callback_frame(xp, tcr);
    651638  int save_errno = errno;
    652639
    653640  callback_to_lisp(tcr, nrs_CMAIN.vcell,xp, xcf, 0, 0, 0, 0);
    654 #ifdef X8664
    655   xpGPR(xp,Irbp) = save_rbp;
    656 #else
    657   xpGPR(xp,Iebp) = save_ebp;
    658 #endif
     641  xpGPR(xp,Ifp) = save_fp;
    659642  xpGPR(xp,Isp) = (LispObj)save_vsp;
    660643  save_vsp[-1] = word_beyond_vsp;
     
    668651  unsigned char op0 = program_counter[0], op1 = program_counter[1];
    669652  LispObj rpc, errdisp = nrs_ERRDISP.vcell,
    670     save_vsp = xpGPR(xp,Isp), xcf0;
    671 #ifdef X8664
    672   LispObj save_rbp = xpGPR(xp,Irbp);
    673 #else
    674   LispObj save_ebp = xpGPR(xp,Iebp);
    675 #endif
     653    save_vsp = xpGPR(xp,Isp), xcf0,
     654    save_fp = xpGPR(xp,Ifp);
    676655  int skip;
    677656
     
    703682      skip = 0;
    704683    }
    705 #ifdef X8664
    706     xpGPR(xp,Irbp) = save_rbp;
    707 #else
    708     xpGPR(xp,Iebp) = save_ebp;
    709 #endif
     684    xpGPR(xp,Ifp) = save_fp;
    710685    xpGPR(xp,Isp) = save_vsp;
    711686    if ((op0 == 0xcd) && (op1 == 0xc7)) {
     
    721696      */
    722697      LispObj *vsp =(LispObj *)save_vsp, ra = *vsp;
    723 #ifdef X8664
    724       int nargs = (xpGPR(xp, Inargs) & 0xffff)>>fixnumshift;
    725 #else
    726698      int nargs = xpGPR(xp, Inargs)>>fixnumshift;
    727 #endif
    728699
    729700#ifdef X8664
     
    793764  lisp_protection_kind which = prot_area->why;
    794765  Boolean on_TSP = (which == kTSPsoftguard);
    795 #ifdef X8664
    796   LispObj save_rbp = xpGPR(xp,Irbp);
    797 #else
    798   LispObj save_ebp = xpGPR(xp,Iebp);
    799 #endif
     766  LispObj save_fp = xpGPR(xp,Ifp);
    800767  LispObj save_vsp = xpGPR(xp,Isp),
    801768    xcf,
     
    816783    unprotect_area(soft);
    817784    xcf = create_exception_callback_frame(xp, tcr);
    818     skip = callback_to_lisp(tcr, nrs_CMAIN.vcell, xp, xcf, SIGSEGV, on_TSP, 0, 0);
    819 #ifdef X8664
    820     xpGPR(xp,Irbp) = save_rbp;
    821 #else
    822     xpGPR(xp,Iebp) = save_ebp;
    823 #endif
     785    skip = callback_to_lisp(tcr, cmain, xp, xcf, SIGSEGV, on_TSP, 0, 0);
     786    xpGPR(xp,Ifp) = save_fp;
    824787    xpGPR(xp,Isp) = save_vsp;
    825788    xpPC(xp) += skip;
     
    833796{
    834797#ifdef DARWIN
    835 #ifdef X8664
    836798  return (UC_MCONTEXT(xp)->__es.__err & 0x2) != 0;
    837 #else
    838   return (xp->uc_mcontext->__es.__err & 0x2) != 0;
    839 #endif
    840799#endif
    841800#if defined(LINUX) || defined(SOLARIS)
     
    907866  int code,skip;
    908867  LispObj  xcf, cmain = nrs_CMAIN.vcell,
    909     save_vsp = xpGPR(xp,Isp);
    910 #ifdef X8664
    911   LispObj save_rbp = xpGPR(xp,Irbp);
    912 #else
    913   LispObj save_ebp = xpGPR(xp,Iebp);
    914 #endif
     868    save_vsp = xpGPR(xp,Isp),
     869    save_fp = xpGPR(xp,Ifp);
    915870#ifdef WINDOWS
    916871  code = info->ExceptionCode;
     
    924879    skip = callback_to_lisp(tcr, cmain, xp, xcf, SIGFPE, code, 0, 0);
    925880    xpPC(xp) += skip;
    926 #ifdef X8664
    927     xpGPR(xp,Irbp) = save_rbp;
    928 #else
    929     xpGPR(xp,Iebp) = save_ebp;
    930 #endif
     881    xpGPR(xp,Ifp) = save_fp;
    931882    xpGPR(xp,Isp) = save_vsp;
    932883    return true;
     
    14411392{
    14421393  ExceptionInformation *xp;
    1443   LispObj *bp;
     1394  LispObj *fp;
    14441395
    14451396  if (tcr->pending_exception_context)
     
    14511402  }
    14521403  if (xp) {
    1453 #ifdef X8664
    1454     bp = (LispObj *) xpGPR(xp, Irbp);
    1455 #else
    1456     bp = (LispObj *) xpGPR(xp, Iebp);
    1457 #endif
     1404    fp = (LispObj *)xpGPR(xp, Ifp);
    14581405  } else {
    1459 #ifdef X8664
    1460     bp = tcr->save_rbp;
    1461 #else
    1462     bp = tcr->save_ebp;
    1463 #endif
    1464   }
    1465   return bp;
     1406    fp = tcr->save_fp;
     1407  }
     1408  return fp;
    14661409}
    14671410
     
    16621605        (tcr->unwinding != 0) ||
    16631606        ! stack_pointer_on_vstack_p(xpGPR(context,Isp), tcr) ||
    1664 #ifdef X8664
    1665         ! stack_pointer_on_vstack_p(xpGPR(context,Irbp), tcr)) {
    1666 #else
    1667         ! stack_pointer_on_vstack_p(xpGPR(context,Iebp), tcr)) {
    1668 #endif
     1607        ! stack_pointer_on_vstack_p(xpGPR(context,Ifp), tcr)) {
    16691608      tcr->interrupt_pending = (((natural) 1)<< (nbits_in_word - ((natural)1)));
    16701609    } else {
  • trunk/source/lisp-kernel/xlbt.c

    r11623 r12644  
    138138
    139139void
    140 plbt_sp(LispObj currentRBP)
     140plbt_sp(LispObj current_fp)
    141141{
    142142  area *vs_area, *cs_area;
    143  
    144 {
    145     TCR *tcr = (TCR *)get_tcr(true);
    146     char *ilevel = interrupt_level_description(tcr);
    147     vs_area = tcr->vs_area;
    148     cs_area = tcr->cs_area;
    149     if ((((LispObj) ptr_to_lispobj(vs_area->low)) > currentRBP) ||
    150         (((LispObj) ptr_to_lispobj(vs_area->high)) < currentRBP)) {
    151 #ifdef X8664
    152       currentRBP = (LispObj) (tcr->save_rbp);
    153 #else
    154       currentRBP = (LispObj) (tcr->save_ebp);
    155 #endif
    156     }
    157     if ((((LispObj) ptr_to_lispobj(vs_area->low)) > currentRBP) ||
    158         (((LispObj) ptr_to_lispobj(vs_area->high)) < currentRBP)) {
    159       Dprintf("\nFramepointer [#x%lX] in unknown area.", currentRBP);
    160     } else {
    161       fprintf(dbgout, "current thread: tcr = 0x%lx, native thread ID = 0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
    162       walk_stack_frames((lisp_frame *) ptr_from_lispobj(currentRBP), (lisp_frame *) (vs_area->high));
    163       /*      walk_other_areas();*/
    164     }
    165   }
     143  TCR *tcr = (TCR *)get_tcr(true);
     144  char *ilevel = interrupt_level_description(tcr);
     145
     146  vs_area = tcr->vs_area;
     147  cs_area = tcr->cs_area;
     148  if ((((LispObj) ptr_to_lispobj(vs_area->low)) > current_fp) ||
     149      (((LispObj) ptr_to_lispobj(vs_area->high)) < current_fp)) {
     150    current_fp = (LispObj) (tcr->save_fp);
     151  }
     152  if ((((LispObj) ptr_to_lispobj(vs_area->low)) > current_fp) ||
     153      (((LispObj) ptr_to_lispobj(vs_area->high)) < current_fp)) {
     154    Dprintf("\nFrame pointer [#x" LISP "] in unknown area.", current_fp);
     155  } else {
     156    fprintf(dbgout, "current thread: tcr = 0x" LISP ", native thread ID = 0x" LISP ", interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
     157    walk_stack_frames((lisp_frame *) ptr_from_lispobj(current_fp), (lisp_frame *) (vs_area->high));
     158    /*      walk_other_areas();*/
     159  }
    166160}
    167161
Note: See TracChangeset for help on using the changeset viewer.