Draft NEWS for sbcl-2.4.10
[sbcl.git] / src / runtime / arm64-linux-os.c
blobd425ffd6ba7badce0445a9a7a45d8d3a939bd5e2
1 /*
2 * This is the ARM Linux incarnation of arch-dependent OS-dependent
3 * routines. See also "linux-os.c".
4 */
6 /*
7 * This software is part of the SBCL system. See the README file for
8 * more information.
10 * This software is derived from the CMU CL system, which was
11 * written at Carnegie Mellon University and released into the
12 * public domain. The software is in the public domain and is
13 * provided with absolutely no warranty. See the COPYING and CREDITS
14 * files for more information.
17 #include <stdio.h>
18 #include <sys/param.h>
19 #include <sys/file.h>
20 #include "genesis/sbcl.h"
21 #include "os.h"
22 #include "arch.h"
23 #include "globals.h"
24 #include "interrupt.h"
25 #include "interr.h"
26 #include "lispregs.h"
28 #include <sys/types.h>
29 #include <signal.h>
30 #include <sys/time.h>
31 #include <sys/stat.h>
32 #include <unistd.h>
33 #include <errno.h>
35 #include "validate.h"
37 int arch_os_thread_init(struct thread *thread) {
38 stack_t sigstack;
39 /* Signal handlers are normally run on the main stack, but we've
40 * swapped stacks, require that the control stack contain only
41 * boxed data, and expands upwards while the C stack expands
42 * downwards. */
43 sigstack.ss_sp = calc_altstack_base(thread);
44 sigstack.ss_flags = 0;
45 sigstack.ss_size = calc_altstack_size(thread);
46 if(sigaltstack(&sigstack,0)<0)
47 lose("Cannot sigaltstack: %s",strerror(errno));
49 return 1; /* success */
51 int arch_os_thread_cleanup(struct thread *thread) {
52 return 1; /* success */
55 os_context_register_t *
56 os_context_register_addr(os_context_t *context, int offset)
58 return (os_context_register_t *)&(context->uc_mcontext.regs[offset]);
61 os_context_register_t *
62 os_context_lr_addr(os_context_t *context)
64 return os_context_register_addr(context, reg_LR);
67 sigset_t *
68 os_context_sigmask_addr(os_context_t *context)
70 return &(context->uc_sigmask);
73 os_context_register_t *
74 os_context_flags_addr(os_context_t *context)
76 return (os_context_register_t *)&(context->uc_mcontext.pstate);
79 void
80 os_restore_fp_control(os_context_t *context)
82 /* FIXME: Implement. */
85 os_context_register_t *
86 os_context_float_register_addr(os_context_t *context, int offset)
88 /* KLUDGE: neither glibc nor the kernel can settle down on a name,
89 the kernel used __reserved, now glibc uses __glibc_reserved1.
90 Hardcode it until they make up their mind */
91 return (os_context_register_t*)
92 &((struct fpsimd_context *)((uintptr_t)&context->uc_mcontext + 288))->vregs[offset];
95 void
96 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
98 os_vm_address_t end_address
99 = (os_vm_address_t)(((uintptr_t) address) + length);
100 __clear_cache(address, end_address);
103 // To avoid "Missing required foreign symbol" errors in os_link_runtime()
104 // the executable must actually depend on libm. It would not require libm,
105 // despite -lm in the link step, if there is no reference to a libm symbol
106 // observable to the linker. Any one symbol suffices to resolve all of them.
107 #include <math.h>
108 const long libm_anchor = (long)acos;
110 #include <sys/types.h>
111 #include <sys/stat.h>
112 #include <unistd.h>
113 int _stat(const char *pathname, struct stat *sb) {return stat(pathname, sb); }
114 int _lstat(const char *pathname, struct stat *sb) { return lstat(pathname, sb); }
115 int _fstat(int fd, struct stat *sb) { return fstat(fd, sb); }