Try to make the :lurking-threads test more robust.
[sbcl.git] / src / runtime / arm64-linux-os.c
blob9d4facaa83896aa744022d66f352944976b0ba95
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=((char *) 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 (os_context_register_t *)&(context->uc_mcontext.regs[offset]);
73 os_context_register_t *
74 os_context_pc_addr(os_context_t *context)
76 return (os_context_register_t *)&(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 /* KLUDGE: neither glibc nor the kernel can settle down on a name,
101 the kernel used __reserved, now glibc uses __glibc_reserved1.
102 Hardcode it until they make up their mind */
103 return (os_context_register_t*)
104 &((struct fpsimd_context *)((uintptr_t)&context->uc_mcontext + 288))->vregs[offset];
107 void
108 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
110 os_vm_address_t end_address
111 = (os_vm_address_t)(((uintptr_t) address) + length);
112 __clear_cache(address, end_address);