Take pointer, not word count, as upper limit in verify_space()
[sbcl.git] / src / runtime / arm64-linux-os.c
blob67524870c907b03f8109555b02325e2dbcc28f66
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 "sbcl.h"
21 #include "./signal.h"
22 #include "os.h"
23 #include "arch.h"
24 #include "globals.h"
25 #include "interrupt.h"
26 #include "interr.h"
27 #include "lispregs.h"
28 #include <sys/socket.h>
29 #include <sys/utsname.h>
31 #include <sys/types.h>
32 #include <signal.h>
33 #include <sys/time.h>
34 #include <sys/stat.h>
35 #include <unistd.h>
36 #include <errno.h>
38 #include "validate.h"
39 size_t os_vm_page_size;
42 int arch_os_thread_init(struct thread *thread) {
43 stack_t sigstack;
44 #ifdef LISP_FEATURE_SB_THREAD
45 #ifdef LISP_FEATURE_GCC_TLS
46 current_thread = thread;
47 #else
48 pthread_setspecific(specials,thread);
49 #endif
50 #endif
51 /* Signal handlers are normally run on the main stack, but we've
52 * swapped stacks, require that the control stack contain only
53 * boxed data, and expands upwards while the C stack expands
54 * downwards. */
55 sigstack.ss_sp=((void *) thread)+dynamic_values_bytes;
56 sigstack.ss_flags=0;
57 sigstack.ss_size = 32*SIGSTKSZ;
58 if(sigaltstack(&sigstack,0)<0)
59 lose("Cannot sigaltstack: %s\n",strerror(errno));
61 return 1; /* success */
63 int arch_os_thread_cleanup(struct thread *thread) {
64 return 1; /* success */
67 os_context_register_t *
68 os_context_register_addr(os_context_t *context, int offset)
70 return &(context->uc_mcontext.regs[offset]);
73 os_context_register_t *
74 os_context_pc_addr(os_context_t *context)
76 return &(context->uc_mcontext.pc);
79 os_context_register_t *
80 os_context_lr_addr(os_context_t *context)
82 return os_context_register_addr(context, reg_LR);
85 sigset_t *
86 os_context_sigmask_addr(os_context_t *context)
88 return &(context->uc_sigmask);
91 void
92 os_restore_fp_control(os_context_t *context)
94 /* FIXME: Implement. */
97 os_context_register_t *
98 os_context_float_register_addr(os_context_t *context, int offset)
100 return (os_context_register_t*)
101 &((struct fpsimd_context *)context->uc_mcontext.__reserved)->vregs[offset];
104 void
105 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
107 os_vm_address_t end_address
108 = (os_vm_address_t)(((pointer_sized_uint_t) address) + length);
109 __clear_cache(address, end_address);