.align 3 @ \
_##x:
-#define GFUNCDEF(x) .globl _/**/x @ \
+#define GFUNCDEF(x) .globl _ ## x @ \
FUNCDEF(x)
#else
#define FUNCDEF(x) .text ; \
/* Function is an indirect closure */
lwz reg_CODE,SIMPLE_FUN_SELF_OFFSET(reg_LEXENV)
- addi reg_LIP,reg_CODE,6*4-FUN_POINTER_LOWTAG
+ addi reg_LIP,reg_CODE,SIMPLE_FUN_CODE_OFFSET
mtctr reg_LIP
slwi reg_NARGS,reg_NL2,2
bctr
.long NIL /* name */
.long NIL /* arglist */
.long NIL /* type */
+ .long NIL /* xref */
CSYMBOL(undefined_tramp):
/* 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. */
bcl 20,31,.+4 /* get address of the next instruction */
- mflr reg_CODE /* header is 7 words back from here */
- addi reg_CODE,reg_CODE,-7*4+FUN_POINTER_LOWTAG
+ mflr reg_CODE /* header 1 extra word back from here */
+ addi reg_CODE,reg_CODE,-(SIMPLE_FUN_CODE_OFFSET+4)
twllei reg_ZERO,trap_Cerror
.byte 4
.long NIL
.long NIL
.long NIL
+ .long NIL
lwz reg_LEXENV,FUNCALLABLE_INSTANCE_FUNCTION_OFFSET(reg_LEXENV)
lwz reg_FDEFN,CLOSURE_FUN_OFFSET(reg_LEXENV)
addi reg_LIP,reg_FDEFN,SIMPLE_FUN_CODE_OFFSET
mtctr reg_LIP
bctr
SET_SIZE(funcallable_instance_tramp)
-
- GFUNCDEF(fun_end_breakpoint_trap)
- .long 0
- SET_SIZE(fun_end_breakpoint_trap)
-
- GFUNCDEF(fun_end_breakpoint)
- .long 0
- SET_SIZE(fun_end_breakpoint)
-
+\f
+ /* The fun_end_breakpoint support here is considered by the
+ authors of the other $ARCH-assem.S files to be magic, and it
+ is. It is a small fragment of code that is copied into a heap
+ code-object when needed, and contains an LRA object, code to
+ convert a single-value return to unknown-values format, and a
+ trap_FunEndBreakpoint. */
GFUNCDEF(fun_end_breakpoint_guts)
- .long 0
- SET_SIZE(fun_end_breakpoint_guts)
-
- GFUNCDEF(fun_end_breakpoint_end)
- .long 0
- SET_SIZE(fun_end_breakpoint_end)
+ .globl CSYMBOL(fun_end_breakpoint_trap)
+ .globl CSYMBOL(fun_end_breakpoint_end)
+
+ /* Due to pointer verification in MAKE-LISP-OBJ on GENCGC
+ targets, which includes PPC, this must include its header data
+ (the offset from the start of the code-object to the LRA).
+ The code-object header is five words, there are two words of
+ constants, and the instruction space is doubleword-aligned,
+ making an offset of eight. This is header data for a widetag,
+ so shift left eight bits and add. */
+ .long RETURN_PC_HEADER_WIDETAG + 0x800
+
+ /* We are receiving unknown multiple values, thus must deal
+ with the single-value and multiple-value cases separately. */
+ b fun_end_breakpoint_multiple_values
+ nop
+ /* Compute the correct value for reg_CODE based on the LRA.
+ This is a "simple" matter of subtracting a constant from
+ reg_LRA (where the LRA is stored by the return sequence) to
+ obtain a tagged pointer to the enclosing code component. Both
+ values are tagged OTHER_POINTER_LOWTAG, so we just have to
+ account for the eight words (see calculation for
+ RETURN_PC_HEADER_WIDETAG, above) between the two addresses.
+ Restoring reg_CODE doesn't appear to be strictly necessary
+ here, but let's observe the niceties.*/
+ addi reg_CODE, reg_LRA, -32
+
+ /* Multiple values are stored relative to reg_OCFP, which we
+ set to be the current top-of-stack. */
+ mr reg_OCFP, reg_CSP
+
+ /* Reserve a save location for the one value we have. */
+ addi reg_CSP, reg_CSP, 4
+
+ /* Record the number of values we have as a FIXNUM. */
+ li reg_NARGS, 4
+
+ /* Blank the remaining arg-passing registers. */
+ mr reg_A1, reg_NULL
+ mr reg_A2, reg_NULL
+ mr reg_A3, reg_NULL
+
+ /* And branch to our trap. */
+ b CSYMBOL(fun_end_breakpoint_trap)
+
+fun_end_breakpoint_multiple_values:
+ /* Compute the correct value for reg_CODE. See the
+ explanation for the single-value case, above. */
+ addi reg_CODE, reg_LRA, -32
+
+ /* The actual magic trap. */
+CSYMBOL(fun_end_breakpoint_trap):
+ twllei reg_ZERO, trap_FunEndBreakpoint
+
+ /* Finally, the debugger needs to know where the end of the
+ fun_end_breakpoint_guts are, so that it may calculate its size
+ in order to populate out a suitably-sized code object. */
+CSYMBOL(fun_end_breakpoint_end):
+ SET_SIZE(fun_end_breakpoint_guts)
+\f
GFUNCDEF(ppc_flush_cache_line)
dcbf 0,REG(3)