--- gcc-2.7.2.2/config/i386/i386.h.orig	Mon Jul 14 15:22:45 1997
+++ gcc-2.7.2.2/config/i386/i386.h	Wed Aug  6 11:43:16 1997
@@ -764,7 +764,8 @@
 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
 
 /* Offset of first parameter from the argument pointer register value.  */
-#define FIRST_PARM_OFFSET(FNDECL) 0
+/* we need to change this to allow for space of the canaryvalue. */
+#define FIRST_PARM_OFFSET(FNDECL) 4
 
 /* Value is the number of bytes of arguments automatically
    popped when returning from a subroutine call.
--- gcc-2.7.2.2/config/i386/i386.c.orig	Mon Jul 14 15:32:55 1997
+++ gcc-2.7.2.2/config/i386/i386.c	Tue Jul 22 08:52:09 1997
@@ -57,6 +57,8 @@
 char *qi_reg_name[] = QI_REGISTER_NAMES;
 char *qi_high_reg_name[] = QI_HIGH_REGISTER_NAMES;
 
+int canarynum=0;
+
 /* Array of the smallest class containing reg number REGNO, indexed by
    REGNO.  Used by REGNO_REG_CLASS in i386.h. */
 
@@ -1461,6 +1463,9 @@
   rtx xops[4];
   int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
 				  || current_function_uses_const_pool);
+	output_asm_insn ("/* begin prologue with size */", xops);
+	output_asm_insn ("/* push on the canaryvalue */", xops);
+	output_asm_insn ("pushl $23",xops);
 
   xops[0] = stack_pointer_rtx;
   xops[1] = frame_pointer_rtx;
@@ -1502,6 +1507,7 @@
       output_asm_insn (AS1 (pop%L0,%0), xops);
       output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops);
     }
+	output_asm_insn ("/* end prologue */", xops);
 }
 
 /* Return 1 if it is appropriate to emit `ret' instructions in the
@@ -1556,6 +1562,8 @@
   rtx xops[3];
   int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
 				  || current_function_uses_const_pool);
+	output_asm_insn ("/* begin epilogue */", xops);
+	fprintf(stderr,"canary: %d\n",canarynum);
 
   /* Compute the number of registers to pop */
 
@@ -1612,6 +1620,7 @@
 
   if (frame_pointer_needed)
     {
+		output_asm_insn ("/* frame pointer needed */", xops);
       /* On i486, mov & pop is faster than "leave". */
 
       if (!TARGET_386)
@@ -1619,12 +1628,17 @@
 	  xops[0] = frame_pointer_rtx;
 	  output_asm_insn (AS2 (mov%L2,%0,%2), xops);
 	  output_asm_insn ("pop%L0 %0", xops);
+/*		output_asm_insn ("add%L0 $4,%2", xops); */
 	}
       else
+			{
 	output_asm_insn ("leave", xops);
+/*			output_asm_insn ("add%L0 $4,%2",xops); */
+			}
     }
   else if (size)
     {
+			output_asm_insn ("/* size is present */",xops);
       /* If there is no frame pointer, we must still release the frame. */
 
       xops[0] = GEN_INT (size);
@@ -1648,10 +1662,29 @@
 	  output_asm_insn ("jmp %*%0", xops);
 	}
       else
+			{
 	  output_asm_insn ("ret %1", xops);
+		fprintf(stderr,"funky ret thingy...\n");
+			}
     }
   else
+		{
+		xops[0] = frame_pointer_rtx;
+		output_asm_insn ("/* begin of canary check routine */",xops);
+		output_asm_insn ("xor $23,(%2)",xops);
+		fprintf(file,"\tjz .canary%d\n",canarynum);
+		output_asm_insn ("push%L0 %0",xops);
+		output_asm_insn ("mov%L2 %2,%0",xops);
+		output_asm_insn ("pushl $4",xops);
+		output_asm_insn ("call raise",xops);
+		output_asm_insn ("addl $4,%2",xops);
+		ASM_OUTPUT_INTERNAL_LABEL (file, "canary",canarynum);
+		output_asm_insn ("add%L0 $4,%2",xops);
+		output_asm_insn ("/* end of canary check routine */",xops);
     output_asm_insn ("ret", xops);
+		}
+	output_asm_insn ("/* end epilogue */", xops);
+	canarynum++;
 }
 
 

