2 * This is the ARM Linux incarnation of arch-dependent OS-dependent
3 * routines. See also "linux-os.c".
7 * This software is part of the SBCL system. See the README file for
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.
18 #include <sys/param.h>
25 #include "interrupt.h"
28 #include <sys/socket.h>
29 #include <sys/utsname.h>
31 #include <sys/types.h>
39 size_t os_vm_page_size
;
42 int arch_os_thread_init(struct thread
*thread
) {
44 #ifdef LISP_FEATURE_SB_THREAD
45 #ifdef LISP_FEATURE_GCC_TLS
46 current_thread
= thread
;
48 pthread_setspecific(specials
,thread
);
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
55 sigstack
.ss_sp
=((char *) thread
)+dynamic_values_bytes
;
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
);
86 os_context_sigmask_addr(os_context_t
*context
)
88 return &(context
->uc_sigmask
);
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
];
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
);