2 * This is the MIPS 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>
24 #include "interrupt.h"
28 #include <sys/socket.h>
29 #include <sys/utsname.h>
31 #include <sys/types.h>
38 /* for cacheflush() */
39 #include <asm/cachectl.h>
41 /* FIXME: For CAUSEF_BD */
42 #include <asm/mipsregs.h>
43 size_t os_vm_page_size;
46 os_context_register_t *
47 os_context_register_addr(os_context_t *context, int offset)
50 /* KLUDGE: I'm not sure, but it's possible that Linux puts the
51 contents of the Processor Status Word in the (wired-zero)
52 slot in the mcontext. In any case, the following is
53 unlikely to do any harm: */
54 static unsigned long long zero;
58 return &(((struct sigcontext *) &(context->uc_mcontext))->sc_regs[offset]);
62 os_context_register_t *
63 os_context_pc_addr(os_context_t *context)
65 /* Why do I get all the silly ports? -- CSR, 2002-08-11 */
66 return &(((struct sigcontext *) &(context->uc_mcontext))->sc_pc);
70 os_context_sigmask_addr(os_context_t *context)
72 return &(context->uc_sigmask);
76 os_restore_fp_control(os_context_t *context)
78 /* FIXME: Probably do something. */
82 os_context_bd_cause(os_context_t *context)
84 /* We need to see if whatever happened, happened because of a
86 /* FIXME: However, I'm not convinced that the values that Linux
87 puts in this slot are actually right; specifically, attempting
88 to compile sbcl with sbcl-0.7.7.7 lead to an "infinite SIGTRAP
89 loop" where a (BREAK 16) not in a branch delay slot would have
90 CAUSEF_BD filled. So, we comment
92 return (((struct sigcontext *) &(context->uc_mcontext))->sc_cause
95 out and return 0 always. -- CSR, 2002-09-02 */
100 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
102 if (cacheflush(address, length, ICACHE) == -1)
103 perror("cacheflush");