From b9403c2035b22faea379a48e310f3a4c65c5acf2 Mon Sep 17 00:00:00 2001 From: dtc <dtc> Date: Tue, 20 Feb 2001 20:54:32 +0000 Subject: [PATCH] o Have the print VOP allocated room on the number stack for the top two register args popped by call_into_c, avoiding potential stack corruption. Noted by Daniel Barlow. --- compiler/alpha/print.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/alpha/print.lisp b/compiler/alpha/print.lisp index 6d6659136..d67aea4fa 100644 --- a/compiler/alpha/print.lisp +++ b/compiler/alpha/print.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/alpha/print.lisp,v 1.2 1994/10/31 04:39:51 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/alpha/print.lisp,v 1.3 2001/02/20 20:54:32 dtc Rel $") ;;; ;;; ********************************************************************** ;;; @@ -16,7 +16,10 @@ (in-package "ALPHA") - +;;; Some room needs to be allocated on the number stack because call_into_c +;;; pops two register args before calling into C and restores the NSP upon +;;; return. +;;; (define-vop (print) (:args (object :scs (descriptor-reg) :target a0)) (:results (result :scs (descriptor-reg))) @@ -34,7 +37,9 @@ (store-stack-tn nfp-save cur-nfp)) (inst li (make-fixup "debug_print" :foreign) cfunc) (inst li (make-fixup "call_into_c" :foreign) temp) + (inst lda nsp-tn (- 16) nsp-tn) (inst jsr lip-tn temp (make-fixup "call_into_c" :foreign)) + (inst lda nsp-tn 16 nsp-tn) (when cur-nfp (maybe-load-stack-nfp-tn cur-nfp nfp-save temp)) (move cfunc result)))) -- GitLab