0.7.1.20:
[sbcl.git] / src / runtime / sparc-linux-os.c
1 /*
2  * This is the SPARC Linux incarnation of arch-dependent OS-dependent
3  * routines. See also "linux-os.c".
4  */
5
6 /*
7  * This software is part of the SBCL system. See the README file for
8  * more information.
9  *
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.
15  */
16
17 #include <stdio.h>
18 #include <sys/param.h>
19 #include <sys/file.h>
20 #include "./signal.h"
21 #include "os.h"
22 #include "arch.h"
23 #include "globals.h"
24 #include "interrupt.h"
25 #include "interr.h"
26 #include "lispregs.h"
27 #include "sbcl.h"
28 #include <sys/socket.h>
29 #include <sys/utsname.h>
30
31 #include <sys/types.h>
32 #include <signal.h>
33 /* #include <sys/sysinfo.h> */
34 #include <sys/time.h>
35 #include <sys/stat.h>
36 #include <unistd.h>
37
38 #include "validate.h"
39 size_t os_vm_page_size;
40
41 #if defined GENCGC              /* unlikely ... */
42 #include "gencgc.h"
43 #endif
44
45 os_context_register_t   *
46 os_context_register_addr(os_context_t *context, int offset)
47 {
48   /* printf("Offset: %d,", offset);
49      printf("Context: %p\n", context);
50      printf("PC: %x,", context->si_regs.pc);
51      printf("NPC: %x\n", context->si_regs.npc); */
52   if (offset == 0) {
53     static int zero;
54     zero = 0;
55     /* printf("Returning: %p pointing to %p\n", &zero, zero); */
56     return &zero;
57   } else if (offset < 16) {
58     /* printf("Returning: %p pointing to %p\n", &context->si_regs.u_regs[offset], context->si_regs.u_regs[offset]); */
59     return &context->si_regs.u_regs[offset];
60   } else if (offset < 32) {
61     int *sp = (int*) context->si_regs.u_regs[14]; /* Stack Pointer ?? */
62     /* printf("SP: %p\n", sp);
63        printf("Returning: %p pointing to %p\n", &(sp[offset-16]), sp[offset-16]); */
64     return &(sp[offset-16]);
65   } else
66     return 0;
67 }
68
69 os_context_register_t *
70 os_context_pc_addr(os_context_t *context)
71 {
72   return &(context->si_regs.pc);
73 }
74
75 os_context_register_t *
76 os_context_npc_addr(os_context_t *context)
77 {
78   return &(context->si_regs.npc);
79 }
80
81 sigset_t *
82 os_context_sigmask_addr(os_context_t *context)
83 {
84   return &(context->si_mask);
85 }
86
87 void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
88 {
89   /* FIXME.  There's a bit of stuff in the CMUCL version. It may or
90      may not be needed */
91 }