From e50e46c206f119234fc50483557028048b9fc8ae Mon Sep 17 00:00:00 2001
From: cwang <cwang>
Date: Thu, 20 May 2004 00:32:25 +0000
Subject: [PATCH] A couple simple fixes to compile a lisp executable

---
 lisp/Linux-os.c  | 6 +++++-
 lisp/interrupt.c | 8 +++++++-
 lisp/lisp.c      | 4 ++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/Linux-os.c b/lisp/Linux-os.c
index 2670648f6..356909f98 100644
--- a/lisp/Linux-os.c
+++ b/lisp/Linux-os.c
@@ -15,7 +15,7 @@
  * GENCGC support by Douglas Crosher, 1996, 1997.
  * Alpha support by Julian Dolby, 1999.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.17 2004/05/19 22:37:40 cwang Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.18 2004/05/20 00:32:24 cwang Exp $
  *
  */
 
@@ -231,7 +231,11 @@ void sigsegv_handler(HANDLER_ARGS)
 {
   GET_CONTEXT
 
+#if (LINUX_VERSION_CODE >= linuxversion(2,1,0)) || (__GNU_LIBRARY__ >= 6)
+  int  fault_addr = ((struct sigcontext *) (&contextstruct))->cr2;
+#else
   int  fault_addr = ((struct sigcontext_struct *) (&contextstruct))->cr2;
+#endif
   int  page_index = find_page_index((void *) fault_addr);
 
 #ifdef RED_ZONE_HIT
diff --git a/lisp/interrupt.c b/lisp/interrupt.c
index 642738f79..77c5d643e 100644
--- a/lisp/interrupt.c
+++ b/lisp/interrupt.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.35 2004/05/19 22:28:43 cwang Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.36 2004/05/20 00:32:24 cwang Exp $ */
 
 /* Interrupt handing magic. */
 
@@ -661,6 +661,11 @@ interrupt_handle_space_overflow(lispobj error, struct sigcontext *context)
   /* ECX is the argument count.  */
   context->sc_eip = (int) ((struct function *) PTR (error))->code;
   context->sc_ecx = 0;
+#else
+#ifdef __x86_64
+  /* RCX is the argument count.  */
+  context->sc_rip = (unsigned long) ((struct function *) PTR (error))->code;
+  context->sc_rcx = 0;
 #else
   build_fake_control_stack_frame (context);
   /* This part should be common to all non-x86 ports */
@@ -672,6 +677,7 @@ interrupt_handle_space_overflow(lispobj error, struct sigcontext *context)
   /* This is sparc specific */
   SC_REG(context, reg_CODE) = ((long) PTR(error)) + type_FunctionPointer;
 #endif
+#endif
 }
 
 void interrupt_init(void)
diff --git a/lisp/lisp.c b/lisp/lisp.c
index bc9ba40ac..17e8fbbea 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.39 2004/05/19 22:42:53 cwang Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.40 2004/05/20 00:32:25 cwang Exp $
  *
  */
 
@@ -577,7 +577,7 @@ int main(int argc, char *argv[], char *envp[])
     if(builtin_image_flag != 0) {
       extern int image_dynamic_space_size;
       long allocation_pointer = (long) dynamic_0_space + (int)&image_dynamic_space_size;
-#ifdef i386
+#if defined(i386) || defined(__x86_64)
       SetSymbolValue(ALLOCATION_POINTER, (lispobj)allocation_pointer);
 #else
       current_dynamic_space_free_pointer = (lispobj*)allocation_pointer;
-- 
GitLab