From 78263d45162f9683625dfa8b11f08d2244e8e52d Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Thu, 29 Sep 1994 15:54:27 +0000 Subject: [PATCH] Changed C_call_scheme to preserve and restore `last_return_code'. This fixes a bug which manifests as an access violation during GC. The GC bug happened because the incorrect value of `last_return_code' left after the recursive interpretation caused a negative stack segment size to be computed. When this was boxed as an unsigned value it became an illegal pointer object. Note that this manifestation would not have happened with the new tagging scheme. --- v7/src/microcode/utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v7/src/microcode/utils.c b/v7/src/microcode/utils.c index 942aa4a1f..b20bd4199 100644 --- a/v7/src/microcode/utils.c +++ b/v7/src/microcode/utils.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: utils.c,v 9.64 1993/09/15 01:05:28 gjr Exp $ +$Id: utils.c,v 9.65 1994/09/29 15:54:27 adams Exp $ Copyright (c) 1987-1993 Massachusetts Institute of Technology @@ -1080,6 +1080,7 @@ DEFUN (C_call_scheme, (proc, nargs, argvec), AND SCHEME_OBJECT * argvec) { SCHEME_OBJECT primitive, prim_lexpr, * sp, result; + SCHEME_OBJECT * callers_last_return_code; #ifdef i386 extern void * C_Frame_Pointer, * C_Stack_Pointer; @@ -1094,6 +1095,7 @@ DEFUN (C_call_scheme, (proc, nargs, argvec), { primitive = (Regs [REGBLOCK_PRIMITIVE]); prim_lexpr = (Regs [REGBLOCK_LEXPR_ACTUALS]); + callers_last_return_code = last_return_code; if (! (PRIMITIVE_P (primitive))) abort_to_interpreter (ERR_CANNOT_RECURSE); @@ -1124,6 +1126,7 @@ DEFUN (C_call_scheme, (proc, nargs, argvec), signal_error_from_primitive (ERR_STACK_HAS_SLIPPED); /*NOTREACHED*/ + last_return_code = callers_last_return_code; Regs [REGBLOCK_LEXPR_ACTUALS] = prim_lexpr; Regs [REGBLOCK_PRIMITIVE] = primitive; } -- 2.25.1