(let* ((tar
(with-output-to-string (o)
(or
- (sb-ext:run-program "tar"
+ (sb-ext:run-program #-darwin "tar"
+ #+darwin "gnutar"
(list "-C" (namestring source)
"-xzvf" (namestring packagename))
:output o
$GNUMAKE -I../src/runtime grovel-headers || exit 1
cd ..
tools-for-build/grovel-headers > output/stuff-groveled-from-headers.lisp
+
+# after-grovel-headers may not exist for all platforms (used for
+# Darwin hacks)
+cd src/runtime
+$GNUMAKE after-grovel-headers || true
+cd ..
# -*- makefile -*-
-CFLAGS = -DDARWIN -Dppc -g -Wall -O3 -no-cpp-precomp
+CFLAGS = -Dppc -g -Wall -O3 -no-cpp-precomp
OS_SRC = bsd-os.c os-common.c ppc-darwin-os.c ppc-darwin-dlshim.c
OS_LIBS = -lSystem -lc -lm
-# Avoid the dreaded gcc 3.3 prerelease tarpit of death!
+# Avoid the gcc 3.3 prerelease tarpit of death!
CC = gcc3
ASSEM_SRC = ppc-assem.S ldso-stubs.S
CPP = cpp -no-cpp-precomp
-OS_LINK_FLAGS = -dynamic -L$(HOME)/local/lib -L/sw/lib -L/opt/local/lib -L/usr/local/lib
+# FIXME - "-Wl,-segaddr,SBCLRO,0x1000000" is output from
+# ppc-darwin-mkrospace (it depends on READ_ONLY_SPACE I believe) but it
+# is hard-coded here!
+OS_LINK_FLAGS = -dynamic -L$(HOME)/local/lib -L/sw/lib -L/opt/local/lib -L/usr/local/lib -Wl,-segaddr,SBCLRO,0x1000000 -Wl,-seg1addr,0x5000000 $(if $(AFTER_GROVEL_HEADERS),ppc-darwin-rospace.o)
GC_SRC= cheneygc.c
+CLEAN_FILES += ppc-darwin-mkrospace
+
+ppc-darwin-mkrospace: ppc-darwin-mkrospace.c
+ $(CC) -o $@ $<
+
+ppc-darwin-rospace.o: ppc-darwin-mkrospace
+ ./ppc-darwin-mkrospace
+
+.PHONY: after-grovel-headers
+
+# Rebuild the sbcl runtime to avoid Panther placing the heap where
+# it wants read only space (in the first 32 megabytes, where it
+# can be absolute-branched to with BA.) Must be done after
+# grovel-headers, because Apple's nm is broken.
+after-grovel-headers: ppc-darwin-rospace.o
+ rm -f sbcl
+ $(GNUMAKE) sbcl AFTER_GROVEL_HEADERS=1
+
+# Fortunatly make-target-1.sh does a make clean all the time.
+# Otherwise we would have to make sure that sbcl gets rebuilt without
+# the readonlyspace hack before groveling headers again.
.PHONY: clean all
clean:
- -rm -f depend *.o sbcl sbcl.nm core *.tmp
+ -rm -f depend *.o sbcl sbcl.nm core *.tmp $(CLEAN_FILES)
TAGS: $(SRCS)
etags $(SRCS)
#include <stdio.h>
#include <signal.h>
+#include "sbcl.h"
#include "runtime.h"
#include "os.h"
-#include "sbcl.h"
#include "interrupt.h"
#include "arch.h"
#include "lispregs.h"
#include <stdio.h>
#include <sys/param.h>
#include <sys/file.h>
+#include "sbcl.h"
#include "./signal.h"
#include "os.h"
#include "arch.h"
#include "interrupt.h"
#include "interr.h"
#include "lispregs.h"
-#include "sbcl.h"
#include "thread.h"
#include <sys/types.h>
return CONTEXT_ADDR_FROM_STEM(eip);
#elif defined __OpenBSD__
return CONTEXT_ADDR_FROM_STEM(pc);
-#elif defined DARWIN
+#elif defined LISP_FEATURE_DARWIN
return &context->uc_mcontext->ss.srr0;
#else
#error unsupported BSD variant
/* (Unlike most of the other context fields that we access, the
* signal mask field is a field of the basic, outermost context
* struct itself both in FreeBSD 4.0 and in OpenBSD 2.6.) */
-#if defined __FreeBSD__ || defined DARWIN
+#if defined __FreeBSD__ || defined LISP_FEATURE_DARWIN
return &context->uc_sigmask;
#elif defined __OpenBSD__
return &context->sc_mask;
void *fault_addr = siginfo->si_addr;
#elif defined __OpenBSD__
void *fault_addr = siginfo->si_addr;
-#elif defined DARWIN
+#elif defined LISP_FEATURE_DARWIN
void *fault_addr = siginfo->si_addr;
#else
#error unsupported BSD variant
if(!interrupt_maybe_gc(signal, info, context))
if(!handle_control_stack_guard_triggered(context,addr))
interrupt_handle_now(signal, info, context);
+ /* Work around G5 bug; fix courtesy gbyers */
+ sigreturn(void_context);
}
void
#elif defined __OpenBSD__
typedef struct sigcontext os_context_t;
#define SIG_MEMORY_FAULT SIGSEGV
-#elif defined DARWIN
+#elif defined LISP_FEATURE_DARWIN
/* man pages claim that the third argument is a sigcontext struct,
but ucontext_t is defined, matches sigcontext where sensible,
offers better access to mcontext, and is of course the SUSv2-
#include <fcntl.h>
#endif
+#include "sbcl.h"
#include "os.h"
#include "runtime.h"
#include "globals.h"
#include "core.h"
#include "arch.h"
#include "interr.h"
-#include "sbcl.h"
#include "thread.h"
unsigned char build_id[] =
#endif
#endif
#ifdef ppc
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define EXTERN(name,bytes) .globl _/**/name
#else
#define EXTERN(name,bytes) .globl name
#include <stdarg.h>
#include <stdlib.h>
+#include "sbcl.h"
#include "arch.h"
#include "signal.h"
#include "runtime.h"
-#include "sbcl.h"
#include "interr.h"
#include "print.h"
#include "lispregs.h"
#include <sys/types.h>
#include <sys/wait.h>
+#include "sbcl.h"
#include "runtime.h"
#include "arch.h"
-#include "sbcl.h"
#include "os.h"
#include "interrupt.h"
#include "globals.h"
signal,info,context))
return;
interrupt_handle_now(signal, info, context);
+#ifdef LISP_FEATURE_DARWIN
+ /* Work around G5 bug */
+ sigreturn(void_context);
+#endif
}
#ifdef LISP_FEATURE_SB_THREAD
{
os_context_t *context = arch_os_get_context(&void_context);
interrupt_handle_now(signal, info, context);
+#ifdef LISP_FEATURE_DARWIN
+ sigreturn(void_context);
+#endif
}
/*
brief_print((lispobj)(*os_context_register_addr(context,i)));
#endif
}
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
printf("DAR:\t\t 0x%08lx\n", (unsigned long)(*os_context_register_addr(context, 41)));
printf("DSISR:\t\t 0x%08lx\n", (unsigned long)(*os_context_register_addr(context, 42)));
#endif
#include <errno.h>
#include <strings.h>
+#include "sbcl.h"
#include "os.h"
#include "interr.h"
#include <stdio.h>
+#include "sbcl.h"
#include "arch.h"
#include "sbcl.h"
#include "globals.h"
interrupt_handle_now(signal, code, context);
break;
}
+#ifdef LISP_FEATURE_DARWIN
+ sigreturn(context);
+#endif
return;
}
if (((code >> 26) == 3) && (((code >> 21) & 31) == 24)) {
interrupt_internal_error(signal, code, context, 0);
+#ifdef LISP_FEATURE_DARWIN
+ sigreturn(context);
+#endif
return;
}
interrupt_handle_now(signal, code, context);
+#ifdef LISP_FEATURE_DARWIN
+ /* Work around G5 bug */
+ sigreturn(context);
+#endif
}
#include "genesis/closure.h"
#include "genesis/static-symbols.h"
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define CSYMBOL(x) _ ## x
#else
#define CSYMBOL(x) x
#endif
-#if defined DARWIN
+#if defined LISP_FEATURE_DARWIN
#define FUNCDEF(x) .text @ \
.align 3 @ \
_##x:
FUNCDEF(x)
#endif
-#if defined DARWIN
+#if defined LISP_FEATURE_DARWIN
#define SET_SIZE(x)
#else
#define SET_SIZE(x) .size x,.-x
/* Load a register from a global, using the register as an intermediary */
/* The register will be a fixnum for one instruction, so this is gc-safe */
-#if defined DARWIN
+#if defined LISP_FEATURE_DARWIN
#define load(reg,global) \
lis reg,ha16(global) @ \
lwz reg,lo16(global)(reg) ; Comment
#endif
#define FIRST_SAVE_FPR 14 /* lowest-numbered non-volatile FPR */
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define FIRST_SAVE_GPR 13 /* lowest-numbered non-volatile GPR */
#define NGPR_SAVE_BYTES(n) ((32-(n))*4)
#define FRAME_ARG_BYTES(n) (((((n)+6)*4)+15)&~15)
#endif
#define NFPR_SAVE_BYTES(n) ((32-(n))*8)
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define FRAME_SIZE(first_g,first_f,out_arg_words,savecr) \
(NFPR_SAVE_BYTES(first_f)+ NGPR_SAVE_BYTES(first_g)+ FRAME_ARG_BYTES(out_arg_words))
#define SAVE_FPR(n) stfd f##n,-8*(32- n)(r11)
#define RESTORE_GPR(n) lwz n,-4*(32-(n))(11)
#endif
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define C_FULL_PROLOG \
nop @\
nop @ \
li reg_L1,0
li reg_L2,0
li reg_LIP,0
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
lis reg_NULL,hi16(NIL)
ori reg_NULL,reg_NULL,lo16(NIL)
#else
lwz reg_A3,12(reg_CFP)
/* Calculate LRA */
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
lis reg_LRA,ha16(lra)
addi reg_LRA,reg_LRA,lo16(lra)
#else
twlti reg_ALLOC,0
mr reg_NL3,reg_NARGS
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
/* PowerOpen (i.e. OS X) requires the callee address in r12
(a.k.a. CFUNC), so move it back there, too. */
mfctr reg_CFUNC
bctrl
/* Re-establish NIL */
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
lis reg_NULL,hi16(NIL)
ori reg_NULL,reg_NULL,lo16(NIL)
#else
--- /dev/null
+/* ppc-darwin-mkrospace.c - write a .o which makes sure we get our desired address range */
+
+#include <stdlib.h>
+#include <string.h>
+#include <mach-o/loader.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "runtime.h"
+#include "sbcl.h"
+
+struct simple_object_file
+{
+ struct mach_header theheader;
+ struct segment_command thesegment;
+ struct section thesection;
+};
+
+int main(int argc, char** argv)
+{
+ struct simple_object_file *theobj;
+ int fd;
+ theobj = (struct simple_object_file*) malloc(sizeof(struct simple_object_file));
+ theobj->theheader.magic = MH_MAGIC;
+ theobj->theheader.cputype = CPU_TYPE_POWERPC;
+ theobj->theheader.cpusubtype = CPU_SUBTYPE_POWERPC_ALL;
+ theobj->theheader.filetype = MH_OBJECT;
+ theobj->theheader.ncmds = 1;
+ theobj->theheader.sizeofcmds = sizeof(struct segment_command) + sizeof(struct section);
+ theobj->theheader.flags = MH_NOUNDEFS;
+ theobj->thesegment.cmd = LC_SEGMENT;
+ theobj->thesegment.cmdsize = sizeof(struct segment_command) + sizeof(struct section);
+ memcpy(theobj->thesegment.segname, "", sizeof(char));
+ theobj->thesegment.fileoff = sizeof(struct mach_header);
+ theobj->thesegment.vmaddr = READ_ONLY_SPACE_START;
+ theobj->thesegment.vmsize = READ_ONLY_SPACE_END - READ_ONLY_SPACE_START;
+ theobj->thesegment.maxprot = VM_PROT_ALL;
+ theobj->thesegment.initprot = VM_PROT_ALL;
+ theobj->thesegment.nsects = 1;
+ theobj->thesegment.flags = 0;
+ memcpy(theobj->thesection.sectname, "core", 5);
+ memcpy(theobj->thesection.segname, "SBCLRO", 7);
+ theobj->thesection.addr = READ_ONLY_SPACE_START;
+ theobj->thesection.size = READ_ONLY_SPACE_END - READ_ONLY_SPACE_START;
+ theobj->thesection.offset = sizeof(struct mach_header) + sizeof(struct segment_command) + sizeof(struct section);
+ theobj->thesection.align = 0;
+ theobj->thesection.reloff = 0;
+ theobj->thesection.nreloc = 0;
+ theobj->thesection.flags = S_ZEROFILL | S_REGULAR | S_ATTR_SOME_INSTRUCTIONS;
+ theobj->thesection.reserved1 = 0;
+ theobj->thesection.reserved2 = 0;
+ fd = open("ppc-darwin-rospace.o", O_WRONLY | O_CREAT, 0644);
+ write(fd, theobj, sizeof(struct simple_object_file));
+ close(fd);
+ printf("-Wl,-segaddr,SBCLRO,0x%x\n",READ_ONLY_SPACE_START);
+ return 0;
+}
* files for more information.
*/
-
+#include "sbcl.h"
#include "globals.h"
#include <signal.h>
#include <ucontext.h>
-#if defined DARWIN
+#if defined LISP_FEATURE_DARWIN
#if defined LANGUAGE_ASSEMBLY
#define REG(num) r##num
#else
#define reg_NL6 REG(9) /* Last (7th) FF param */
#define reg_FDEFN REG(10) /* was NL7 until recently -dan */
#define reg_NARGS REG(11)
-#ifdef DARWIN
+#ifdef LISP_FEATURE_DARWIN
#define reg_CFUNC REG(12) /* Silly to blow a reg on FF-name */
#define reg_NFP REG(13) /* Lisp may save around FF-call */
#else
#include <strings.h>
#include <errno.h>
+#include "sbcl.h"
#include "runtime.h"
#include "os.h"
-#include "sbcl.h"
#include "globals.h"
#include "validate.h"
#include "interrupt.h"
#include <signal.h>
#include <sys/file.h>
+#include "sbcl.h"
#include "runtime.h"
#include "os.h"
-#include "sbcl.h"
#include "core.h"
#include "globals.h"
#include "save.h"
#include <stdio.h>
#include <stdlib.h>
+#include "sbcl.h"
#include "runtime.h"
#include "os.h"
#include "globals.h"
-#include "sbcl.h"
#include "validate.h"
static void
#include <sys/types.h>
#include <stdlib.h>
+#include "sbcl.h"
#include "runtime.h"
#include "vars.h"
#include "os.h"
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.7.56"
+"0.8.7.57"