From: Robert E. B. <bb...@sp...> - 2005-08-14 00:11:14
|
The following patch to files in the src/runtime directory gets rid of all the C compiler warnings that are currently generated by the HEAD version of SBCL when compiled on my Macintosh OS X, version 10.4.2 with GCC 4.0.0. With the patch installed SBCL compiles itself and passes its tests. I tested the patched code on an Athlon RedHat 7.3 Linux box with GCC 2.96 as well. bob ==================== ? clean ? src/runtime/ppc-darwin-fix-rospace ? src/runtime/ppc-darwin-link-flags ? src/runtime/ppc-darwin-mkrospace Index: src/runtime/bsd-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/bsd-os.c,v retrieving revision 1.27 diff --unified=10 -r1.27 bsd-os.c --- src/runtime/bsd-os.c 14 Jul 2005 15:41:11 -0000 1.27 +++ src/runtime/bsd-os.c 13 Aug 2005 21:30:29 -0000 @@ -62,21 +62,21 @@ int *os_context_pc_addr(os_context_t *context) { #if defined __FreeBSD__ return CONTEXT_ADDR_FROM_STEM(eip); #elif defined __OpenBSD__ return CONTEXT_ADDR_FROM_STEM(pc); #elif defined __NetBSD__ return CONTEXT_ADDR_FROM_STEM(EIP); #elif defined LISP_FEATURE_DARWIN - return &context->uc_mcontext->ss.srr0; + return (int *)&context->uc_mcontext->ss.srr0; #else #error unsupported BSD variant #endif } sigset_t * 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 @@ -133,38 +133,40 @@ void os_protect(os_vm_address_t address, os_vm_size_t length, os_vm_prot_t prot) { if (mprotect(address, length, prot) == -1) { perror("mprotect"); } } static boolean -in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen) +in_range_p(os_vm_address_t a, lispobj *sbeg, size_t slen) { char* beg = (char*) sbeg; char* end = (char*) sbeg + slen; char* adr = (char*) a; return (adr >= beg && adr < end); } boolean is_valid_lisp_addr(os_vm_address_t addr) { struct thread *th; - if(in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) || - in_range_p(addr, STATIC_SPACE_START , STATIC_SPACE_SIZE) || - in_range_p(addr, DYNAMIC_SPACE_START , DYNAMIC_SPACE_SIZE)) + if (in_range_p(addr, + (lispobj *)READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) + || in_range_p(addr, (lispobj *)STATIC_SPACE_START, STATIC_SPACE_SIZE) + || in_range_p(addr, DYNAMIC_SPACE_START, DYNAMIC_SPACE_SIZE)) return 1; for_each_thread(th) { - if((th->control_stack_start <= addr) && (addr < th->control_stack_end)) + if ((os_vm_address_t)th->control_stack_start <= addr + && addr < (os_vm_address_t)th->control_stack_end) return 1; if(in_range_p(addr, th->binding_stack_start, BINDING_STACK_SIZE)) return 1; } return 0; } /* * any OS-dependent special low-level handling for signals */ @@ -205,21 +207,23 @@ memory_fault_handler); SHOW("leaving os_install_interrupt_handlers()"); } #else /* Currently Darwin only */ static void sigsegv_handler(int signal, siginfo_t *info, void* void_context) { os_context_t *context = arch_os_get_context(&void_context); +#if 0 unsigned int pc = (unsigned int *)(*os_context_pc_addr(context)); +#endif os_vm_address_t addr; addr = arch_get_bad_addr(signal,info,context); if(!interrupt_maybe_gc(signal, info, context)) if(!handle_guard_page_triggered(context,addr)) interrupt_handle_now(signal, info, context); /* Work around G5 bug; fix courtesy gbyers */ DARWIN_FIX_CONTEXT(context); } @@ -271,22 +275,23 @@ } #endif /* __NetBSD__ */ /* threads */ /* no threading in any *BSD variant on any CPU (yet? in sbcl-0.8.0 anyway) */ #ifdef LISP_FEATURE_SB_THREAD #error "Define threading support functions" #else int arch_os_thread_init(struct thread *thread) { - stack_t sigstack; #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK + stack_t sigstack; + /* Signal handlers are run on the control stack, so if it is exhausted * we had better use an alternate stack for whatever signal tells us * we've exhausted it */ sigstack.ss_sp=((void *) thread)+dynamic_values_bytes; sigstack.ss_flags=0; sigstack.ss_size = 32*SIGSTKSZ; sigaltstack(&sigstack,0); #endif return 1; /* success */ } Index: src/runtime/core.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/core.h,v retrieving revision 1.8 diff --unified=10 -r1.8 core.h --- src/runtime/core.h 1 Jun 2005 10:07:40 -0000 1.8 +++ src/runtime/core.h 13 Aug 2005 21:30:29 -0000 @@ -31,13 +31,13 @@ #endif }; extern lispobj load_core_file(char *file); /* arbitrary string identifying this build, embedded in .core files to * prevent people mismatching a runtime built e.g. with :SB-SHOW * against a .core built without :SB-SHOW (or against various grosser * mismatches, e.g. a .core built with an old version of the code * against a runtime with patches which add new C code) */ -extern unsigned char build_id[]; +extern char build_id[]; #endif Index: src/runtime/coreparse.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/coreparse.c,v retrieving revision 1.25 diff --unified=10 -r1.25 coreparse.c --- src/runtime/coreparse.c 14 Jul 2005 15:41:11 -0000 1.25 +++ src/runtime/coreparse.c 13 Aug 2005 21:30:30 -0000 @@ -29,21 +29,21 @@ #include "sbcl.h" #include "os.h" #include "runtime.h" #include "globals.h" #include "core.h" #include "arch.h" #include "interr.h" #include "thread.h" -unsigned char build_id[] = +char build_id[] = #include "../../output/build-id.tmp" ; static void process_directory(int fd, u32 *ptr, int count) { struct ndir_entry *entry; FSHOW((stderr, "/process_directory(..), count=%d\n", count)); Index: src/runtime/gc-common.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/gc-common.c,v retrieving revision 1.27 diff --unified=10 -r1.27 gc-common.c --- src/runtime/gc-common.c 2 Aug 2005 15:56:43 -0000 1.27 +++ src/runtime/gc-common.c 13 Aug 2005 21:30:31 -0000 @@ -1484,21 +1484,21 @@ /* Need to remember where all the weak pointers are that have */ /* been transported so they can be fixed up in a post-GC pass. */ copy = copy_object(object, WEAK_POINTER_NWORDS); #ifndef LISP_FEATURE_GENCGC wp = (struct weak_pointer *) native_pointer(copy); gc_assert(widetag_of(wp->header)==WEAK_POINTER_WIDETAG); /* Push the weak pointer onto the list of weak pointers. */ - wp->next = LOW_WORD(weak_pointers); + wp->next = (struct weak_pointer *) LOW_WORD(weak_pointers); weak_pointers = wp; #endif return copy; } static long size_weak_pointer(lispobj *where) { return WEAK_POINTER_NWORDS; } Index: src/runtime/interr.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interr.c,v retrieving revision 1.19 diff --unified=10 -r1.19 interr.c --- src/runtime/interr.c 9 Aug 2005 13:57:51 -0000 1.19 +++ src/runtime/interr.c 13 Aug 2005 21:30:31 -0000 @@ -36,21 +36,21 @@ { exit(1); } static void (*lossage_handler)(void) = default_lossage_handler; void set_lossage_handler(void handler(void)) { lossage_handler = handler; } -never_returns +void lose(char *fmt, ...) { va_list ap; fprintf(stderr, "fatal error encountered in SBCL pid %d",getpid()); #if defined(LISP_FEATURE_SB_THREAD) fprintf(stderr, "(tid %lu)",thread_self()); #endif if (fmt) { fprintf(stderr, ":\n"); va_start(ap, fmt); Index: src/runtime/interr.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interr.h,v retrieving revision 1.3 diff --unified=10 -r1.3 interr.h --- src/runtime/interr.h 22 Oct 2000 15:31:05 -0000 1.3 +++ src/runtime/interr.h 13 Aug 2005 21:30:31 -0000 @@ -5,17 +5,23 @@ * This software is derived from the CMU CL system, which was * written at Carnegie Mellon University and released into the * public domain. The software is in the public domain and is * provided with absolutely no warranty. See the COPYING and CREDITS * files for more information. */ #ifndef _INTERR_H_ #define _INTERR_H_ -extern never_returns lose(char *fmt, ...); +#ifdef __GNUC__ +#define NEVER_RETURNS __attribute__((noreturn)) +#else +#define NEVER_RETURNS +#endif + +extern void lose(char *fmt, ...) NEVER_RETURNS; extern void set_lossage_handler(void fun(void)); extern void describe_internal_error(os_context_t *context); extern lispobj debug_print(lispobj string); #endif Index: src/runtime/interrupt.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.c,v retrieving revision 1.85 diff --unified=10 -r1.85 interrupt.c --- src/runtime/interrupt.c 11 Aug 2005 14:44:16 -0000 1.85 +++ src/runtime/interrupt.c 13 Aug 2005 21:30:32 -0000 @@ -961,23 +961,25 @@ /* This function gets called from the SIGSEGV (for e.g. Linux, NetBSD, & * OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check * whether the signal was due to treading on the mprotect()ed zone - * and if so, arrange for a GC to happen. */ extern unsigned long bytes_consed_between_gcs; /* gc-common.c */ boolean interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context) { os_context_t *context=(os_context_t *) void_context; +#if 0 struct thread *th=arch_os_get_current_thread(); struct interrupt_data *data= th ? th->interrupt_data : global_interrupt_data; +#endif if(!foreign_function_call_active && gc_trigger_hit(signal, info, context)){ struct thread *thread=arch_os_get_current_thread(); clear_auto_gc_trigger(); /* Don't flood the system with interrupts if the need to gc is * already noted. This can happen for example when SUB-GC * allocates or after a gc triggered in a WITHOUT-GCING. */ if (SymbolValue(GC_PENDING,thread) == NIL) { if (SymbolValue(GC_INHIBIT,thread) == NIL) { if (arch_pseudo_atomic_atomic(context)) { @@ -1046,23 +1048,21 @@ return 1; } /* * noise to install handlers */ void undoably_install_low_level_interrupt_handler (int signal, - void handler(int, - siginfo_t*, - void*)) + interrupt_handler_t handler) { struct sigaction sa; struct thread *th=arch_os_get_current_thread(); struct interrupt_data *data= th ? th->interrupt_data : global_interrupt_data; if (0 > signal || signal >= NSIG) { lose("bad signal number %d", signal); } Index: src/runtime/interrupt.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.h,v retrieving revision 1.21 diff --unified=10 -r1.21 interrupt.h --- src/runtime/interrupt.h 11 Aug 2005 14:44:16 -0000 1.21 +++ src/runtime/interrupt.h 13 Aug 2005 21:30:32 -0000 @@ -6,20 +6,21 @@ * written at Carnegie Mellon University and released into the * public domain. The software is in the public domain and is * provided with absolutely no warranty. See the COPYING and CREDITS * files for more information. */ #if !defined(_INCLUDE_INTERRUPT_H_) #define _INCLUDE_INTERRUPT_H_ #include <signal.h> +#include <string.h> /* for memcpy */ /* * This is a workaround for some slightly silly Linux/GNU Libc * behaviour: glibc defines sigset_t to support 1024 signals, which is * more than the kernel. This is usually not a problem, but becomes * one when we want to save a signal mask from a ucontext, and restore * it later into another ucontext: the ucontext is allocated on the * stack by the kernel, so copying a libc-sized sigset_t into it will * overflow and cause other data on the stack to be corrupted */ /* FIXME: do not rely on NSIG being a multiple of 8 */ @@ -74,27 +75,26 @@ os_context_t *context); #if defined LISP_FEATURE_GENCGC /* assembly language stub that executes trap_PendingInterrupt */ extern void do_pending_interrupt(void); #endif #ifdef LISP_FEATURE_SB_THREAD extern void interrupt_thread_handler(int, siginfo_t*, void*); extern void sig_stop_for_gc_handler(int, siginfo_t*, void*); #endif -extern void undoably_install_low_level_interrupt_handler (int signal, - void - handler(int, - siginfo_t*, - void*)); +typedef void (*interrupt_handler_t)(int, siginfo_t *, void *); +extern void undoably_install_low_level_interrupt_handler ( + int signal, + interrupt_handler_t handler); extern unsigned long install_handler(int signal, - void handler(int, siginfo_t*, void*)); + interrupt_handler_t handler); extern union interrupt_handler interrupt_handlers[NSIG]; /* Set all deferrable signals into *s. */ void sigaddset_deferrable(sigset_t *s); /* Set all blockable signals into *s. */ void sigaddset_blockable(sigset_t *s); /* The void* casting here avoids having to mess with the various types * of function argument lists possible for signal handlers: Index: src/runtime/ppc-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-arch.c,v retrieving revision 1.15 diff --unified=10 -r1.15 ppc-arch.c --- src/runtime/ppc-arch.c 14 Jul 2005 15:41:20 -0000 1.15 +++ src/runtime/ppc-arch.c 13 Aug 2005 21:30:32 -0000 @@ -2,20 +2,21 @@ #include "sbcl.h" #include "arch.h" #include "globals.h" #include "validate.h" #include "os.h" #include "lispregs.h" #include "signal.h" #include "interrupt.h" #include "interr.h" +#include "breakpoint.h" /* for declaration of handle_breakpoint */ /* The header files may not define PT_DAR/PT_DSISR. This definition is correct for all versions of ppc linux >= 2.0.30 As of DR2.1u4, MkLinux doesn't pass these registers to signal handlers correctly; a patch is necessary in order to (partially) correct this. Even with the patch, the DSISR may not have its 'write' bit set correctly (it tends not to be set if the fault was caused by @@ -36,28 +37,29 @@ os_vm_address_t arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *context) { unsigned int *pc = (unsigned int *)(*os_context_pc_addr(context)); os_vm_address_t addr; /* Make sure it's not the pc thats bogus, and that it was lisp code */ /* that caused the fault. */ - if ((((unsigned long)pc) & 3) != 0 || - ((pc < READ_ONLY_SPACE_START || - pc >= READ_ONLY_SPACE_START+READ_ONLY_SPACE_SIZE) && - ((lispobj *)pc < current_dynamic_space || - (lispobj *)pc >= current_dynamic_space + DYNAMIC_SPACE_SIZE))) + if ((((unsigned long) pc) & 3) != 0 + || (((unsigned long) pc < READ_ONLY_SPACE_START + || ((unsigned long) pc + >= READ_ONLY_SPACE_START + READ_ONLY_SPACE_SIZE)) + && ((lispobj *) pc < current_dynamic_space + || ((lispobj *) pc + >= current_dynamic_space + DYNAMIC_SPACE_SIZE)))) return 0; - addr = (os_vm_address_t) (*os_context_register_addr(context,PT_DAR)); return addr; } void arch_skip_instruction(os_context_t *context) { char** pcptr; pcptr = (char**) os_context_pc_addr(context); @@ -115,23 +117,25 @@ orig_sigmask = *os_context_sigmask_addr(context); sigaddset_blockable(os_context_sigmask_addr(context)); *pc = orig_inst; os_flush_icache((os_vm_address_t) pc, sizeof(unsigned long)); skipped_break_addr = pc; } static void -sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) +sigtrap_handler(int signal, siginfo_t *siginfo, void *context_pointer) { u32 code; + os_context_t *context = (os_context_t *)context_pointer; + #ifdef LISP_FEATURE_LINUX os_restore_fp_control(context); #endif code=*((u32 *)(*os_context_pc_addr(context))); if (code == ((3 << 26) | (16 << 21) | (reg_ALLOC << 16))) { /* twlti reg_ALLOC,0 - check for deferred interrupt */ *os_context_register_addr(context,reg_ALLOC) -= PSEUDO_ATOMIC_INTERRUPTED_BIAS; arch_skip_instruction(context); /* interrupt or GC was requested in PA; now we're done with the @@ -144,79 +148,81 @@ /* twllei reg_ZERO,N will always trap if reg_ZERO = 0 */ int trap = code & 0x1f; switch (trap) { case trap_Halt: fake_foreign_function_call(context); lose("%%primitive halt called; the party is over.\n"); case trap_Error: case trap_Cerror: - interrupt_internal_error(signal, code, context, trap == trap_Cerror); + interrupt_internal_error(signal, (siginfo_t *)code, context, + trap == trap_Cerror); break; case trap_PendingInterrupt: /* This is supposed run after WITHOUT-INTERRUPTS if there * were pending signals. */ arch_skip_instruction(context); interrupt_handle_pending(context); break; case trap_Breakpoint: - handle_breakpoint(signal, code, context); + handle_breakpoint(signal, (siginfo_t *)code, context); break; case trap_FunEndBreakpoint: *os_context_pc_addr(context) - =(int)handle_fun_end_breakpoint(signal, code, context); + = (int)handle_fun_end_breakpoint(signal, (siginfo_t *)code, + context); break; case trap_AfterBreakpoint: *skipped_break_addr = trap_Breakpoint; skipped_break_addr = NULL; *(unsigned long *)*os_context_pc_addr(context) = displaced_after_inst; *os_context_sigmask_addr(context)= orig_sigmask; os_flush_icache((os_vm_address_t) *os_context_pc_addr(context), sizeof(unsigned long)); break; default: - interrupt_handle_now(signal, code, context); + interrupt_handle_now(signal, (siginfo_t *)code, context); break; } #ifdef LISP_FEATURE_DARWIN DARWIN_FIX_CONTEXT(context); #endif return; } if (((code >> 26) == 3) && (((code >> 21) & 31) == 24)) { - interrupt_internal_error(signal, code, context, 0); + interrupt_internal_error(signal, (siginfo_t *)code, context, 0); #ifdef LISP_FEATURE_DARWIN DARWIN_FIX_CONTEXT(context); #endif return; } - interrupt_handle_now(signal, code, context); + interrupt_handle_now(signal, (siginfo_t *)code, context); #ifdef LISP_FEATURE_DARWIN /* Work around G5 bug */ DARWIN_FIX_CONTEXT(context); #endif } void arch_install_interrupt_handlers() { - undoably_install_low_level_interrupt_handler(SIGILL,sigtrap_handler); - undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGILL, sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGTRAP, sigtrap_handler); } extern lispobj call_into_lisp(lispobj fun, lispobj *args, int nargs); lispobj funcall0(lispobj function) { lispobj *args = current_control_stack_pointer; return call_into_lisp(function, args, 0); Index: src/runtime/ppc-arch.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-arch.h,v retrieving revision 1.4 diff --unified=10 -r1.4 ppc-arch.h --- src/runtime/ppc-arch.h 14 Jul 2005 15:41:21 -0000 1.4 +++ src/runtime/ppc-arch.h 13 Aug 2005 21:30:32 -0000 @@ -9,11 +9,13 @@ static inline void release_spinlock(lispobj *word) { *word=0; } #define ARCH_HAS_LINK_REGISTER +extern void ppc_flush_icache(os_vm_address_t address, os_vm_size_t length); + #endif /* _PPC_ARCH_H */ Index: src/runtime/ppc-darwin-dlshim.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-darwin-dlshim.c,v retrieving revision 1.4 diff --unified=10 -r1.4 ppc-darwin-dlshim.c --- src/runtime/ppc-darwin-dlshim.c 14 Jul 2005 15:41:21 -0000 1.4 +++ src/runtime/ppc-darwin-dlshim.c 13 Aug 2005 21:30:33 -0000 @@ -25,29 +25,29 @@ * dlopen/dlclose/dlsym/dlerror interface to shared libraries, so this * is an attempt at a minimal wrapper to allow SBCL to work without * external dependency on pogma's dlcompat library. */ /* For now, there is no RTLD_GLOBAL emulation either. */ static char dl_self; /* I'm going to abuse this */ static int callback_count; -static struct mach_header* last_header; +static const struct mach_header* last_header; #define DLSYM_ERROR 1 #define DLOPEN_ERROR 2 static int last_error = 0; void -dlshim_image_callback(struct mach_header* ptr, unsigned long phooey) +dlshim_image_callback(const struct mach_header* ptr, intptr_t phooey) { callback_count++; last_header = ptr; } int lib_path_count(void) { char* libpath; int i; @@ -152,21 +152,21 @@ } } } if (img) { if (flags & RTLD_NOW) { NSLookupSymbolInImage(img, "", NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); } if (NSIsSymbolNameDefinedInImage(img, "__init")) { - NSSymbol* initsymbol; + NSSymbol initsymbol; void (*initfunc) (void); initsymbol = NSLookupSymbolInImage(img, "__init", 0); initfunc = NSAddressOfSymbol(initsymbol); initfunc(); } } else last_error = DLOPEN_ERROR; return img; } } @@ -197,30 +197,30 @@ } return result; } void* dlsym(void* handle, char* symbol) { if (handle == &dl_self) { if (NSIsSymbolNameDefined(symbol)) { - NSSymbol* retsym; + NSSymbol retsym; retsym = NSLookupAndBindSymbol(symbol); return NSAddressOfSymbol(retsym); } else { last_error = DLSYM_ERROR; return NULL; } } else { if (NSIsSymbolNameDefinedInImage(handle, symbol)) { - NSSymbol* retsym; + NSSymbol retsym; retsym = NSLookupSymbolInImage(handle, symbol, 0); return NSAddressOfSymbol(retsym); } else { last_error = DLSYM_ERROR; return NULL; } } } int Index: src/runtime/ppc-darwin-langinfo.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-darwin-langinfo.c,v retrieving revision 1.2 diff --unified=10 -r1.2 ppc-darwin-langinfo.c --- src/runtime/ppc-darwin-langinfo.c 14 Jul 2005 15:41:21 -0000 1.2 +++ src/runtime/ppc-darwin-langinfo.c 13 Aug 2005 21:30:33 -0000 @@ -10,20 +10,21 @@ * more information. * * This software is derived from the CMU CL system, which was * written at Carnegie Mellon University and released into the * public domain. The software is in the public domain and is * provided with absolutely no warranty. See the COPYING and CREDITS * files for more information. */ #include <stdlib.h> +#include <string.h> /* for strcmp */ #include "ppc-darwin-langinfo.h" char *nl_langinfo(nl_item item) { char *nada = "", *utf8 = "UTF-8", *latin1 = "LATIN-1"; if (item != CODESET) { return nada; } else { char *ctype = getenv ("LC_CTYPE"); Index: src/runtime/ppc-darwin-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-darwin-os.c,v retrieving revision 1.4 diff --unified=10 -r1.4 ppc-darwin-os.c --- src/runtime/ppc-darwin-os.c 14 Jul 2005 15:41:21 -0000 1.4 +++ src/runtime/ppc-darwin-os.c 13 Aug 2005 21:30:33 -0000 @@ -12,101 +12,104 @@ * public domain. The software is in the public domain and is * provided with absolutely no warranty. See the COPYING and CREDITS * files for more information. */ #include "sbcl.h" #include "globals.h" #include <signal.h> #include <ucontext.h> #include "bsd-os.h" +#include "interr.h" /* for declaratin of lose */ -os_context_register_t * +os_context_register_t * os_context_register_addr(os_context_t *context, int offset) { ppc_saved_state_t *state = &context->uc_mcontext->ss; switch(offset) { case 0: - return &state->r0; + return (os_context_register_t *) &state->r0; case 1: - return &state->r1; + return (os_context_register_t *) &state->r1; case 2: - return &state->r2; + return (os_context_register_t *) &state->r2; case 3: - return &state->r3; + return (os_context_register_t *) &state->r3; case 4: - return &state->r4; + return (os_context_register_t *) &state->r4; case 5: - return &state->r5; + return (os_context_register_t *) &state->r5; case 6: - return &state->r6; + return (os_context_register_t *) &state->r6; case 7: - return &state->r7; + return (os_context_register_t *) &state->r7; case 8: - return &state->r8; + return (os_context_register_t *) &state->r8; case 9: - return &state->r9; + return (os_context_register_t *) &state->r9; case 10: - return &state->r10; + return (os_context_register_t *) &state->r10; case 11: - return &state->r11; + return (os_context_register_t *) &state->r11; case 12: - return &state->r12; + return (os_context_register_t *) &state->r12; case 13: - return &state->r13; + return (os_context_register_t *) &state->r13; case 14: - return &state->r14; + return (os_context_register_t *) &state->r14; case 15: - return &state->r15; + return (os_context_register_t *) &state->r15; case 16: - return &state->r16; + return (os_context_register_t *) &state->r16; case 17: - return &state->r17; + return (os_context_register_t *) &state->r17; case 18: - return &state->r18; + return (os_context_register_t *) &state->r18; case 19: - return &state->r19; + return (os_context_register_t *) &state->r19; case 20: - return &state->r20; + return (os_context_register_t *) &state->r20; case 21: - return &state->r21; + return (os_context_register_t *) &state->r21; case 22: - return &state->r22; + return (os_context_register_t *) &state->r22; case 23: - return &state->r23; + return (os_context_register_t *) &state->r23; case 24: - return &state->r24; + return (os_context_register_t *) &state->r24; case 25: - return &state->r25; + return (os_context_register_t *) &state->r25; case 26: - return &state->r26; + return (os_context_register_t *) &state->r26; case 27: - return &state->r27; + return (os_context_register_t *) &state->r27; case 28: - return &state->r28; + return (os_context_register_t *) &state->r28; case 29: - return &state->r29; + return (os_context_register_t *) &state->r29; case 30: - return &state->r30; + return (os_context_register_t *) &state->r30; case 31: - return &state->r31; + return (os_context_register_t *) &state->r31; case 41: /* PT_DAR */ - return &context->uc_mcontext->es.dar; + return (os_context_register_t *) &context->uc_mcontext->es.dar; case 42: /* PT_DSISR */ - return &context->uc_mcontext->es.dsisr; + return (os_context_register_t *) &context->uc_mcontext->es.dsisr; + default: + lose("bad offset to os_context_register_addr"); } } os_context_register_t * os_context_lr_addr(os_context_t *context) { - return &context->uc_mcontext->ss.lr; + return (os_context_register_t *) &context->uc_mcontext->ss.lr; } void os_flush_icache(os_vm_address_t address, os_vm_size_t length) { /* see ppc-arch.c */ ppc_flush_icache(address,length); } Index: src/runtime/runtime.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/runtime.h,v retrieving revision 1.21 diff --unified=10 -r1.21 runtime.h --- src/runtime/runtime.h 9 Aug 2005 13:57:52 -0000 1.21 +++ src/runtime/runtime.h 13 Aug 2005 21:30:33 -0000 @@ -139,20 +139,11 @@ #define fixnum_value(n) (((long)n)>>N_FIXNUM_TAG_BITS) /* Too bad ANSI C doesn't define "bool" as C++ does.. */ typedef int boolean; /* This only works for static symbols. */ /* FIXME: should be called StaticSymbolFunction, right? */ #define SymbolFunction(sym) \ (((struct fdefn *)(native_pointer(SymbolValue(sym,0))))->fun) -/* KLUDGE: As far as I can tell there's no ANSI C way of saying - * "this function never returns". This is the way that you do it - * in GCC later than version 2.7 or so. If you are using some - * compiler that doesn't understand this, you could could just - * change it to "typedef void never_returns" and nothing would - * break, though you might get a few more bytes of compiled code or - * a few more compiler warnings. -- WHN 2000-10-21 */ -typedef volatile void never_returns; - #endif /* _SBCL_RUNTIME_H_ */ Index: src/runtime/validate.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/validate.c,v retrieving revision 1.26 diff --unified=10 -r1.26 validate.c --- src/runtime/validate.c 14 Jul 2005 15:41:21 -0000 1.26 +++ src/runtime/validate.c 13 Aug 2005 21:30:33 -0000 @@ -14,20 +14,22 @@ */ #include <stdio.h> #include <stdlib.h> #include "sbcl.h" #include "runtime.h" #include "os.h" #include "globals.h" #include "validate.h" +#include "interr.h" /* for declaration of lose */ + static void ensure_space(lispobj *start, unsigned long size) { if (os_validate((os_vm_address_t)start,(os_vm_size_t)size)==NULL) { fprintf(stderr, "ensure_space: failed to validate %ld bytes at 0x%08lx\n", size, (unsigned long)start); fprintf(stderr, Index: src/runtime/x86-64-arch.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-64-arch.h,v retrieving revision 1.6 diff --unified=10 -r1.6 x86-64-arch.h --- src/runtime/x86-64-arch.h 14 Jul 2005 15:41:21 -0000 1.6 +++ src/runtime/x86-64-arch.h 13 Aug 2005 21:30:33 -0000 @@ -2,28 +2,29 @@ * reserved for the system libraries? If so, it would be tidy to * rename flags like _X86_ARCH_H so their names are in a part of the * namespace that we control. */ #ifndef _X86_64_ARCH_H #define _X86_64_ARCH_H #ifndef SBCL_GENESIS_CONFIG #error genesis/config.h (or sbcl.h) must be included before this file #endif +#include "interr.h" /* for declaration of lose() */ + #define ARCH_HAS_STACK_POINTER /* FIXME: Do we also want * #define ARCH_HAS_FLOAT_REGISTERS * here? (The answer wasn't obvious to me when merging the * architecture-abstracting patches for CSR's SPARC port. -- WHN 2002-02-15) */ -extern never_returns lose(char *fmt, ...); static inline void get_spinlock(volatile lispobj *word,long value) { #ifdef LISP_FEATURE_SB_THREAD u64 rax=0; if(*word==value) lose("recursive get_spinlock: 0x%x,%ld\n",word,value); do { asm ("xor %0,%0\n\ Index: src/runtime/x86-arch.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-arch.h,v retrieving revision 1.9 diff --unified=10 -r1.9 x86-arch.h --- src/runtime/x86-arch.h 14 Jul 2005 15:41:21 -0000 1.9 +++ src/runtime/x86-arch.h 13 Aug 2005 21:30:33 -0000 @@ -2,28 +2,29 @@ * reserved for the system libraries? If so, it would be tidy to * rename flags like _X86_ARCH_H so their names are in a part of the * namespace that we control. */ #ifndef _X86_ARCH_H #define _X86_ARCH_H #ifndef SBCL_GENESIS_CONFIG #error genesis/config.h (or sbcl.h) must be included before this file #endif +#include "interr.h" /* for declaration of lose() */ + #define ARCH_HAS_STACK_POINTER /* FIXME: Do we also want * #define ARCH_HAS_FLOAT_REGISTERS * here? (The answer wasn't obvious to me when merging the * architecture-abstracting patches for CSR's SPARC port. -- WHN 2002-02-15) */ -extern never_returns lose(char *fmt, ...); static inline void get_spinlock(volatile lispobj *word,long value) { #ifdef LISP_FEATURE_SB_THREAD u32 eax=0; if(*word==value) lose("recursive get_spinlock: 0x%x,%ld\n",word,value); do { asm ("xor %0,%0\n\ |