Update of /cvsroot/sbcl/sbcl/src/runtime
In directory usw-pr-cvs1:/tmp/cvs-serv9122/src/runtime
Modified Files:
alpha-linux-os.h hppa-linux-os.h linux-os.h ppc-linux-os.h
sparc-linux-os.h x86-linux-os.h
Added Files:
Config.mips-linux mips-arch.c mips-arch.h mips-assem.S
mips-linux-os.c mips-linux-os.h mips-lispregs.h
Log Message:
0.7.7.9:
Commit MIPS backend
... one or two modifications to extant code, as per CSR sbcl-devel
2002-08-31
... lots of new files
--- NEW FILE: Config.mips-linux ---
# This software is part of the SBCL system. See the README file for
# more information.
#
# This software is derived from the CMU CL system, which was
# written at Carnegie Mellon University and released into the
# public domain. The software is in the public domain and is
# provided with absolutely no warranty. See the COPYING and CREDITS
# files for more information.
CFLAGS += -g -O0
LD = ld
LINKFLAGS = -v -g
NM = nm -p
ASSEM_SRC = mips-assem.S #hppa-linux-stubs.S
ARCH_SRC = mips-arch.c undefineds.c
OS_SRC = linux-os.c mips-linux-os.c os-common.c
LINKFLAGS+=-static
OS_LIBS= -ldl
GC_SRC= cheneygc.c
--- NEW FILE: mips-arch.c ---
/*
$Header: /cvsroot/sbcl/sbcl/src/runtime/mips-arch.c,v 1.1 2002/09/01 22:34:18 crhodes Exp $
This code was written as part of the CMU Common Lisp project at
Carnegie Mellon University, and has been placed in the public domain.
*/
#include <stdio.h>
#include "runtime.h"
#include "arch.h"
#include "sbcl.h"
#include "globals.h"
#include "validate.h"
#include "os.h"
#include "lispregs.h"
#include "signal.h"
#include "alloc.h"
#include "interrupt.h"
#include "interr.h"
#include "breakpoint.h"
#include "monitor.h"
void arch_init()
{
return;
}
os_vm_address_t arch_get_bad_addr(int signam, siginfo_t *siginfo, os_context_t *context)
{
/* Classic CMUCL comment:
Finding the bad address on the mips is easy. */
return (os_vm_address_t) siginfo->si_addr;
}
unsigned long
emulate_branch(os_context_t *context, unsigned long inst)
{
long opcode = inst >> 26;
long r1 = (inst >> 21) & 0x1f;
long r2 = (inst >> 16) & 0x1f;
long bdisp = (inst&(1<<15)) ? inst | (-1 << 16) : inst&0xffff;
long jdisp = (inst&(1<<25)) ? inst | (-1 << 26) : inst&0xffff;
long disp = 0;
switch(opcode) {
case 0x1: /* bltz, bgez, bltzal, bgezal */
switch((inst >> 16) & 0x1f) {
case 0x00: /* bltz */
if(*os_context_register_addr(context, r1) < 0)
disp = bdisp;
break;
case 0x01: /* bgez */
if(*os_context_register_addr(context, r1) >= 0)
disp = bdisp;
break;
case 0x10: /* bltzal */
if(*os_context_register_addr(context, r1) < 0)
disp = bdisp;
*os_context_register_addr(context, 31) = *os_context_pc_addr(context) + 4;
break;
case 0x11: /* bgezal */
if(*os_context_register_addr(context, r1) >= 0)
disp = bdisp;
*os_context_register_addr(context, 31) = *os_context_pc_addr(context) + 4;
break;
}
break;
case 0x4: /* beq */
if(*os_context_register_addr(context, r1)
== *os_context_register_addr(context, r2))
disp = bdisp;
break;
case 0x5: /* bne */
if(*os_context_register_addr(context, r1)
!= *os_context_register_addr(context, r2))
disp = bdisp;
break;
case 0x6: /* ble */
if(*os_context_register_addr(context, r1)
/* FIXME: One has to assume that the CMUCL gods of old have
got the sign issues right... but it might be worth
checking, someday */
<= *os_context_register_addr(context, r2))
disp = bdisp;
break;
case 0x7: /* bgtz */
if(*os_context_register_addr(context, r1)
>= *os_context_register_addr(context, r2))
disp = bdisp;
break;
case 0x2: /* j */
disp = jdisp;
break;
case 0x3: /* jal */
disp = jdisp;
*os_context_register_addr(context, 31) = *os_context_pc_addr(context) + 4;
break;
}
return (*os_context_pc_addr(context) + disp * 4);
}
void arch_skip_instruction(os_context_t *context)
{
/* Skip the offending instruction */
if (os_context_bd_cause(context))
*os_context_pc_addr(context) =
emulate_branch(context,
*(unsigned long *) *os_context_pc_addr(context));
else
*os_context_pc_addr(context) += 4;
os_flush_icache((os_vm_address_t) *os_context_pc_addr(context), sizeof(unsigned long));
}
unsigned char *arch_internal_error_arguments(os_context_t *context)
{
if (os_context_bd_cause(context))
return (unsigned char *)(*os_context_pc_addr(context) + 8);
else
return (unsigned char *)(*os_context_pc_addr(context) + 4);
}
boolean arch_pseudo_atomic_atomic(os_context_t *context)
{
return *os_context_register_addr(context, reg_ALLOC) & 1;
}
#define PSEUDO_ATOMIC_INTERRUPTED_BIAS 0x7f000000
void arch_set_pseudo_atomic_interrupted(os_context_t *context)
{
*os_context_register_addr(context, reg_NL4) |= 1<<31;
}
unsigned long arch_install_breakpoint(void *pc)
{
unsigned long *ptr = (unsigned long *)pc;
unsigned long result = *ptr;
*ptr = (trap_Breakpoint << 16) | 0xd;
os_flush_icache((os_vm_address_t)ptr, sizeof(unsigned long));
return result;
}
void arch_remove_breakpoint(void *pc, unsigned long orig_inst)
{
*(unsigned long *)pc = orig_inst;
os_flush_icache((os_vm_address_t)pc, sizeof(unsigned long));
}
static unsigned long *skipped_break_addr, displaced_after_inst;
static sigset_t orig_sigmask;
void arch_do_displaced_inst(os_context_t *context,
unsigned int orig_inst)
{
unsigned long *pc = (unsigned long *)*os_context_pc_addr(context);
unsigned long *break_pc, *next_pc;
unsigned long next_inst;
int opcode;
orig_sigmask = *os_context_sigmask_addr(context);
sigaddset_blockable(os_context_sigmask_addr(context));
/* Figure out where the breakpoint is, and what happens next. */
if (os_context_bd_cause(context)) {
break_pc = pc+1;
next_inst = *pc;
}
else {
break_pc = pc;
next_inst = orig_inst;
}
/* Put the original instruction back. */
*break_pc = orig_inst;
os_flush_icache((os_vm_address_t)break_pc, sizeof(unsigned long));
skipped_break_addr = break_pc;
/* Figure out where it goes. */
opcode = next_inst >> 26;
if (opcode == 1 || ((opcode & 0x3c) == 0x4) || ((next_inst & 0xf00e0000) == 0x80000000)) {
next_pc = emulate_branch(context, next_inst);
}
else
next_pc = pc+1;
displaced_after_inst = *next_pc;
*next_pc = (trap_AfterBreakpoint << 16) | 0xd;
os_flush_icache((os_vm_address_t)next_pc, sizeof(unsigned long));
}
static void sigtrap_handler(int signal, siginfo_t *info, void *void_context)
{
os_context_t *context = arch_os_get_context(&void_context);
sigset_t *mask;
int code;
/* Don't disallow recursive breakpoint traps. Otherwise, we can't */
/* use debugger breakpoints anywhere in here. */
mask = os_context_sigmask_addr(context);
sigsetmask(mask);
code = ((*(int *) (*os_context_pc_addr(context))) >> 16) & 0x1f;
switch (code) {
case trap_PendingInterrupt:
arch_skip_instruction(context);
interrupt_handle_pending(context);
break;
case trap_Halt:
fake_foreign_function_call(context);
lose("%%primitive halt called; the party is over.\n");
case trap_Error:
case trap_Cerror:
interrupt_internal_error(signal, info, context, code==trap_Cerror);
break;
case trap_Breakpoint:
handle_breakpoint(signal, info, context);
break;
case trap_FunEndBreakpoint:
*os_context_pc_addr(context) = (int)handle_fun_end_breakpoint(signal, info, context);
break;
case trap_AfterBreakpoint:
*skipped_break_addr = (trap_Breakpoint << 16) | 0xd;
os_flush_icache((os_vm_address_t)skipped_break_addr,
sizeof(unsigned long));
skipped_break_addr = NULL;
*(unsigned long *)(*os_context_pc_addr(context)) = displaced_after_inst;
os_flush_icache((os_vm_address_t) *os_context_pc_addr(context), sizeof(unsigned long));
*os_context_sigmask_addr(context) = orig_sigmask;
break;
case 0x10:
/* Clear the flag */
*os_context_register_addr(context, reg_NL4) &= 0x7fffffff;
arch_skip_instruction(context);
interrupt_handle_pending(context);
return;
default:
interrupt_handle_now(signal, info, context);
break;
}
}
/* FIXME: We must have one of these somewhere. Also, export
N-FIXNUM-TAG-BITS from Lispland and use it rather than 2 here. */
#define FIXNUM_VALUE(lispobj) (((int)lispobj)>>2)
void sigfpe_handler(int signal, siginfo_t *info, void *void_context)
{
unsigned long bad_inst;
unsigned int op, rs, rt, rd, funct, dest;
int immed;
long result;
os_context_t *context = arch_os_get_context(&void_context);
if (os_context_bd_cause(context))
bad_inst = *(unsigned long *)(*os_context_pc_addr(context) + 4);
else
bad_inst = *(unsigned long *)(*os_context_pc_addr(context));
op = (bad_inst >> 26) & 0x3f;
rs = (bad_inst >> 21) & 0x1f;
rt = (bad_inst >> 16) & 0x1f;
rd = (bad_inst >> 11) & 0x1f;
funct = bad_inst & 0x3f;
immed = (((int)(bad_inst & 0xffff)) << 16) >> 16;
switch (op) {
case 0x0: /* SPECIAL */
switch (funct) {
case 0x20: /* ADD */
/* FIXME: Hopefully, this whole section can just go away,
with the rewrite of pseudo-atomic and the deletion of
overflow VOPs */
/* Check to see if this is really a pa_interrupted hit */
if (rs == reg_ALLOC && rt == reg_NL4) {
*os_context_register_addr(context, reg_ALLOC)
+= (*os_context_register_addr(context, reg_NL4)
- PSEUDO_ATOMIC_INTERRUPTED_BIAS);
arch_skip_instruction(context);
interrupt_handle_pending(context);
return;
}
result = FIXNUM_VALUE(*os_context_register_addr(context, rs))
+ FIXNUM_VALUE(*os_context_register_addr(context, rt));
dest = rd;
break;
case 0x22: /* SUB */
result = FIXNUM_VALUE(*os_context_register_addr(context, rs))
- FIXNUM_VALUE(*os_context_register_addr(context, rt));
dest = rd;
break;
default:
dest = 32;
break;
}
break;
case 0x8: /* ADDI */
result = FIXNUM_VALUE(*os_context_register_addr(context,rs)) + (immed>>2);
dest = rt;
break;
default:
dest = 32;
break;
}
if (dest < 32) {
dynamic_space_free_pointer =
(lispobj *) *os_context_register_addr(context,reg_ALLOC);
*os_context_register_addr(context,dest) = alloc_number(result);
*os_context_register_addr(context, reg_ALLOC) =
(unsigned long) dynamic_space_free_pointer;
arch_skip_instruction(context);
}
else
interrupt_handle_now(signal, info, context);
}
void arch_install_interrupt_handlers()
{
undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler);
undoably_install_low_level_interrupt_handler(SIGFPE,sigfpe_handler);
}
extern lispobj call_into_lisp(lispobj fun, lispobj *args, int nargs);
lispobj funcall0(lispobj function)
{
lispobj *args = current_control_stack_pointer;
return call_into_lisp(function, args, 0);
}
lispobj funcall1(lispobj function, lispobj arg0)
{
lispobj *args = current_control_stack_pointer;
current_control_stack_pointer += 1;
args[0] = arg0;
return call_into_lisp(function, args, 1);
}
lispobj funcall2(lispobj function, lispobj arg0, lispobj arg1)
{
lispobj *args = current_control_stack_pointer;
current_control_stack_pointer += 2;
args[0] = arg0;
args[1] = arg1;
return call_into_lisp(function, args, 2);
}
lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1, lispobj arg2)
{
lispobj *args = current_control_stack_pointer;
current_control_stack_pointer += 3;
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
return call_into_lisp(function, args, 3);
}
--- NEW FILE: mips-arch.h ---
#ifndef _MIPS_ARCH_H
#define _MIPS_ARCH_H
#endif /* _MIPS_ARCH_H */
--- NEW FILE: mips-assem.S ---
#define LANGUAGE_ASSEMBLY
#include "sbcl.h"
#include "lispregs.h"
#define zero $0
#define at $1
#define v0 $2
#define v1 $3
#define a0 $4
#define a1 $5
#define a2 $6
#define a3 $7
#define t0 $8
#define t1 $9
#define t2 $10
#define t3 $11
#define t4 $12
#define t5 $13
#define t6 $14
#define t7 $15
#define s0 $16
#define s1 $17
#define s2 $18
#define s3 $19
#define s4 $20
#define s5 $21
#define s6 $22
#define s7 $23
#define t8 $24
#define t9 $25
#define k0 $26
#define k1 $27
#define gp $28
#define sp $29
#define s8 $30
#define ra $31
/*
* Function to transfer control into lisp.
*/
.text
.globl call_into_lisp
.ent call_into_lisp
call_into_lisp:
#define framesize 12*4
subu sp, framesize
.frame sp, framesize, ra
/* Save all the C regs. */
.mask 0xc0ff0000, 0
sw ra, framesize(sp)
sw s8, framesize-4(sp)
sw s7, framesize-12(sp)
sw s6, framesize-16(sp)
sw s5, framesize-20(sp)
sw s4, framesize-24(sp)
sw s3, framesize-28(sp)
sw s2, framesize-32(sp)
sw s1, framesize-36(sp)
sw s0, framesize-40(sp)
/* Clear descriptor regs */
move t0, zero
move t1, zero
move t2, zero
move t3, zero
move t4, zero
move t5, zero
move t6, zero
move t7, zero
move t8, zero
move s0, zero
move s1, zero
move s2, zero
move s3, zero
move ra, zero
li reg_NIL, NIL
/* Start pseudo-atomic. */
.set noreorder
li reg_NL4, 0
li reg_ALLOC, 1
.set reorder
/* No longer in foreign call. */
sw zero, foreign_function_call_active
/* Load the allocation pointer, preserving the low-bit of alloc */
lw reg_BSP, dynamic_space_free_pointer
add reg_ALLOC, reg_BSP
/* Load the rest of the LISP state. */
lw reg_BSP, current_binding_stack_pointer
lw reg_CSP, current_control_stack_pointer
lw reg_OCFP, current_control_frame_pointer
/* Check for interrupt */
.set noreorder
bgez reg_NL4, pa1
nop
break 0x10
pa1:
subu reg_ALLOC, 1
.set reorder
/* Pass in args */
move reg_LEXENV, $4
move reg_CFP, $5
sll reg_NARGS, $6, 2
lw reg_A0, 0(reg_CFP)
lw reg_A1, 4(reg_CFP)
lw reg_A2, 8(reg_CFP)
lw reg_A3, 12(reg_CFP)
lw reg_A4, 16(reg_CFP)
lw reg_A5, 20(reg_CFP)
/* Calculate LRA */
la reg_LRA, lra + OTHER_POINTER_LOWTAG
/* Indirect closure */
lw reg_CODE, -1(reg_LEXENV)
/* Jump into lisp land. */
addu reg_LIP, reg_CODE, 6*4 - FUN_POINTER_LOWTAG
j reg_LIP
.set noreorder
.align 3
#ifdef irix
/* This particular KLUDGE is kept here as a reminder; for more
details, see irix-asm-munge.c from CMUCL's lisp directory.
Other examples have been deleted from later in the file in the
hope that they will not be needed. */
.globl mipsmungelra /* for our munging afterwards in irix-asm-munge */
mipsmungelra:
#endif
lra:
.word RETURN_PC_HEADER_WIDETAG
/* Multiple value return spot, clear stack */
move reg_CSP, reg_OCFP
nop
/* Set pseudo-atomic flag. */
li reg_NL4, 0
addu reg_ALLOC, 1
.set reorder
/* Save LISP registers. */
subu reg_NL0, reg_ALLOC, 1
sw reg_NL0, dynamic_space_free_pointer
sw reg_BSP, current_binding_stack_pointer
sw reg_CSP, current_control_stack_pointer
sw reg_CFP, current_control_frame_pointer
/* Pass one return value back to C land. */
/* v0 is reg_ALLOC in this new world, so do this after saving
reg_ALLOC in dynamic_space_free_pointer */
move v0, reg_A0
/* Back in foreign function call */
sw reg_CFP, foreign_function_call_active
/* Check for interrupt */
.set noreorder
bgez reg_NL4, pa2
nop
break 0x10
pa2:
subu reg_ALLOC, 1
.set reorder
/* Restore C regs */
lw ra, framesize(sp)
lw s8, framesize-4(sp)
lw s7, framesize-12(sp)
lw s6, framesize-16(sp)
lw s5, framesize-20(sp)
lw s4, framesize-24(sp)
lw s3, framesize-28(sp)
lw s2, framesize-32(sp)
lw s1, framesize-36(sp)
lw s0, framesize-40(sp)
/* Restore C stack. */
addu sp, framesize
/* Back we go. */
j ra
.end call_into_lisp
/*
* Transfering control from Lisp into C
*/
.text
.globl call_into_c
.ent call_into_c
call_into_c:
/* Set up a stack frame. */
move reg_OCFP, reg_CFP
move reg_CFP, reg_CSP
addu reg_CSP, reg_CFP, 32
sw reg_OCFP, 0(reg_CFP)
subu reg_NL4, reg_LIP, reg_CODE
addu reg_NL4, OTHER_POINTER_LOWTAG
sw reg_NL4, 4(reg_CFP)
sw reg_CODE, 8(reg_CFP)
sw gp, 12(reg_CFP)
/* Note: the C stack is already set up. */
/* Set the pseudo-atomic flag. */
.set noreorder
li reg_NL4, 0
addu reg_ALLOC, 1
.set reorder
/* Save lisp state. */
subu t0, reg_ALLOC, 1
sw t0, dynamic_space_free_pointer
sw reg_BSP, current_binding_stack_pointer
sw reg_CSP, current_control_stack_pointer
sw reg_CFP, current_control_frame_pointer
/* Mark us as in C land. */
sw reg_CSP, foreign_function_call_active
/* Were we interrupted? */
.set noreorder
bgez reg_NL4, pa3
nop
break 0x10
pa3:
subu reg_ALLOC, 1
.set reorder
/* Into C land we go. */
move t9, reg_CFUNC
jal t9
nop
lw gp, 12(reg_CFP)
/* Clear unsaved descriptor regs */
move t0, zero
move t1, zero
move t2, zero
move t3, zero
move t4, zero
move t5, zero
move t6, zero
move t7, zero
move t8, zero
move s0, zero
move s2, zero
move s3, zero
move ra, zero
/* Turn on pseudo-atomic. */
.set noreorder
li reg_NL4, 0
li reg_ALLOC, 1
.set reorder
/* Mark us at in Lisp land. */
sw zero, foreign_function_call_active
/* Restore ALLOC, preserving pseudo-atomic-atomic */
lw a0, dynamic_space_free_pointer
addu reg_ALLOC, a0
/* Check for interrupt */
.set noreorder
bgez reg_NL4, pa4
nop
break 0x10
pa4:
subu reg_ALLOC, 1
.set reorder
/* Restore LRA & CODE (they may have been GC'ed) */
lw reg_CODE, 8(reg_CFP)
lw a0, 4(reg_CFP)
subu a0, OTHER_POINTER_LOWTAG
addu reg_LIP, reg_CODE, a0
/* Reset the lisp stack. */
/* Note: OCFP and CFP are in saved regs. */
move reg_CSP, reg_CFP
move reg_CFP, reg_OCFP
/* Return to LISP. */
j reg_LIP
.end call_into_c
.text
.globl start_of_tramps
start_of_tramps:
/*
* The undefined-function trampoline.
*/
.text
.globl undefined_tramp
.ent undefined_tramp
undefined_tramp:
break 10
.byte 4
.byte UNDEFINED_FUN_ERROR
.byte 254
.byte (0xc0 + sc_DescriptorReg)
.byte 1
.align 2
.end undefined_tramp
/*
* The closure trampoline.
*/
.text
.globl closure_tramp
.ent closure_tramp
closure_tramp:
lw reg_LEXENV, FDEFN_FUN_OFFSET(reg_FDEFN)
lw reg_L0, CLOSURE_FUN_OFFSET(reg_LEXENV)
addu reg_LIP, reg_L0, SIMPLE_FUN_CODE_OFFSET
j reg_LIP
.end closure_tramp
.text
.globl end_of_tramps
end_of_tramps:
/*
* Function-end breakpoint magic.
*/
.text
.align 2
.set noreorder
.globl function_end_breakpoint_guts
fun_end_breakpoint_guts:
.word RETURN_PC_HEADER_WIDETAG
beq zero, zero, 1f
nop
move reg_OCFP, reg_CSP
addu reg_CSP, 4
li reg_NARGS, 4
move reg_A1, reg_NIL
move reg_A2, reg_NIL
move reg_A3, reg_NIL
move reg_A4, reg_NIL
move reg_A5, reg_NIL
1:
.globl fun_end_breakpoint_trap
fun_end_breakpoint_trap:
break trap_FunEndBreakpoint
beq zero, zero, 1b
nop
.globl fun_end_breakpoint_end
fun_end_breakpoint_end:
.set reorder
/* FIXME: I don't think the below are actually used anywhere */
.text
.align 2
.globl call_on_stack
.ent call_on_stack
call_on_stack:
subu sp, a1, 16
jal a0
break 0
.end call_on_stack
.globl save_state
.ent save_state
save_state:
subu sp, 40
.frame sp, 40, ra
/* Save all the C regs. */
.mask 0xc0ff0000, 0
sw ra, 40(sp)
sw s8, 40-4(sp)
sw s7, 40-8(sp)
sw s6, 40-12(sp)
sw s5, 40-16(sp)
sw s4, 40-20(sp)
sw s3, 40-24(sp)
sw s2, 40-28(sp)
sw s1, 40-32(sp)
sw s0, 40-36(sp)
/* Should also save the floating point state. */
move t0, a0
move a0, sp
jal t0
_restore_state:
lw ra, 40(sp)
lw s8, 40-4(sp)
lw s7, 40-8(sp)
lw s6, 40-12(sp)
lw s5, 40-16(sp)
lw s4, 40-20(sp)
lw s3, 40-24(sp)
lw s2, 40-28(sp)
lw s1, 40-32(sp)
lw s0, 40-36(sp)
addu sp, 40
j ra
.globl restore_state
restore_state:
move sp, a0
move v0, a1
j _restore_state
.end save_state
--- NEW FILE: mips-linux-os.c ---
/*
* This is the MIPS Linux incarnation of arch-dependent OS-dependent
* routines. See also "linux-os.c".
*/
/*
* This software is part of the SBCL system. See the README file for
* more information.
*
* This software is derived from the CMU CL system, which was
* written at Carnegie Mellon University and released into the
* public domain. The software is in the public domain and is
* provided with absolutely no warranty. See the COPYING and CREDITS
* files for more information.
*/
#include <stdio.h>
#include <sys/param.h>
#include <sys/file.h>
#include "./signal.h"
#include "os.h"
#include "arch.h"
#include "globals.h"
#include "interrupt.h"
#include "interr.h"
#include "lispregs.h"
#include "sbcl.h"
#include <sys/socket.h>
#include <sys/utsname.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
#include "validate.h"
/* for cacheflush() */
#include <asm/cachectl.h>
/* FIXME: For CAUSEF_BD */
#include <asm/mipsregs.h>
size_t os_vm_page_size;
os_context_register_t *
os_context_register_addr(os_context_t *context, int offset)
{
if (offset == 0) {
/* KLUDGE: I'm not sure, but it's possible that Linux puts the
contents of the Processor Status Word in the (wired-zero)
slot in the mcontext. In any case, the following is
unlikely to do any harm: */
static unsigned long long zero;
zero = 0;
return &zero;
} else {
return &(((struct sigcontext *) &(context->uc_mcontext))->sc_regs[offset]);
}
}
os_context_register_t *
os_context_pc_addr(os_context_t *context)
{
/* Why do I get all the silly ports? -- CSR, 2002-08-11 */
return &(((struct sigcontext *) &(context->uc_mcontext))->sc_pc);
}
sigset_t *
os_context_sigmask_addr(os_context_t *context)
{
return &(context->uc_sigmask);
}
void
os_restore_fp_control(os_context_t *context)
{
/* FIXME: Probably do something. */
}
unsigned int
os_context_bd_cause(os_context_t *context)
{
/* We need to see if whatever happened, happened because of a
branch delay event */
return (((struct sigcontext *) &(context->uc_mcontext))->sc_cause
& CAUSEF_BD);
}
void
os_flush_icache(os_vm_address_t address, os_vm_size_t length)
{
if (cacheflush(address, length, ICACHE) == -1)
perror("cacheflush");
}
--- NEW FILE: mips-linux-os.h ---
#ifndef _MIPS_LINUX_OS_H
#define _MIPS_LINUX_OS_H
typedef struct ucontext os_context_t;
typedef unsigned long long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
return (os_context_t *) *void_context;
}
unsigned long os_context_fp_control(os_context_t *context);
void os_restore_fp_control(os_context_t *context);
unsigned int os_context_bd_cause(os_context_t *context);
#endif /* _MIPS_LINUX_OS_H */
--- NEW FILE: mips-lispregs.h ---
/* $Header: /cvsroot/sbcl/sbcl/src/runtime/mips-lispregs.h,v 1.1 2002/09/01 22:34:18 crhodes Exp $ */
#ifdef LANGUAGE_ASSEMBLY
#define REG(num) $ ## num
#else
#define REG(num) num
#endif
#define NREGS (32)
#define reg_ZERO REG(0)
#define reg_NL3 REG(1)
#define reg_CFUNC REG(2)
#define reg_NL4 REG(3)
#define reg_NL0 REG(4)
#define reg_NL1 REG(5)
#define reg_NL2 REG(6)
#define reg_NARGS REG(7)
#define reg_A0 REG(8)
#define reg_A1 REG(9)
#define reg_A2 REG(10)
#define reg_A3 REG(11)
#define reg_A4 REG(12)
#define reg_A5 REG(13)
#define reg_FDEFN REG(14)
#define reg_LEXENV REG(15)
#define reg_NFP REG(16)
#define reg_OCFP REG(17)
#define reg_LRA REG(18)
#define reg_L0 REG(19)
#define reg_NIL REG(20)
#define reg_BSP REG(21)
#define reg_CFP REG(22)
#define reg_CSP REG(23)
#define reg_L1 REG(24)
#define reg_ALLOC REG(25)
#define reg_NSP REG(29)
#define reg_CODE REG(30)
#define reg_LIP REG(31)
#define REGNAMES \
"ZERO", "NL3", "CFUNC", "NL4", \
"NL0", "NL1", "NL2", "NARGS", \
"A0", "A1", "A2", "A3", \
"A4", "A5", "FDEFN", "LEXENV", \
"NFP", "OCFP", "LRA", "L0", \
"NIL", "BSP", "CFP", "CSP", \
"L1", "ALLOC", "K0", "K1", \
"GP", "NSP", "CODE", "LIP"
#define BOXED_REGISTERS { \
reg_A0, reg_A1, reg_A2, reg_A3, reg_A4, reg_A5, reg_FDEFN, reg_LEXENV, \
reg_NFP, reg_OCFP, reg_LRA, reg_L0, reg_L1, reg_CODE \
}
#define SC_REG(sc, n) ((sc)->sc_regs[n])
#define SC_PC(sc) ((sc)->sc_pc)
Index: alpha-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/alpha-linux-os.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- alpha-linux-os.h 18 Jul 2002 17:47:34 -0000 1.3
+++ alpha-linux-os.h 1 Sep 2002 22:34:18 -0000 1.4
@@ -2,6 +2,7 @@
#define _ALPHA_LINUX_OS_H
typedef struct ucontext os_context_t;
+typedef long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
return (os_context_t *) *void_context;
Index: hppa-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/hppa-linux-os.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hppa-linux-os.h 19 Aug 2002 12:14:03 -0000 1.1
+++ hppa-linux-os.h 1 Sep 2002 22:34:18 -0000 1.2
@@ -2,6 +2,9 @@
#define _HPPA_LINUX_OS_H
typedef struct ucontext os_context_t;
+/* FIXME: This will change if the parisc-linux people implement
+ wide-sigcontext for 32-bit kernels */
+typedef unsigned long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
return (os_context_t *) *void_context;
Index: linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/linux-os.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- linux-os.h 23 Jul 2002 17:22:37 -0000 1.6
+++ linux-os.h 1 Sep 2002 22:34:18 -0000 1.7
@@ -38,5 +38,3 @@
#define SIG_MEMORY_FAULT SIGSEGV
-/* /usr/include/asm/sigcontext.h */
-typedef long os_context_register_t ;
Index: ppc-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-linux-os.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ppc-linux-os.h 18 Jul 2002 17:47:34 -0000 1.3
+++ ppc-linux-os.h 1 Sep 2002 22:34:18 -0000 1.4
@@ -2,6 +2,7 @@
#define _PPC_LINUX_OS_H
typedef struct ucontext os_context_t;
+typedef long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
return (os_context_t *) *void_context;
Index: sparc-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/sparc-linux-os.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sparc-linux-os.h 18 Jul 2002 17:47:34 -0000 1.3
+++ sparc-linux-os.h 1 Sep 2002 22:34:18 -0000 1.4
@@ -2,6 +2,7 @@
#define _SPARC_LINUX_OS_H
typedef struct sigcontext os_context_t;
+typedef unsigned long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
asm volatile ("ta 0x03"); /* ta ST_FLUSH_WINDOWS */
Index: x86-linux-os.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-linux-os.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- x86-linux-os.h 18 Jul 2002 17:47:34 -0000 1.3
+++ x86-linux-os.h 1 Sep 2002 22:34:18 -0000 1.4
@@ -2,6 +2,7 @@
#define _X86_LINUX_OS_H
typedef struct ucontext os_context_t;
+typedef long os_context_register_t;
static inline os_context_t *arch_os_get_context(void **void_context) {
return (os_context_t *) *void_context;
|