Change immobile space free pointers to alien vars
[sbcl.git] / src / runtime / hpux-os.c
blobb633a6ac592c32fd1b90e32e8fda5649348f56c6
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <signal.h>
4 #include <sys/file.h>
6 #include <unistd.h>
7 #include <errno.h>
8 #include <sys/param.h>
9 #include <sys/utsname.h>
11 #include "sbcl.h"
12 #include "os.h"
13 #include "arch.h"
14 #include "interr.h"
15 #include "interrupt.h"
16 #include "globals.h"
17 #include "validate.h"
18 #include "target-arch-os.h"
20 #ifdef LISP_FEATURE_GENCGC
21 #error gencgc not ported to hpux
22 #endif
24 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
25 #error C_STACK_IS_CONTROL_STACK isnt supported
26 #endif
28 size_t os_vm_page_size;
30 void
31 os_init(char *argv[], char *envp[])
33 os_vm_page_size = BACKEND_PAGE_BYTES;
36 os_vm_address_t
37 os_validate(boolean movable, os_vm_address_t addr, os_vm_size_t len)
39 os_vm_address_t actual;
40 int flags = MAP_PRIVATE | MAP_ANONYMOUS;
41 if (addr) flags |= MAP_FIXED;
43 actual = mmap(addr, len, OS_VM_PROT_ALL, flags, -1, 0);
45 if (actual == MAP_FAILED) {
46 perror("mmap");
47 lose("os_validate(): mmap() failure\n");
50 if (addr && (addr!=actual)) {
51 fprintf(stderr, "mmap: wanted %lu bytes at %p, actually mapped at %p\n",
52 (unsigned long) len, addr, actual);
53 return 0;
56 return actual;
59 void
60 os_invalidate(os_vm_address_t addr, os_vm_size_t len)
62 if (munmap(addr,len) == -1) {
63 perror("munmap");
64 lose("os_invalidate(): mmap() failure\n");
68 void
69 os_protect(os_vm_address_t addr, os_vm_size_t len, os_vm_prot_t prot)
71 if (mprotect(addr, len, prot) == -1) {
72 perror("mprotect");
77 * any OS-dependent special low-level handling for signals
80 static void
81 sigsegv_handler(int signal, siginfo_t *info, os_context_t *context)
83 os_vm_address_t addr = arch_get_bad_addr(signal, info, context);
85 if (!cheneygc_handle_wp_violation(context, addr))
86 if (!handle_guard_page_triggered(context, addr))
87 lisp_memory_fault_error(context, addr);
88 *((os_context_register_t *) &((ucontext_t *) context)->uc_mcontext.ss_flags)
89 |= SS_MODIFIEDWIDE;
92 void
93 os_install_interrupt_handlers(void)
95 undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT,
96 sigsegv_handler);
99 char *
100 os_get_runtime_executable_path(int external)
102 return NULL;
105 /* when inside call_into_lisp, we will first jump to the stub
106 * and then the stub will jump into the lisp function. Then
107 * the lisp function will return to the stub function and
108 * the stub will return to the call_into_lisp function.
110 void *return_from_lisp_stub;
111 void
112 setup_return_from_lisp_stub (void *addr)
114 return_from_lisp_stub = addr;