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/xlbt.c

    r14977 r14991  
    1616
    1717#include "lispdcmd.h"
     18#include "x86-utils.h"
    1819#include <stdio.h>
    1920#include <signal.h>
    20 
    21 static LispObj
    22 function_to_function_vector(LispObj f)
    23 {
    24 #ifdef X8664
    25   return f - fulltag_function + fulltag_misc;
    26 #else
    27   return f;
    28 #endif
    29 }
    30 
    31 static Boolean
    32 functionp(LispObj f)
    33 {
    34 #ifdef X8664
    35   return fulltag_of(f) == fulltag_function;
    36 #else
    37   return fulltag_of(f) == fulltag_misc &&
    38     header_subtag(header_of(f)) == subtag_function;
    39 #endif
    40 }
    41 
    42 static LispObj
    43 tra_function(LispObj tra)
    44 {
    45   LispObj f = 0;
    46 
    47 #ifdef X8664
    48   if (tag_of(tra) == tag_tra) {
    49     if ((*((unsigned short *)tra) == RECOVER_FN_FROM_RIP_WORD0) &&
    50         (*((unsigned char *)(tra+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
    51       int sdisp = (*(int *) (tra+3));
    52       f = RECOVER_FN_FROM_RIP_LENGTH+tra+sdisp;
    53     }
    54   }
    55 #else
    56   if (fulltag_of(tra) == fulltag_tra) {
    57     if (*((unsigned char *)tra) == RECOVER_FN_OPCODE) {
    58       natural n = *((natural *)(tra + 1));
    59       f = (LispObj)n;
    60     }
    61   }
    62 #endif
    63   return f;
    64 }
    65 
    66 #if 0
    67 /* untested */
    68 static int
    69 tra_offset(LispObj tra)
    70 {
    71 #ifdef X8664
    72   if (tag_of(tra) == tag_tra) {
    73     if ((*((unsigned short *)tra) == RECOVER_FN_FROM_RIP_WORD0) &&
    74         (*((unsigned char *)(tra+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
    75       int sdisp = (*(int *) (tra+3));
    76 
    77       sdisp = - sdisp;
    78       sdisp -= RECOVER_FN_FROM_RIP_LENGTH;
    79       return sdisp;
    80     }
    81   }
    82 #else
    83   if (fulltag_of(tra) == fulltag_tra) {
    84     if (*((unsigned char *)tra) == RECOVER_FN_OPCODE) {
    85       int n = *((int *)(tra + 1));
    86       n = n - tra;
    87       n = -n;
    88       return n;
    89     }
    90   }
    91 #endif
    92   return 0;
    93 }
    94 #endif
    9521
    9622natural
Note: See TracChangeset for help on using the changeset viewer.