45c9ffbee46126bfe8b1ca807e82bace04e67456
[sbcl.git] / src / runtime / alpha-linux-os.c
1 /*
2  * This is the Compaq/Digital Alpha Linux incarnation of
3  * arch-dependent OS-dependent routines. See also "linux-os.c".  */
4
5 /*
6  * This software is part of the SBCL system. See the README file for
7  * more information.
8  *
9  * This software is derived from the CMU CL system, which was
10  * written at Carnegie Mellon University and released into the
11  * public domain. The software is in the public domain and is
12  * provided with absolutely no warranty. See the COPYING and CREDITS
13  * files for more information.
14  */
15
16 /* These header files were lifted wholesale from linux-os.c, some may
17  * be redundant. -- Dan Barlow ca. 2001-05-01 */
18 #include <stdio.h>
19 #include <sys/param.h>
20 #include <sys/file.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 "sbcl.h"
29 #include <sys/socket.h>
30 #include <sys/utsname.h>
31
32 #include <sys/types.h>
33 #include <signal.h>
34 #include <sys/time.h>
35 #include <sys/stat.h>
36 #include <unistd.h>
37 #include <asm/fpu.h>
38
39 #include "validate.h"
40 size_t os_vm_page_size;
41
42 #if defined GENCGC              /* unlikely ... */
43 #error SBCL Alpha does not work with the GENCGC
44 #include "gencgc.h"
45 #endif
46
47 os_context_register_t   *
48 os_context_register_addr(os_context_t *context, int offset)
49 {
50     return &context->uc_mcontext.sc_regs[offset];
51 }
52
53 os_context_register_t *
54 os_context_float_register_addr(os_context_t *context, int offset)
55 {
56     return &context->uc_mcontext.sc_fpregs[offset];
57 }
58
59 os_context_register_t *
60 os_context_pc_addr(os_context_t *context)
61 {
62     return &((context->uc_mcontext).sc_pc);
63 }
64
65 sigset_t *
66 os_context_sigmask_addr(os_context_t *context)
67 {
68     return &context->uc_sigmask;
69 }
70
71 unsigned long
72 os_context_fp_control(os_context_t *context)
73 {
74     return ieee_fpcr_to_swcr((context->uc_mcontext).sc_fpcr);
75 }
76
77 void
78 os_restore_fp_control(os_context_t *context)
79 {
80     /* FIXME (in two parts):
81        Firstly, what happens in alpha linux inside the signal handler?
82        Does the floating point control state get cleared as in other
83        Linuxes?
84     
85        Secondly, how do we put it back if so? It will probably involve
86        something to do with
87     
88        context->uc_mcontext.sc_fpcr
89
90        (maybe a simple assembly statement will be enough)
91     */ 
92 }
93
94 void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
95 {
96     asm volatile ("imb" : : : "memory" );
97 }