0.9.6.42:
[sbcl.git] / src / runtime / mips-assem.S
index c723b30..d18699a 100644 (file)
@@ -138,7 +138,7 @@ symbol:
         .set    noreorder
        bgez    reg_NL4, 1f
         subu   reg_ALLOC, 1
-       break   0x10
+       break   0x0, 0x10
 1:     .set    reorder
 
        /* Pass in args */
@@ -162,7 +162,7 @@ symbol:
        addu    reg_LIP, reg_CODE, SIMPLE_FUN_CODE_OFFSET
        jr      reg_LIP
 
-       .align  2
+       .align  3
        .set    noreorder
 lra:   .word   RETURN_PC_HEADER_WIDETAG
 
@@ -194,7 +194,7 @@ lra:        .word   RETURN_PC_HEADER_WIDETAG
        .set    noreorder
        bgez    reg_NL4, 1f
         subu   reg_ALLOC, 1
-       break   0x10
+       break   0x0, 0x10
 1:     .set    reorder
 
        /* Pass one return value back to C land. For a 64bit value, we may
@@ -272,7 +272,7 @@ lra:        .word   RETURN_PC_HEADER_WIDETAG
        .set    noreorder
        bgez    reg_NL4, 1f
         subu   reg_ALLOC, 1
-       break   0x10
+       break   0x0, 0x10
 1:     .set    reorder
 
        /* Into C land we go. */
@@ -333,7 +333,7 @@ lra:        .word   RETURN_PC_HEADER_WIDETAG
        .set    noreorder
        bgez    reg_NL4, 1f
         subu   reg_ALLOC, 1
-       break   0x10
+       break   0x0, 0x10
 1:     .set    reorder
 
        /* Reset the lisp stack. */
@@ -350,7 +350,7 @@ lra:        .word   RETURN_PC_HEADER_WIDETAG
  *
  * The undefined-function trampoline.
  */
-       .align  2
+       .align  3 /* minimum alignment for a lisp object */
        .word   SIMPLE_FUN_HEADER_WIDETAG /* header */
        .word   undefined_tramp - SIMPLE_FUN_CODE_OFFSET /* self */
        .word   NIL /* next */
@@ -358,19 +358,38 @@ lra:      .word   RETURN_PC_HEADER_WIDETAG
        .word   NIL /* arglist */
        .word   NIL /* type */
        LEAF(undefined_tramp)
-        break  trap_Error
-        .byte  4
-        .byte  UNDEFINED_FUN_ERROR
-        .byte  254
-        .byte  (0xc0 + sc_DescriptorReg)
-        .byte  1
+       /* Point reg_CODE to the header and tag it as function, since
+          the debugger regards a function pointer in reg_CODE which
+          doesn't point to a code object as undefined function.  */
+       lui     reg_CODE, %hi(undefined_tramp)
+       addiu   reg_CODE, %lo(undefined_tramp)
+       addiu   reg_CODE, - 24 + FUN_POINTER_LOWTAG
+       .set    noreorder
+       b       1f
+        break  0x0, trap_Cerror
+       /* Error data length. */
+       .byte   4
+       /* Error number. */
+       .byte   UNDEFINED_FUN_ERROR
+       /* Magic value 254 means a 16bit little endian value follows.
+          See debug-var-io.lisp. */
+       .byte   254
+       /* reg_FDEFN is #14. */
+       .byte   ((14 << 5) + sc_DescriptorReg) % 0x100
+       .byte   ((14 << 5) + sc_DescriptorReg) / 0x100
        .align  2
+       .set    reorder
+1:     lw      reg_CODE, FDEFN_FUN_OFFSET(reg_FDEFN)
+       lw      reg_LIP, SIMPLE_FUN_CODE_OFFSET(reg_CODE)
+       jr      reg_LIP
        END(undefined_tramp)
 
 /*
  * The closure trampoline.
  */
-       .align  2
+       .align  5 /* common MIPS cacheline size */
+       .word   0 /* pad 1 */
+       .word   0 /* pad 2 */
        .word   SIMPLE_FUN_HEADER_WIDETAG /* header */
        .word   closure_tramp - SIMPLE_FUN_CODE_OFFSET /* self */
        .word   NIL /* next */
@@ -385,16 +404,19 @@ lra:      .word   RETURN_PC_HEADER_WIDETAG
        END(closure_tramp)
 
 /*
- * Function-end breakpoint magic.
+ * Function-end breakpoint magic. This is truely magic, the code is
+ * copied and has to be relocatable. It also needs a properly aligned
+ * header tag after the fun_end_breakpoint_guts symbol.
  */
-       .align  3
+       .align  3 /* minimum alignment for a lisp object */
        LEAF(fun_end_breakpoint_guts)
-       .set    noreorder
-       .word   RETURN_PC_HEADER_WIDETAG
-
-       b       multiple_value_return
+       .set    noreorder
+       .word   RETURN_PC_HEADER_WIDETAG
+       b       multiple_value_return
         nop
-       .set    reorder
+       .set    reorder
+
+       /* single value return */
 
        move    reg_OCFP, reg_CSP
        addu    reg_CSP, 4
@@ -408,7 +430,7 @@ lra:        .word   RETURN_PC_HEADER_WIDETAG
 multiple_value_return:
 
        FEXPORT(fun_end_breakpoint_trap)
-       break   trap_FunEndBreakpoint
+       break   0x0, trap_FunEndBreakpoint
        b       multiple_value_return
        EXPORT(fun_end_breakpoint_end)
        END(fun_end_breakpoint_guts)