Changeset 13921


Ignore:
Timestamp:
Jul 5, 2010, 4:05:10 PM (9 years ago)
Author:
gb
Message:

arm-constants.h, thread_manager.c: tcr.last_lisp_frame is just a natural.

arm-exceptions.c: maintain tcr.last_lisp_frame when entering/exiting
signal handlers. Signal thread interrupts by calling back to cmain
with signal 0.

arm-spentry.s: add an entrypoint that calls to undefined functions
wind up at. Dont' really need .SPtfuncallvsp. Check for pending
interrupts on ffcall return. Box the unboxed callback index in
.SPeabi_callback, don't unbox it even more.

arm-uuo.s: closer to lisp's idea of UUO encoding, but still not there.

xfasload.lisp: build the undefined function object differently.

arm-asm.lisp, arm-disassemble.lisp: uuo-slot-unbound encodes 3 registers

arm-lapmacros.lisp: define SET-GLOBAL; needs an extra temp reg.

arm-vinsns.lisp: scale-1bit-misc-index needs another shift. 3-operand
slot-unbound UUO. EEP-unresolved UUO operand order. No more .SPtfuncallvsp.
Make sure that nargs doesn't get clobbered in UNBIND-INTERRUPT-LEVEL-INLINE.

arm-array.lisp: in @string case of %init-misc, shift value, not tag.

arm-misc.lisp: add PENDING-USER-INTERRUPT, %%SAVE-APPLICATION.

arm-callback-support.lisp, arm-error-signal.lisp,
arm-trap-support.lisp,l1-boot-3.lisp: try to get basic stuff working
well enough to enable callbacks. Enable callbacks.

arm-backtrace.lisp: a little bit of platform-specific code and some
code from the PPC port, so that backtrace sort of works.

Status: can save an image (and it's more-or-less worth doing so.)
Crashes (somewhere in the type-system) compiling db-io.lisp, so I
don't yet know what undefined things would be warned about.

Location:
branches/arm
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/compiler/ARM/arm-asm.lisp

    r13906 r13921  
    120120    :fpaddr
    121121    :@rn
     122    :uuoC
    122123    ))
    123124
     
    276277     #x0fff00ff
    277278     (:prefer-separate-cond))
    278    (define-arm-instruction uuo-error-slot-unbound (:uuoA :uuoB)
    279      #x07f300ff
    280      #x0fff00ff
     279   (define-arm-instruction uuo-error-slot-unbound (:uuoA :uuoB :uuoC)
     280     #x07f000fe
     281     #x0ff000ff
    281282     (:prefer-separate-cond))
    282283   (define-arm-instruction uuo-eep-unresolved (:uuoA :uuoB)
     
    11341135  (set-field-value instruction (byte 4 12) (need-arm-gpr form)))
    11351136
     1137(defun parse-uuoC-operand (form instruction)
     1138  (set-field-value instruction (byte 4 16) (need-arm-gpr form)))
     1139
    11361140(defun parse-rm-operand (form instruction)
    11371141  (set-field-value instruction (byte 4 0) (need-arm-gpr form)))
     
    12571261      parse-fpaddr-operand
    12581262      parse-@rn-operand
     1263      parse-uuoc-operand
    12591264      ))
    12601265
     
    15651570    :sn
    15661571    :fpaddr-offset
     1572    :uuoC
    15671573    )))
    15681574
     
    15941600      vinsn-parse-rs-operand
    15951601      vinsn-parse-fpaddr-operand
     1602      vinsn-parse-@rn-operand
     1603      vinsn-parse-uuoc-operand
    15961604      ))
    15971605
     
    17771785(defun vinsn-parse-uuoB-operand (avi value vinsn-params)
    17781786  (vinsn-arg-or-gpr avi value vinsn-params (encode-vinsn-field-type :uuoB) (byte 4 12)))
     1787
     1788(defun vinsn-parse-uuoC-operand (avi value vinsn-params)
     1789  (vinsn-arg-or-gpr avi value vinsn-params (encode-vinsn-field-type :uuoC) (byte 4 16)))
    17791790
    17801791(defun vinsn-parse-rm-operand (avi value vinsn-params)
     
    19661977    vinsn-insert-sn-operand
    19671978    vinsn-insert-fpaddr-offset-operand
     1979    vinsn-insert-uuoc-operand
    19681980    ))
    19691981
     
    20192031(defun vinsn-insert-uuoB-operand (instruction value)
    20202032  (set-field-value instruction (byte 4 12) value))
     2033
     2034(defun vinsn-insert-uuoC-operand (instruction value)
     2035  (set-field-value instruction (byte 4 16) value))
    20212036
    20222037(defun vinsn-insert-label-operand (instruction value)
  • branches/arm/compiler/ARM/arm-disassemble.lisp

    r13897 r13921  
    178178    (arm-gpr-name (ldb (byte 4 12) opcode))))
    179179
     180(defun extract-arm-uuoc-operand (opcodes i)
     181  (let* ((opcode (adi-opcode (svref opcodes i))))
     182    (arm-gpr-name (ldb (byte 4 16) opcode))))
     183
    180184(defun extract-arm-rm-operand (opcodes i)
    181185  (let* ((opcode (adi-opcode (svref opcodes i))))
     
    280284    extract-arm-fpaddr-operand
    281285    extract-arm-@rn-operand
     286    extract-arm-uuoc-operand
    282287    ))
    283288
  • branches/arm/compiler/ARM/arm-lapmacros.lisp

    r13864 r13921  
    230230      (ldr ,reg (:@ ,reg (:$ ,offset))))))
    231231
    232 
     232(defarmlapmacro set-global (reg sym temp)
     233  (let* ((offset (arm::%kernel-global sym)))
     234    `(progn
     235      (mov ,temp (:$ (- arm::nil-value arm::fulltag-nil)))
     236      (str ,reg (:@ ,temp (:$ ,offset))))))
    233237
    234238
  • branches/arm/compiler/ARM/arm-vinsns.lisp

    r13906 r13921  
    7474  (and bitnum word-index (:$ 31))
    7575  (mov word-index (:lsr word-index (:$ 5)))
     76  (mov word-index (:lsl word-index (:$ arm::word-shift)))
    7677  (add word-index word-index (:$ arm::misc-data-offset)))
    7778
     
    473474  (ldr dest (:@ instance scaled))
    474475  (cmp dest (:$ arm::slot-unbound-marker))
    475   (uuo-error-slot-unbound (:? eq) instance index))
     476  (uuo-error-slot-unbound (:? eq) dest instance index))
    476477
    477478
     
    31373138  (ldr dest (:@ src (:$ (+ (ash 1 2) arm::misc-data-offset))))
    31383139  (cmp dest (:$ arm::nil-value))
    3139   (uuo-eep-unresolved (:? eq) src dest))
     3140  (uuo-eep-unresolved (:? eq) dest src))
    31403141                 
    31413142(define-arm-vinsn %natural+ (((dest :u32))
     
    32733274(define-arm-subprim-jump-vinsn (tail-funcall-slide) .SPtfuncallslide)
    32743275
    3275 (define-arm-subprim-jump-vinsn (tail-funcall-vsp) .SPtfuncallvsp)
     3276(define-arm-vinsn (tail-funcall-vsp :jumpLR) (() ())
     3277  (ldmia (:! sp) (imm0 vsp fn lr))
     3278  (ba .SPfuncall))
    32763279
    32773280(define-arm-subprim-call-vinsn (spread-lexpr)  .SPspread-lexprz)
     
    34643467                                                 ()
    34653468                                                 ((preserve (:lisp #.arm::arg_z))
     3469                                                  (preserved (:u32 #.arm::nargs))
    34663470                                                  (tlb :imm)
    34673471                                                  (link :imm)
  • branches/arm/level-0/ARM/arm-array.lisp

    r13756 r13921  
    138138  (extract-lowbyte imm0 val)
    139139  (cmp imm0 (:$ arm::subtag-character))
    140   (mov imm0 (:lsr imm0 (:$ arm::charcode-shift)))
     140  (mov imm0 (:lsr val (:$ arm::charcode-shift)))
    141141  (beq @word-set-loop)
    142142  @bad
  • branches/arm/level-0/ARM/arm-misc.lisp

    r13913 r13921  
    644644       
    645645
    646 #+notyet
     646
    647647(defarmlapfunction %%save-application ((flags arg_y) (fd arg_z))
    648648  (unbox-fixnum imm0 flags)
    649   (orr imm0 imm0 arch::gc-trap-function-save-application)
     649  (orr imm0 imm0 (:$ arch::gc-trap-function-save-application))
    650650  (unbox-fixnum imm1 fd)
    651   (trlgei allocptr 0)
     651  (uuo-gc-trap (:? al))
    652652  (bx lr))
    653653
     
    784784  (cmp imm0 (:$ 0))
    785785  (addne arg_z arg_z (:$ arm::t-offset))
     786  (bx lr))
     787
     788(defarmlapfunction pending-user-interrupt ()
     789  (mov temp0 (:$ 0))
     790  (ref-global arg_z arm::intflag)
     791  (set-global temp0 arm::intflag imm0)
    786792  (bx lr))
    787793
  • branches/arm/lisp-kernel/arm-constants.h

    r13863 r13921  
    290290  struct area *cs_area;         /* cstack area pointer */
    291291  struct area *vs_area;         /* vstack area pointer */
    292   lisp_frame *last_lisp_frame;  /* when in foreign code */
     292  natural last_lisp_frame;      /* when in foreign code */
    293293  LispObj cs_limit;             /* stack overflow limit */
    294294  unsigned long long bytes_allocated;
  • branches/arm/lisp-kernel/arm-exceptions.c

    r13903 r13921  
    10101010  } else if (xnum == SIGNAL_FOR_PROCESS_INTERRUPT) {
    10111011    tcr->interrupt_pending = 0;
    1012     callback_for_trap(nrs_CMAIN.vcell, xp, xnum, 0);
     1012    callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0);
    10131013    return true;
    10141014  }
     
    11181118    case 4:
    11191119      tcr->interrupt_pending = 0;
    1120       callback_for_trap(nrs_CMAIN.vcell, xp, SIGNAL_FOR_PROCESS_INTERRUPT, 0);
     1120      callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0);
    11211121      handled = true;
    11221122      break;
     
    11841184    fnreg = nfn;
    11851185    codevector = register_codevector_contains_pc(xpGPR(xp,fnreg), where);
    1186   }
    1187   offset = (natural)where - codevector;
     1186    if (codevector == 0) {
     1187      fnreg = 0;
     1188    }
     1189  }
     1190  if (codevector) {
     1191    offset = (natural)where - (codevector - (fulltag_misc-node_size));
     1192  } else {
     1193    offset = (natural)where;
     1194  }
    11881195                                                 
    11891196                                               
     
    13231330
    13241331void
    1325 exit_signal_handler(TCR *tcr, int old_valence)
     1332exit_signal_handler(TCR *tcr, int old_valence, natural old_last_lisp_frame)
    13261333{
    13271334  sigset_t mask;
     
    13311338  tcr->valence = old_valence;
    13321339  tcr->pending_exception_context = NULL;
    1333 }
    1334 
    1335 
    1336 void
    1337 signal_handler(int signum, siginfo_t *info, ExceptionInformation  *context, TCR *tcr, int old_valence)
     1340  tcr->last_lisp_frame = old_last_lisp_frame;
     1341}
     1342
     1343
     1344void
     1345signal_handler(int signum, siginfo_t *info, ExceptionInformation  *context, TCR *tcr, int old_valence, natural old_last_lisp_frame)
    13381346{
    13391347  xframe_list xframe_link;
     
    13501358    */
    13511359   
     1360    old_last_lisp_frame = tcr->last_lisp_frame;
     1361    tcr->last_lisp_frame = xpGPR(context,Rsp);
    13521362    old_valence = prepare_to_wait_for_exception_lock(tcr, context);
    13531363  }
     
    13671377    }
    13681378  }
    1369 
    13701379  unlock_exception_lock_in_handler(tcr);
    13711380
     
    13771386  */
    13781387  if (!use_mach_exception_handling) {
    1379     exit_signal_handler(tcr, old_valence);
     1388    exit_signal_handler(tcr, old_valence, old_last_lisp_frame);
    13801389    raise_pending_interrupt(tcr);
    13811390  }
     
    15671576        if ((tcr->valence != TCR_STATE_LISP) ||
    15681577            (tcr->unwinding != 0)) {
    1569           TCR_INTERRUPT_LEVEL(tcr) = (1 << fixnumshift);
     1578          tcr->interrupt_pending = 1 << fixnumshift;
    15701579        } else {
    15711580          xframe_list xframe_link;
    15721581          int old_valence;
    15731582          signed_natural disp=0;
     1583          natural old_last_lisp_frame = tcr->last_lisp_frame;
    15741584         
     1585          tcr->last_lisp_frame = xpGPR(context,Rsp);
    15751586          pc_luser_xp(context, tcr, &disp);
    15761587          old_valence = prepare_to_wait_for_exception_lock(tcr, context);
     
    15811592          }
    15821593          unlock_exception_lock_in_handler(tcr);
    1583           exit_signal_handler(tcr, old_valence);
     1594          exit_signal_handler(tcr, old_valence, old_last_lisp_frame);
    15841595        }
    15851596      }
  • branches/arm/lisp-kernel/arm-spentry.s

    r13911 r13921  
    6565        __(restore_lisp_frame(imm0))
    6666        __(jump_nfn())
     67
     68        /* This isn't a subprim - we never have to MOV this address
     69        to the PC, but it gets LDRed into the PC as part of the
     70        standard calling sequence.  Ensuring that that happens -
     71        without having to deal with updating the entrypoint associated
     72        with a relocatable code-vector stored in a non-function -
     73        is easiest if we use a fixed address here. */
     74       
     75        .org sporg-delta+0x40
     76_exportfn(udfcall)
     77        __(uuo_error_udf_call(al,fname))
     78        __(jump_fname)
     79_endfn               
    6780       
    6881_spentry(builtin_plus)
     
    14571470        __(funcall_nfn())
    14581471
    1459 /* No args were vpushed; recover saved context & do funcall  */
    1460 _spentry(tfuncallvsp)
    1461         __(restore_lisp_frame(imm0))
    1462         __(funcall_nfn())
     1472
     1473_spentry(unused0)
    14631474
    14641475/* Tail-recursively call the (known symbol) in fname.  */
     
    27812792        __(ldmia vsp!,{arg_y,arg_x,temp0,temp1,temp2})
    27822793        __(str arg_y,[rcontext,#tcr.last_lisp_frame])
     2794        __(check_pending_interrupt(temp2))
    27832795        __(bx lr)
    27842796       
     
    29652977        __(stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
    29662978        __(mov r4,r0)
    2967         __(unbox_fixnum(r5,r12))
     2979        __(box_fixnum(r5,r12))
    29682980        __(ref_global(r12,get_tcr,r0))
    29692981        __(mov r0,#1)
  • branches/arm/lisp-kernel/arm-uuo.s

    r13738 r13921  
    4545uuo_format_cerror_fulltag = 11 /* continuable, fulltag, reg */
    4646uuo_format_cerror_xtype = 12   /* continuable, xtype, reg */
    47 uuo_format_kernel_service = 13 /* 8 bits of info */       
     47uuo_format_kernel_service = 13 /* 8 bits of info */ 
     48uuo_format_ternary_error = 14   /* SLOT-UNBOUND only */             
    4849uuo_format_binary_error = 15    /* binary format, call out to lisp */
    4950
     
    8990define(`uuo_tlb_too_small',`unaryUUO($1,$2,3)')
    9091define(`uuo_error_no_throw_tag',`unary_errorUUO($1,$2,4)')
    91 define(`uuo_error_udf_call',`unary_errorUUO($1,$2,5)')        
     92define(`uuo_error_udf_call',`unary_errorUUO($1,$2,5)')       
    9293define(`uuo_error_udf',`unary_errorUUO($1,$2,6)')
    9394       
     
    9596define(`uuo_error_vector_bounds',`binary_errorUUO($1,$2,$3,0)')
    9697define(`uuo_error_array_bounds',`binary_errorUUO($1,$2,$3,1)')
    97 define(`uuo_error_integer_divide_by_zero','`binary_errorUUO($1,$2,$3,2)')
     98define(`uuo_error_integer_divide_by_zero',`binary_errorUUO($1,$2,$3,2)')
     99define(`uuo_error_slot_unbound',`binary_errorUUO($1,$2,$3,3)')
     100define(`uuo_error_eep_unresolved',`binary_errorUUO($1,$2,$3,4)')       
    98101               
    99102
  • branches/arm/lisp-kernel/thread_manager.c

    r13789 r13921  
    15251525  a->owner = tcr;
    15261526#ifdef ARM
    1527   tcr->last_lisp_frame = (lisp_frame *)(a->high);
     1527  tcr->last_lisp_frame = (natural)(a->high);
    15281528#endif
    15291529  if (!(tcr->flags & (1<<TCR_FLAG_BIT_FOREIGN))) {
  • branches/arm/xdump/xfasload.lisp

    r13789 r13921  
    10551055      ;; report the appropriate error.
    10561056      ;; On the ARM: make a two-element vector: entrypoint, code-vector.
    1057       (let* ((udf-object (xload-make-gvector :simple-vector (target-arch-case (:arm 2) (otherwise 1)))))
     1057      (let* ((udf-object (xload-make-gvector :simple-vector 1)))
    10581058        (target-arch-case
    10591059         (:arm
    10601060          (setf (xload-%svref udf-object 0)
    1061                 (subprim-name->offset '.SPfix-nfn-entrypoint *target-backend*)))
    1062          (otherwise ))
    1063         (setf (xload-%svref udf-object (target-arch-case
    1064                                         (:arm 1) (otherwise 0)))
    1065               (xload-save-code-vector
    1066                (backend-xload-info-udf-code
    1067                 *xload-target-backend*))))
     1061                (+ (subprim-name->offset '.SPfix-nfn-entrypoint *target-backend*)
     1062                   #x40)))
     1063         (otherwise
     1064          (setf (xload-%svref udf-object 0)
     1065                (xload-save-code-vector
     1066                 (backend-xload-info-udf-code
     1067                  *xload-target-backend*))))))
    10681068      (let* ((udf-object (xload-make-gvector :simple-vector 1)))
    10691069        (setf (xload-%svref udf-object 0) (backend-xload-info-udf-code
Note: See TracChangeset for help on using the changeset viewer.