Skip to content

Commit

Permalink
0.8.7.57:
Browse files Browse the repository at this point in the history
	merged Brian Mastenbrook's "SBCL-on-Darwin state" patch
		(sbcl-devel 2004-02-18)
  • Loading branch information
William Harold Newman committed Feb 20, 2004
1 parent 1f7f3d7 commit ded744f
Show file tree
Hide file tree
Showing 23 changed files with 145 additions and 34 deletions.
3 changes: 2 additions & 1 deletion contrib/asdf-install/installer.lisp
Expand Up @@ -249,7 +249,8 @@
(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
Expand Down
6 changes: 6 additions & 0 deletions make-target-1.sh
Expand Up @@ -35,3 +35,9 @@ cd tools-for-build
$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 ..
30 changes: 27 additions & 3 deletions src/runtime/Config.ppc-darwin
@@ -1,17 +1,41 @@
# -*- 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
ARCH_SRC = ppc-arch.c

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.
2 changes: 1 addition & 1 deletion src/runtime/GNUmakefile
Expand Up @@ -55,7 +55,7 @@ sbcl: ${OBJS}

.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)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/breakpoint.c
Expand Up @@ -12,9 +12,9 @@
#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"
Expand Down
10 changes: 6 additions & 4 deletions src/runtime/bsd-os.c
Expand Up @@ -21,14 +21,14 @@
#include <stdio.h>
#include <sys/param.h>
#include <sys/file.h>
#include "sbcl.h"
#include "./signal.h"
#include "os.h"
#include "arch.h"
#include "globals.h"
#include "interrupt.h"
#include "interr.h"
#include "lispregs.h"
#include "sbcl.h"
#include "thread.h"

#include <sys/types.h>
Expand All @@ -50,7 +50,7 @@ int *os_context_pc_addr(os_context_t *context)
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
Expand All @@ -63,7 +63,7 @@ os_context_sigmask_addr(os_context_t *context)
/* (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;
Expand Down Expand Up @@ -166,7 +166,7 @@ memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context)
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
Expand Down Expand Up @@ -200,6 +200,8 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/bsd-os.h
Expand Up @@ -48,7 +48,7 @@ typedef ucontext_t os_context_t;
#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-
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/coreparse.c
Expand Up @@ -26,13 +26,13 @@
#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[] =
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/globals.h
Expand Up @@ -59,7 +59,7 @@ extern void globals_init(void);
#endif
#endif
#ifdef ppc
#ifdef DARWIN
#ifdef LISP_FEATURE_DARWIN
#define EXTERN(name,bytes) .globl _/**/name
#else
#define EXTERN(name,bytes) .globl name
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/interr.c
Expand Up @@ -17,11 +17,11 @@
#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"
Expand Down
9 changes: 8 additions & 1 deletion src/runtime/interrupt.c
Expand Up @@ -48,9 +48,9 @@
#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"
Expand Down Expand Up @@ -536,6 +536,10 @@ maybe_now_maybe_later(int signal, siginfo_t *info, void *void_context)
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
Expand Down Expand Up @@ -575,6 +579,9 @@ interrupt_handle_now_handler(int signal, siginfo_t *info, void *void_context)
{
os_context_t *context = arch_os_get_context(&void_context);
interrupt_handle_now(signal, info, context);
#ifdef LISP_FEATURE_DARWIN
sigreturn(void_context);
#endif
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/monitor.c
Expand Up @@ -326,7 +326,7 @@ print_context(os_context_t *context)
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
Expand Down
1 change: 1 addition & 0 deletions src/runtime/os-common.c
Expand Up @@ -13,6 +13,7 @@
#include <errno.h>
#include <strings.h>

#include "sbcl.h"
#include "os.h"
#include "interr.h"

Expand Down
11 changes: 11 additions & 0 deletions src/runtime/ppc-arch.c
@@ -1,5 +1,6 @@
#include <stdio.h>

#include "sbcl.h"
#include "arch.h"
#include "sbcl.h"
#include "globals.h"
Expand Down Expand Up @@ -185,14 +186,24 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context)
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
}


Expand Down
22 changes: 11 additions & 11 deletions src/runtime/ppc-assem.S
Expand Up @@ -9,13 +9,13 @@
#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:
Expand All @@ -32,7 +32,7 @@ x:
FUNCDEF(x)
#endif

#if defined DARWIN
#if defined LISP_FEATURE_DARWIN
#define SET_SIZE(x)
#else
#define SET_SIZE(x) .size x,.-x
Expand All @@ -41,7 +41,7 @@ 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
Expand All @@ -56,7 +56,7 @@ x:
#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)
Expand All @@ -67,7 +67,7 @@ x:
#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)
Expand All @@ -86,7 +86,7 @@ x:
#define RESTORE_GPR(n) lwz n,-4*(32-(n))(11)
#endif

#ifdef DARWIN
#ifdef LISP_FEATURE_DARWIN
#define C_FULL_PROLOG \
nop @\
nop @ \
Expand Down Expand Up @@ -302,7 +302,7 @@ x:
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
Expand Down Expand Up @@ -334,7 +334,7 @@ x:
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
Expand Down Expand Up @@ -436,7 +436,7 @@ lra:
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
Expand All @@ -445,7 +445,7 @@ lra:
bctrl

/* Re-establish NIL */
#ifdef DARWIN
#ifdef LISP_FEATURE_DARWIN
lis reg_NULL,hi16(NIL)
ori reg_NULL,reg_NULL,lo16(NIL)
#else
Expand Down

0 comments on commit ded744f

Please sign in to comment.