* Patch by Robert Brown.
#ifdef LISP_FEATURE_STACK_GROWS_DOWNWARD_NOT_UPWARD
#error "!C_STACK_IS_CONTROL_STACK and STACK_GROWS_DOWNWARD_NOT_UPWARD is not supported"
#endif
- *current_control_stack_pointer = result;
+ *current_control_stack_pointer = (lispobj) result;
current_control_stack_pointer += 1;
#endif
do_pending_interrupt();
#ifndef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
current_control_stack_pointer -= 1;
- result = *current_control_stack_pointer;
+ result = (lispobj *) *current_control_stack_pointer;
#endif
}
#else
#include "sbcl.h"
#include "runtime.h"
+#ifdef LISP_FEATURE_GENCGC
+extern lispobj *alloc(int bytes);
+#endif
+
extern lispobj alloc_cons(lispobj car, lispobj cdr);
extern lispobj alloc_number(long n);
extern lispobj alloc_string(char *str);
static int
altstack_pointer_p (void *p) {
#ifndef LISP_FEATURE_WIN32
- char* stack_start = ((char *) arch_os_get_current_thread())
- + dynamic_values_bytes;
- char* stack_end = stack_start + 32*SIGSTKSZ;
+ void* stack_start = arch_os_get_current_thread() + dynamic_values_bytes;
+ void* stack_end = stack_start + 32*SIGSTKSZ;
return (p > stack_start && p <= stack_end);
#else
backtrace(int nframes)
{
void *fp;
- int i;
#if defined(LISP_FEATURE_X86)
asm("movl %%ebp,%0" : "=g" (fp));
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, 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))
return 1;
for_each_thread(th) {
- if(((os_vm_address_t)th->control_stack_start <= addr) &&
- (addr < (os_vm_address_t)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, (lispobj)th->binding_stack_start,
- BINDING_STACK_SIZE))
+ if (in_range_p(addr, (lispobj) th->binding_stack_start,
+ BINDING_STACK_SIZE))
return 1;
}
return 0;
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);
* 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
/* lutex stuff */
#if defined(LISP_FEATURE_SB_THREAD) && defined(LISP_FEATURE_SB_LUTEX)
#include "genesis/sap.h"
+#include "pthread-lutex.h"
#endif
-unsigned char build_id[] =
+char build_id[] =
#include "../../output/build-id.tmp"
;
struct lutex *lutex = lutexes_to_resurrect[i];
FSHOW((stderr, "re-init'ing lutex @ %p\n", lutex));
- lutex_init(lutex);
+ lutex_init((tagged_lutex_t) lutex);
}
free(lutexes_to_resurrect);
*/
#include <stdlib.h>
+#include <string.h>
#include "darwin-langinfo.h"
char *nl_langinfo(nl_item item)
os_get_runtime_executable_path()
{
char path[PATH_MAX + 1];
- size_t size = sizeof(path);
+ uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == -1)
return NULL;
#include "genesis/hash-table.h"
#include "genesis/instance.h"
#include "genesis/layout.h"
-
-#ifdef LUTEX_WIDETAG
-#include "genesis/lutex.h"
+#include "gencgc.h"
+#if defined(LUTEX_WIDETAG)
+#include "pthread-lutex.h"
#endif
/* forward declarations */
while (lutex) {
struct lutex *next = lutex->next;
if (!lutex->live) {
- lutex_destroy(lutex);
+ lutex_destroy((tagged_lutex_t) lutex);
gencgc_unregister_lutex(lutex);
}
lutex = next;
static lispobj
trans_lutex(lispobj object)
{
- struct lutex *lutex = native_pointer(object);
+ struct lutex *lutex = (struct lutex *) native_pointer(object);
lispobj copied;
size_t words = CEILING(sizeof(struct lutex)/sizeof(lispobj), 2);
gc_assert(is_lisp_pointer(object));
/* Update the links, since the lutex moved in memory. */
if (lutex->next) {
- lutex->next->prev = native_pointer(copied);
+ lutex->next->prev = (struct lutex *) native_pointer(copied);
}
if (lutex->prev) {
- lutex->prev->next = native_pointer(copied);
+ lutex->prev->next = (struct lutex *) native_pointer(copied);
} else {
- generations[lutex->gen].lutexes = native_pointer(copied);
+ generations[lutex->gen].lutexes =
+ (struct lutex *) native_pointer(copied);
}
return copied;
(lispobj *)pointer));
}
+#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
+
/* Is there any possibility that pointer is a valid Lisp object
* reference, and/or something else (e.g. subroutine call return
* address) which should prevent us from moving the referred-to thing?
return 1;
}
-#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
-
/* Adjust large bignum and vector objects. This will adjust the
* allocated region if the size has shrunk, and move unboxed objects
* into unboxed pages. The pages are not promoted here, and the
return;
}
-#endif
-
/* Take a possible pointer to a Lisp object and mark its page in the
* page_table so that it will not be relocated during a GC.
*
* It is also assumed that the current gc_alloc() region has been
* flushed and the tables updated. */
-#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
-
static void
preserve_pointer(void *addr)
{
gc_assert(page_table[addr_page_index].dont_move != 0);
}
-#endif
+#endif // defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
\f
/* If the given page is not write-protected, then scan it for pointers
unsigned long bytes_freed;
page_index_t i;
unsigned long static_space_size;
+#if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)
struct thread *th;
+#endif
gc_assert(generation <= HIGHEST_NORMAL_GENERATION);
/* The oldest generation can't be raised. */
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());
+ fprintf(stderr, "(tid %lu)", (unsigned long) thread_self());
#endif
if (fmt) {
fprintf(stderr, ":\n");
*(register_save_area + 7) = *os_context_register_addr(context,reg_EAX);
*(register_save_area + 8) = *context_eflags_addr(context);
- *os_context_pc_addr(context) = call_into_lisp_tramp;
- *os_context_register_addr(context,reg_ECX) = register_save_area;
+ *os_context_pc_addr(context) =
+ (os_context_register_t) call_into_lisp_tramp;
+ *os_context_register_addr(context,reg_ECX) =
+ (os_context_register_t) register_save_area;
#else
/* return address for call_into_lisp: */
void
undoably_install_low_level_interrupt_handler (int signal,
- void handler(int,
- siginfo_t*,
- void*))
+ interrupt_handler_t handler)
{
struct sigaction sa;
#define REAL_SIGSET_SIZE_BYTES ((NSIG/8))
extern void check_blockables_blocked_or_lose();
+extern void check_gc_signals_unblocked_or_lose();
+extern void unblock_gc_signals();
static inline void
sigcopyset(sigset_t *new, sigset_t *old)
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];
struct dirent64 *
readdir_largefile(DIR *dir) {
- return readdir(dir);
+ return readdir64(dir);
}
#endif
#include "interrupt.h"
#include "interr.h"
#include "breakpoint.h"
+#include "alloc.h"
#if defined(LISP_FEATURE_GENCGC)
#include "gencgc-alloc-region.h"
}
static void
-sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context)
+sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context)
{
unsigned int code;
+ os_context_t *context = void_context;
#ifdef LISP_FEATURE_LINUX
os_restore_fp_control(context);
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);
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);
}
void
#define ARCH_HAS_LINK_REGISTER
+extern void ppc_flush_icache(os_vm_address_t address, os_vm_size_t length);
+
#endif /* _PPC_ARCH_H */
#include <ucontext.h>
#include <limits.h>
#include <mach-o/dyld.h>
-#include "bsd-os.h"
+#include "arch.h"
+#include "interr.h" /* for declaration of lose */
#ifdef LISP_FEATURE_SB_THREAD
#error "Define threading support functions"
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;
}
os_context_register_t *
#elif defined(LISP_FEATURE_PPC) && defined(LISP_FEATURE_GENCGC)
#define set_alloc_pointer(value) \
- (dynamic_space_free_pointer = \
- (value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK))
+ (dynamic_space_free_pointer = \
+ ((lispobj *) \
+ ((value) | (((unsigned long)dynamic_space_free_pointer) & LOWTAG_MASK))))
#define get_alloc_pointer() \
((unsigned long) dynamic_space_free_pointer & ~LOWTAG_MASK)
#include "arch.h"
#include "target-arch-os.h"
#include "os.h"
+#include "pthread-lutex.h"
+#include "gencgc.h"
#include "genesis/lutex.h"
-typedef unsigned long tagged_lutex_t;
-
#if 1
# define lutex_assert(ex) \
do { \
#include "genesis/primitive-objects.h"
#include "genesis/static-symbols.h"
#include "genesis/layout.h"
+#include "gencgc.h"
/* We don't ever do purification with GENCGC as of 1.0.5.*. There was
* a lot of hairy and fragile ifdeffage in here to support purify on
return ptrans_unboxed(thing, header);
#ifdef LUTEX_WIDETAG
case LUTEX_WIDETAG:
- gencgc_unregister_lutex(native_pointer(thing));
+ gencgc_unregister_lutex((struct lutex *) native_pointer(thing));
return ptrans_unboxed(thing, header);
#endif
file);
{
unsigned char *p;
- for (p = build_id; *p; ++p)
+ for (p = (unsigned char *)build_id; *p; ++p)
write_lispobj(*p, file);
}
#if defined(LISP_FEATURE_SB_THREAD) && defined(LISP_FEATURE_SB_LUTEX)
if(n_lutexes > 0) {
long offset;
- printf("writing %d lutexes to the core...\n", n_lutexes);
+ printf("writing %ld lutexes to the core...\n", n_lutexes);
write_lispobj(LUTEX_TABLE_CORE_ENTRY_TYPE_CODE, file);
/* word count of the entry */
write_lispobj(4, file);
#include "globals.h"
#include "interr.h"
#include "validate.h"
+#include "interr.h" /* for declaration of lose */
+
static void
ensure_space(lispobj *start, unsigned long size)
void
sigtrap_handler(int signal, siginfo_t *info, void *void_context)
{
- int code = info->si_code;
os_context_t *context = (os_context_t*)void_context;
unsigned int trap;
#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
#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
;;; 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".)
-"1.0.6.50"
+"1.0.6.51"