Ignore:
Timestamp:
Sep 20, 2011, 2:19:03 AM (9 years ago)
Author:
rme
Message:

New functions in x86-utils.[ch], moved, more-or-less,
from xlbt.c.

Use them in x86-exceptions.c, in particular in
create_exception_callback_frame().

Move the definitions of the RECOVER_FN_xxx constants
from x86-exceptions.h to the appropriate x86-constants{32,64}.h
files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-utils.c

    r14990 r14991  
     1/*
     2   Copyright (C) 2011 Clozure Associates
     3   This file is part of Clozure CL. 
     4
     5   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
     6   License , known as the LLGPL and distributed with Clozure CL as the
     7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
     8   which is distributed with Clozure CL as the file "LGPL".  Where these
     9   conflict, the preamble takes precedence. 
     10
     11   Clozure CL is referenced in the preamble as the "LIBRARY."
     12
     13   The LLGPL is also available online at
     14   http://opensource.franz.com/preamble.html
     15*/
     16
     17#include "lisp.h"
     18#include "x86-utils.h"
     19
     20LispObj
     21tra_function(LispObj tra)
     22{
     23  LispObj f = 0;
     24
     25#ifdef X8664
     26  if (tag_of(tra) == tag_tra) {
     27    if ((*((unsigned short *)tra) == RECOVER_FN_FROM_RIP_WORD0) &&
     28        (*((unsigned char *)(tra + 2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     29      int sdisp = (*(int *)(tra + RECOVER_FN_FROM_RIP_DISP_OFFSET));
     30      f = RECOVER_FN_FROM_RIP_LENGTH + tra + sdisp;
     31    }
     32  }
     33#else
     34  if (fulltag_of(tra) == fulltag_tra) {
     35    if (*((unsigned char *)tra) == RECOVER_FN_OPCODE) {
     36      natural n = *((natural *)(tra + 1));
     37      f = (LispObj)n;
     38    }
     39  }
     40#endif
     41  return f;
     42}
     43
     44int
     45tra_offset(LispObj tra)
     46{
     47  LispObj f = tra_function(tra);
     48  int disp = 0;
     49
     50  if (functionp(f))
     51    disp = tra - f;
     52  return disp;
     53}
Note: See TracChangeset for help on using the changeset viewer.