X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fosf1-os.c;h=fc6a1f8a7d5e680d5a363a191a9654d258ac0659;hb=ed1910efb36f71b5ebe33b5ffffd7195e15644de;hp=c3aa9fcb5cc70c474eba1a99f62a8ea11c7d9885;hpb=48f92d19cf12f3aff81a29a786970264a523bc7a;p=sbcl.git diff --git a/src/runtime/osf1-os.c b/src/runtime/osf1-os.c index c3aa9fc..fc6a1f8 100644 --- a/src/runtime/osf1-os.c +++ b/src/runtime/osf1-os.c @@ -4,9 +4,9 @@ * interface looks a lot like the Mach interface (but simpler in some * places). For some operating systems, a subset of these functions * will have to be emulated. - * + * * This is the OSF/1 version, based on the Linux version, itself based - * on the OSF1 version from CMUCL by Sean Hallgren. Now _there's_ + * on the OSF1 version from CMUCL by Sean Hallgren. Now _there's_ * a metacircularity for you ... */ @@ -24,6 +24,7 @@ #include #include #include +#include "sbcl.h" #include "./signal.h" #include "os.h" #include "arch.h" @@ -31,7 +32,6 @@ #include "interrupt.h" #include "interr.h" #include "lispregs.h" -#include "sbcl.h" #include #include #include @@ -49,16 +49,12 @@ #include "validate.h" size_t os_vm_page_size; -#if defined GENCGC -#include "gencgc.h" -#endif -void os_init(void) +void +os_init(char *argv[], char *envp[]) { - - os_vm_page_size = getpagesize(); - + os_vm_page_size = BACKEND_PAGE_BYTES; } @@ -70,8 +66,8 @@ os_validate(os_vm_address_t addr, os_vm_size_t len) else flags |= MAP_VARIABLE; if((addr=mmap(addr,len,OS_VM_PROT_ALL,flags,-1,0)) == (os_vm_address_t) -1) - perror("mmap"); - + perror("mmap"); + return addr; } @@ -79,7 +75,7 @@ void os_invalidate(os_vm_address_t addr, os_vm_size_t len) { if (munmap(addr,len) == -1) { - perror("munmap"); + perror("munmap"); } } @@ -87,13 +83,13 @@ os_vm_address_t os_map(int fd, int offset, os_vm_address_t addr, os_vm_size_t len) { addr = mmap(addr, len, - OS_VM_PROT_ALL, - MAP_PRIVATE | MAP_FILE | MAP_FIXED, - fd, (off_t) offset); + OS_VM_PROT_ALL, + MAP_PRIVATE | MAP_FILE | MAP_FIXED, + fd, (off_t) offset); if (addr == MAP_FAILED) { - perror("mmap"); - lose("unexpected mmap(..) failure"); + perror("mmap"); + lose("unexpected mmap(..) failure\n"); } return addr; @@ -103,7 +99,7 @@ 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"); + perror("mprotect"); } } @@ -114,9 +110,9 @@ is_valid_lisp_addr(os_vm_address_t addr) os_vm_address_t newaddr; newaddr=os_trunc_to_page(addr); if((ret=mvalid(newaddr,newaddr-addr+4,OS_VM_PROT_ALL)) == 0) - return TRUE; + return TRUE; else if(errno==EINVAL) - perror("mvalid"); + perror("mvalid"); return FALSE; } @@ -126,25 +122,18 @@ is_valid_lisp_addr(os_vm_address_t addr) static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); - os_vm_address_t addr = arch_get_bad_addr(signal,info,context); - - if (addr != NULL && - *os_context_register_addr(context,reg_ALLOC) & (1L<<63)){ - /* this is lifted from linux-os.c, so violates OOAO */ - *os_context_register_addr(context,reg_ALLOC) -= (1L<<63); - interrupt_handle_pending(context); - } else if(((addr>=DYNAMIC_0_SPACE_END) && (addr=DYNAMIC_1_SPACE_END) && (addr