Changeset 14354


Ignore:
Timestamp:
Oct 12, 2010, 11:52:12 AM (9 years ago)
Author:
gb
Message:

platform-linuxarm.h: since this is platform-specific anyway, reference
special-purpose registers/values in the machine context directly (may
be a little clearer than pretending that they were in the gpr vector.)

arm-excepions.[ch]: fix several bugs in pc_luser_xp() and the macros
that it uses, especially in the consus interruptus case. It's ...
better, but still needs work.

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

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/arm-exceptions.c

    r14330 r14354  
    15741574      } else {
    15751575        update_bytes_allocated(tcr, (void *) ptr_from_lispobj(cur_allocptr + disp));
    1576         xpGPR(xp, allocptr) = VOID_ALLOCPTR - disp;
     1576        xpGPR(xp, allocptr) = VOID_ALLOCPTR + disp;
     1577        instr = program_counter[-1];
     1578        if (IS_COMPARE_ALLOCPTR_TO_RM(instr)){
     1579          xpGPR(xp,RM_field(instr)) = VOID_ALLOCPTR;
     1580        } else {
     1581          Bug(NULL, "unexpected instruction preceding alloc trap.");
     1582        }
     1583        /* Clear the carry bit, so that the trap will be taken. */
     1584        xpPSR(xp) &= ~PSR_C_MASK;
    15771585      }
    15781586    } else {
    1579       /* If we're already past the alloc_trap, finish allocating
    1580          the object. */
    1581       if (allocptr_tag == fulltag_cons) {
    1582         finish_allocating_cons(xp);
     1587      /* we may be before or after the alloc trap.  If before, set
     1588         allocptr to VOID_ALLOCPTR and back up to the start of the
     1589         instruction sequence; if after, finish the allocation. */
     1590      Boolean before_alloc_trap = false;
     1591
     1592      if (IS_COMPARE_ALLOCPTR_TO_RM(instr)) {
     1593        before_alloc_trap = true;
     1594        --program_counter;
     1595        instr = *program_counter;
     1596      }
     1597      if (IS_LOAD_RD_FROM_ALLOCBASE(instr)) {
     1598        before_alloc_trap = true;
     1599        --program_counter;
     1600        instr = *program_counter;
     1601      }
     1602      if (IS_SUB_HI_FROM_ALLOCPTR(instr)) {
     1603        before_alloc_trap = true;
     1604        --program_counter;
     1605      }
     1606      if (before_alloc_trap) {
     1607        xpPC(xp) = program_counter;
     1608        xpGPR(xp,allocptr) = VOID_ALLOCPTR;
    15831609      } else {
    1584         if (allocptr_tag == fulltag_misc) {
    1585           finish_allocating_uvector(xp);
     1610        /* If we're already past the alloc_trap, finish allocating
     1611           the object. */
     1612        if (allocptr_tag == fulltag_cons) {
     1613          finish_allocating_cons(xp);
    15861614        } else {
    1587           Bug(xp, "what's being allocated here ?");
     1615          if (allocptr_tag == fulltag_misc) {
     1616            finish_allocating_uvector(xp);
     1617          } else {
     1618            Bug(xp, "what's being allocated here ?");
     1619          }
    15881620        }
     1621        /* Whatever we finished allocating, reset allocptr/allocbase to
     1622           VOID_ALLOCPTR */
     1623        xpGPR(xp,allocptr) = VOID_ALLOCPTR;
    15891624      }
    1590       /* Whatever we finished allocating, reset allocptr/allocbase to
    1591          VOID_ALLOCPTR */
    1592       xpGPR(xp,allocptr) = VOID_ALLOCPTR;
    15931625    }
    15941626    return;
  • trunk/source/lisp-kernel/arm-exceptions.h

    r14169 r14354  
    7272#define IS_SUB_LO_FROM_ALLOCPTR(i)   (((i)&0x0fffff00) == 0x024cc000)
    7373#define IS_SUB_HI_FROM_ALLOCPTR(i)   (IS_SUB_FROM_ALLOCPTR(i) && \
    74                                      !(IS_SUB_LOW_FROM_ALLOCPTR(i)))
     74                                     !(IS_SUB_LO_FROM_ALLOCPTR(i)))
    7575#define IS_LOAD_RD_FROM_ALLOCBASE(i) (((i)&0x0fff0fff) == \
    76                                       ( 0x05930000 | offsetof(tcr,allocbase)))
    77 #define IS_COMPARE_ALLOCPTR_TO_RM(i) (((i)&0x0fffff0) == 0x0140c000)
     76                                      ( 0x05930000 | offsetof(TCR,save_allocbase)))
     77#define IS_COMPARE_ALLOCPTR_TO_RM(i) (((i)&0x0fff0ff0) == 0x015c0000)
    7878#define IS_ALLOC_TRAP(i) (((i)&0x0fffffff) == 0x07f000f0)
    7979#define IS_SET_ALLOCPTR_HEADER_RD(i) (((i)&0x0fff0fff) == \
    8080                                      (0x050c0000 | (- misc_header_offset)))
    81 /* The 1 here - and the 3 in the following definition - are based on
    82    the tagged offsets of cars and cdrs.  Fix these definitions of that ever
     81/* The 5 here - and the 1 in the following definition - are based on
     82   the tagged offsets of cars and cdrs.  Fix these definitions if that ever
    8383   changes ... */
    84 #define IS_SET_ALLOCPTR_CDR_RD(i)    (((i)&0x0fff0fff) == 0x050c0001)
    85 #define IS_SET_ALLOCPTR_CAR_RD(i)    (((i)&0x0fff0fff) == 0x058c0003)
     84#define IS_SET_ALLOCPTR_CDR_RD(i)    (((i)&0x0fff0fff) == 0x050c0005)
     85#define IS_SET_ALLOCPTR_CAR_RD(i)    (((i)&0x0fff0fff) == 0x050c0001)
    8686#define IS_SET_ALLOCPTR_RESULT_RD(i) (((i)&0x0fff0fff) == 0x01a0000c)
    8787#define IS_CLR_ALLOCPTR_TAG(i)       (((i)&0x0fffffff) == 0x03ccc007)
  • trunk/source/lisp-kernel/platform-linuxarm.h

    r14320 r14354  
    3737#define xpPC(x) (*((pc*)(&(xpGPR(x,15)))))
    3838#define xpLR(x) (*((pc*)(&(xpGPR(x,14)))))
    39 #define xpPSR(x) xpGPR(x,16)
    40 #define xpFaultAddress(x) xpGPR(x,17)
    41 #define xpTRAP(x) xpGPR(x,-3)
    42 #define xpERROR(x) xpGPR(x,-2)
     39#define xpPSR(x) ((x)->uc_mcontext.arm_cpsr)
     40#define xpFaultAddress(x) ((x)->uc_mcontext.fault_address)
     41#define xpTRAP(x) ((x)->uc_mcontext.trap_no)
     42#define xpERROR(x) ((x)->uc_mcontext.error_code)
    4343#define xpFaultStatus(x) xpERROR(x)
    4444
Note: See TracChangeset for help on using the changeset viewer.