From: Alastair Bridgewater Date: Wed, 9 Nov 2011 17:30:40 +0000 (-0500) Subject: arch-assem.S: Update fun-end breakpoint magic for pickier make-lisp-obj. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=cdd026dddac3eaddbaa0221503e49e2673d54545;p=sbcl.git arch-assem.S: Update fun-end breakpoint magic for pickier make-lisp-obj. * We're about to cause SB-KERNEL:MAKE-LISP-OBJ to use the same validation on CHENEYGC as it always has on GENCGC. * In order to not break function-end breakpoints, update them all now to have the same header structure as on PPC (which had to be made to work on GENCGC some time back). * While we're here, add a comment to each copy pointing to the PPC version as having an actual explanation for the magic. * And update the PPC version commentary to the soon-to-be reality of MAKE-LISP-OBJ always verifying pointers, instead of only verifying pointers on GENCGC. * Finally, remove the no-longer-necessary code in debug-int that set the header value, leaving a historic-information comment behind. --- diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp index ef48049..7411bc5 100644 --- a/src/code/debug-int.lisp +++ b/src/code/debug-int.lisp @@ -3152,20 +3152,10 @@ register." #!-(or x86 x86-64) (let ((new-lra (make-lisp-obj (+ (sap-int dst-start) sb!vm:other-pointer-lowtag)))) - #!-(or gencgc ppc) - (progn - ;; Set the offset from the LRA to the enclosing component. - ;; This does not need to be done on GENCGC targets, as the - ;; pointer validation done in MAKE-LISP-OBJ requires that it - ;; already have been set before we get here. It does not - ;; need to be done on CHENEYGC PPC as it's easier to use the - ;; same fun_end_breakpoint_guts on both, including the LRA - ;; header. - (set-header-data - new-lra - (logandc2 (+ sb!vm:code-constants-offset bogus-lra-constants 1) - 1)) - (sb!vm:sanctify-for-execution code-object)) + ;; We used to set the header value of the LRA here to the + ;; offset from the enclosing component to the LRA header, but + ;; MAKE-LISP-OBJ actually checks the value before we get a + ;; chance to set it, so it's now done in arch-assem.S. (values new-lra code-object (sap- trap-loc src-start)))))) ;;;; miscellaneous diff --git a/src/runtime/alpha-assem.S b/src/runtime/alpha-assem.S index dd4e218..1a8928b 100644 --- a/src/runtime/alpha-assem.S +++ b/src/runtime/alpha-assem.S @@ -320,12 +320,17 @@ funcallable_instance_tramp = . + 1 * fun-end breakpoint magic. */ +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .text .align 2 .set noreorder .globl fun_end_breakpoint_guts fun_end_breakpoint_guts: - .long RETURN_PC_HEADER_WIDETAG + .long RETURN_PC_HEADER_WIDETAG + 0x800 br zero, fun_end_breakpoint_trap nop mov reg_CSP, reg_OCFP diff --git a/src/runtime/hppa-assem.S b/src/runtime/hppa-assem.S index 25cb29d..97ada0c 100644 --- a/src/runtime/hppa-assem.S +++ b/src/runtime/hppa-assem.S @@ -436,10 +436,15 @@ SingleStepTraps: there's a break 0,0 in the new version here!!! */ +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .align 8 .export fun_end_breakpoint_guts fun_end_breakpoint_guts: - .word RETURN_PC_HEADER_WIDETAG + .word RETURN_PC_HEADER_WIDETAG + 0x800 /* multiple value return point -- just jump to trap. */ b,n fun_end_breakpoint_trap /* single value return point -- convert to multiple w/ n=1 */ diff --git a/src/runtime/mips-assem.S b/src/runtime/mips-assem.S index c295993..4eabf21 100644 --- a/src/runtime/mips-assem.S +++ b/src/runtime/mips-assem.S @@ -447,10 +447,16 @@ funcallable_instance_tramp = . + 1 * copied and has to be relocatable. It also needs a properly aligned * header tag after the fun_end_breakpoint_guts symbol. */ + +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .align 3 /* minimum alignment for a lisp object */ LEAF(fun_end_breakpoint_guts) .set noreorder - .word RETURN_PC_HEADER_WIDETAG + .word RETURN_PC_HEADER_WIDETAG + 0x800 b multiple_value_return nop .set reorder diff --git a/src/runtime/ppc-assem.S b/src/runtime/ppc-assem.S index a8a165c..3f0dd99 100644 --- a/src/runtime/ppc-assem.S +++ b/src/runtime/ppc-assem.S @@ -663,13 +663,13 @@ CSYMBOL(funcallable_instance_tramp) = . + 1 .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. */ + /* Due to pointer verification in MAKE-LISP-OBJ, 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 diff --git a/src/runtime/sparc-assem.S b/src/runtime/sparc-assem.S index ac6342d..6c2af48 100644 --- a/src/runtime/sparc-assem.S +++ b/src/runtime/sparc-assem.S @@ -265,11 +265,16 @@ funcallable_instance_tramp = . + 1 * Function-end breakpoint magic. */ +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .text .align 8 .global fun_end_breakpoint_guts fun_end_breakpoint_guts: - .word RETURN_PC_HEADER_WIDETAG + .word RETURN_PC_HEADER_WIDETAG + 0x800 b 1f nop mov reg_CSP, reg_OCFP diff --git a/src/runtime/x86-64-assem.S b/src/runtime/x86-64-assem.S index 52321bf..c4f5435 100644 --- a/src/runtime/x86-64-assem.S +++ b/src/runtime/x86-64-assem.S @@ -344,6 +344,12 @@ GNAME(closure_tramp): /* * fun-end breakpoint magic */ + +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .text .globl GNAME(fun_end_breakpoint_guts) .align align_16byte diff --git a/src/runtime/x86-assem.S b/src/runtime/x86-assem.S index 5a89a4a..2945f77 100644 --- a/src/runtime/x86-assem.S +++ b/src/runtime/x86-assem.S @@ -380,6 +380,12 @@ GNAME(funcallable_instance_tramp): /* * fun-end breakpoint magic */ + +/* + * For an explanation of the magic involved in function-end + * breakpoints, see the implementation in ppc-assem.S. + */ + .text .globl GNAME(fun_end_breakpoint_guts) .align align_16byte