Changeset 6306


Ignore:
Timestamp:
Apr 19, 2007, 6:37:28 AM (15 years ago)
Author:
gb
Message:

Use new scheme for mapping from tra to containing fn.
Needs testing on a machine where gdb/xemacs work ...

Location:
branches/x8664-call/ccl/lisp-kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/x8664-call/ccl/lisp-kernel/x86-exceptions.c

    r6275 r6306  
    316316  tra = xpGPR(xp,Ira0);
    317317  if (tag_of(tra) == tag_tra) {
    318     tra_f = tra - ((int *)tra)[-1];
     318    if ((*((unsigned short *)tra) == RECOVER_FN_FROM_RIP_WORD0) &&
     319        (*((unsigned char *)(tra+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     320      int sdisp = (*(int *) (tra+3));
     321      tra_f = RECOVER_FN_FROM_RIP_LENGTH+tra+sdisp;
     322    }
    319323    if (fulltag_of(tra_f) != fulltag_function) {
    320324      tra_f = 0;
  • branches/x8664-call/ccl/lisp-kernel/x86-exceptions.h

    r6219 r6306  
    151151void setup_sigaltstack(area *);
    152152#endif
     153
     154/* recognizing the function associated with a tagged return address */
     155/* now involves recognizinig an "(lea (@ disp (% rip)) (% rn))" */
     156/* instruction at the tra */
     157
     158#define RECOVER_FN_FROM_RIP_LENGTH 7 /* the instruction is 7 bytes long */
     159#define RECOVER_FN_FROM_RIP_DISP_OFFSET 3 /* displacement word is 3 bytes in */
     160#define RECOVER_FN_FROM_RIP_WORD0 0x8d4c /* 0x4c 0x8d, little-endian */
     161#define RECOVER_FN_FROM_RIP_BYTE2 0x2d  /* third byte of opcode */
  • branches/x8664-call/ccl/lisp-kernel/x86-gc.c

    r5963 r6306  
    291291
    292292  if (tag_of(n) == tag_tra) {
    293     n = n - (((int *)n)[-1]);
    294     tag_n = fulltag_function;
     293    if ((*((unsigned short *)n) == RECOVER_FN_FROM_RIP_WORD0) &&
     294        (*((unsigned char *)(n+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     295      int sdisp = (*(int *) (n+3));
     296      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
     297      tag_n = fulltag_function;
     298    }
     299    else {
     300      return;
     301    }
    295302  }
    296303
     
    456463
    457464  if (tag_of(n) == tag_tra) {
    458     n -= ((int *)n)[-1];
    459     tag_n = fulltag_function;   
     465    if ((*((unsigned short *)n) == RECOVER_FN_FROM_RIP_WORD0) &&
     466        (*((unsigned char *)(n+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     467      int sdisp = (*(int *) (n+3));
     468      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
     469      tag_n = fulltag_function;
     470    } else {
     471      return;
     472    }
    460473  }
    461474
     
    710723    if ((tag_n == fulltag_tra_0) ||
    711724        (tag_n == fulltag_tra_1)) {
    712       int disp = ((int *)n)[-1];
     725      int disp = (*(int *) (n+3)) + RECOVER_FN_FROM_RIP_LENGTH;
    713726
    714727      base = (LispObj *) (untag(n-disp));
  • branches/x8664-call/ccl/lisp-kernel/x86_print.c

    r5323 r6306  
    317317sprint_tra(LispObj o, int depth)
    318318{
    319   unsigned disp = *(((unsigned *)o)-1);
    320   LispObj f = o-disp;
     319  signed sdisp;
     320  unsigned disp;
     321  LispObj f = 0;
     322
     323  if ((*((unsigned short *)o) == RECOVER_FN_FROM_RIP_WORD0) &&
     324      (*((unsigned char *)(o+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     325    sdisp = (*(int *) (o+3));
     326    f = RECOVER_FN_FROM_RIP_LENGTH+o+sdisp;
     327    disp = o-f;
     328  }
    321329
    322330  if (fulltag_of(f) == fulltag_function) {
  • branches/x8664-call/ccl/lisp-kernel/xlbt.c

    r4581 r6306  
    2727print_lisp_frame(lisp_frame *frame)
    2828{
    29   LispObj pc = frame->tra, fun;
     29  LispObj pc = frame->tra, fun=0;
    3030  int delta = 0;
    3131
     
    3434  }
    3535  if (tag_of(pc) == tag_tra) {
    36     fun = pc - (((unsigned *)pc)[-1]);
     36    if ((*((unsigned short *)pc) == RECOVER_FN_FROM_RIP_WORD0) &&
     37        (*((unsigned char *)(pc+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     38      int sdisp = (*(int *) (pc+3));
     39      fun = RECOVER_FN_FROM_RIP_LENGTH+pc+sdisp;
     40    }
    3741    if (fulltag_of(fun) == fulltag_function) {
    3842      delta = pc - fun;
     
    5357  LispObj fun, ra;
    5458  unsigned offset;
     59  int sdisp;
    5560
    5661  if (f) {
     
    5964      ra = f->xtra;
    6065    }
     66
    6167    if (tag_of(ra) == tag_tra) {
    62       offset = (((unsigned *)ra)[-1]);
    63       if (offset == 0) {
    64         return true;
    65       } else {
    66         fun = ra - (((unsigned *)ra)[-1]);
    67         if (fulltag_of(fun) == fulltag_function) {
    68           return true;
    69         }
     68      if ((*((unsigned short *)ra) == RECOVER_FN_FROM_RIP_WORD0) &&
     69          (*((unsigned char *)(ra+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     70        sdisp = (*(int *) (ra+3));
     71        fun = RECOVER_FN_FROM_RIP_LENGTH+ra+sdisp;
     72      }
     73      if (fulltag_of(fun) == fulltag_function) {
     74        return true;
    7075      }
    7176    } else if ((ra == lisp_global(LEXPR_RETURN)) ||
Note: See TracChangeset for help on using the changeset viewer.