(reported by Baughn on #lisp)
* a cross-compiler bug on non-x86 platforms has been identified and
fixed. (thanks to Bruno Haible)
+ * improvements to the MIPS runtime code for increased stability.
+ (thanks to Thiemo Seufer)
* fixed some bugs related to Unicode integration:
** the restarts for recovering from input and output encoding
errors only appear when there is in fact such an error to
ppc) guessed_sbcl_arch=ppc ;;
Power*Macintosh) guessed_sbcl_arch=ppc ;;
parisc) guessed_sbcl_arch=hppa ;;
- mips) guessed_sbcl_arch=mips ;;
+ mips*) guessed_sbcl_arch=mips ;;
*)
# If we're not building on a supported target architecture, we
# we have no guess, but it's not an error yet, since maybe
# provided with absolutely no warranty. See the COPYING and CREDITS
# files for more information.
-CFLAGS += -g -O0
-LD = ld
-LINKFLAGS = -v -g
+CFLAGS += -Dmips -g
+LD = ld
+LINKFLAGS = -v -g -O2
NM = nm -p
ASSEM_SRC = mips-assem.S ldso-stubs.S
ARCH_SRC = mips-arch.c #undefineds.c
-OS_SRC = linux-os.c mips-linux-os.c os-common.c
+OS_SRC = linux-os.c mips-linux-os.c os-common.c
OS_LIBS= -ldl
GC_SRC= cheneygc.c
#else /* LANGUAGE_ASSEMBLY */
#ifdef mips
+#ifdef __linux__
+#define EXTERN(name,bytes) .globl name
+#else
#define EXTERN(name,bytes) .extern name bytes
#endif
+#endif
/**/
#ifdef sparc
#ifdef SVR4
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 bdisp = ((inst&(1<<15)) ? inst | (-1 << 16) : inst&0x7fff) << 2;
+ long jdisp = (inst&0x3ffffff) << 2;
long disp = 0;
switch(opcode) {
!= *os_context_register_addr(context, r2))
disp = bdisp;
break;
- case 0x6: /* ble */
+ case 0x6: /* blez */
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))
+ > *os_context_register_addr(context, r2))
disp = bdisp;
break;
case 0x2: /* j */
*os_context_register_addr(context, 31) = *os_context_pc_addr(context) + 4;
break;
}
- return (*os_context_pc_addr(context) + disp * 4);
+ return (*os_context_pc_addr(context) + disp);
}
void arch_skip_instruction(os_context_t *context)
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;
+ unsigned int *pc = (unsigned int *)*os_context_pc_addr(context);
+ unsigned int *break_pc, *next_pc;
+ unsigned int next_inst;
int opcode;
orig_sigmask = *os_context_sigmask_addr(context);
/* Put the original instruction back. */
*break_pc = orig_inst;
- os_flush_icache((os_vm_address_t)break_pc, sizeof(unsigned long));
+ os_flush_icache((os_vm_address_t)break_pc, sizeof(unsigned int));
skipped_break_addr = break_pc;
/* Figure out where it goes. */
displaced_after_inst = *next_pc;
*next_pc = (trap_AfterBreakpoint << 16) | 0xd;
- os_flush_icache((os_vm_address_t)next_pc, sizeof(unsigned long));
+ os_flush_icache((os_vm_address_t)next_pc, sizeof(unsigned int));
}
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;
+ unsigned 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);
+ sigprocmask(SIG_SETMASK, mask, NULL);
code = ((*(int *) (*os_context_pc_addr(context))) >> 16) & 0x1f;
switch (code) {
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_flush_icache((os_vm_address_t) *os_context_pc_addr(context), sizeof(unsigned int));
*os_context_sigmask_addr(context) = orig_sigmask;
break;
static inline void
-get_spinlock(lispobj *word,long value)
+get_spinlock(volatile lispobj *word, long value)
{
*word=value; /* FIXME for threads */
}
static inline void
-release_spinlock(lispobj *word)
+release_spinlock(volatile lispobj *word)
{
*word=0;
}
-#define LANGUAGE_ASSEMBLY
-
-#include "sbcl.h"
+#include "sbcl.h"
#include "lispregs.h"
+#include "globals.h"
#include "genesis/fdefn.h"
#include "genesis/closure.h"
#include "genesis/simple-fun.h"
#include "genesis/static-symbols.h"
#define zero $0
-#define at $1
+#define AT $1
#define v0 $2
#define v1 $3
#define a0 $4
#define s8 $30
#define ra $31
+/*
+ * NESTED - declare nested routine entry point
+ */
+#define NESTED(symbol, framesize, rpc) \
+ .globl symbol; \
+ .align 2; \
+ .type symbol,@function; \
+ .ent symbol,0; \
+symbol: .frame sp, framesize, rpc
+
+/*
+ * END - mark end of function
+ */
+#define END(function) \
+ .end function; \
+ .size function,.-function
+
+
+ .text
/*
* Function to transfer control into lisp.
*/
- .text
- .globl call_into_lisp
- .ent call_into_lisp
-call_into_lisp:
-#define framesize 12*4
+#define framesize 16*4
+ NESTED(call_into_lisp, framesize, ra)
subu sp, framesize
- .frame sp, framesize, ra
/* Save all the C regs. */
- .mask 0xc0ff0000, 0
+ .mask 0xd0ff0000, -4
sw ra, framesize(sp)
sw s8, framesize-4(sp)
+ sw gp, framesize-8(sp)
sw s7, framesize-12(sp)
sw s6, framesize-16(sp)
sw s5, framesize-20(sp)
.set reorder
/* Pass in args */
- move reg_LEXENV, $4
- move reg_CFP, $5
- sll reg_NARGS, $6, 2
+ move reg_LEXENV, a0
+ move reg_CFP, a1
+ sll reg_NARGS, a2, 2
lw reg_A0, 0(reg_CFP)
lw reg_A1, 4(reg_CFP)
lw reg_A2, 8(reg_CFP)
/* Jump into lisp land. */
addu reg_LIP, reg_CODE, 6*4 - FUN_POINTER_LOWTAG
- j reg_LIP
+ jr reg_LIP
.set noreorder
.align 3
/* Restore C regs */
lw ra, framesize(sp)
lw s8, framesize-4(sp)
+ lw gp, framesize-8(sp)
lw s7, framesize-12(sp)
lw s6, framesize-16(sp)
lw s5, framesize-20(sp)
addu sp, framesize
/* Back we go. */
- j ra
+ jr ra
- .end call_into_lisp
+ END(call_into_lisp)
/*
* Transfering control from Lisp into C
*/
- .text
.globl call_into_c
- .ent call_into_c
+ .align 2
+ .type call_into_c,@function
+ .ent call_into_c,0
call_into_c:
/* Set up a stack frame. */
move reg_OCFP, reg_CFP
/* Into C land we go. */
move t9, reg_CFUNC
- jal t9
+ jalr t9
nop
lw gp, 12(reg_CFP)
/* Return to LISP. */
j reg_LIP
- .end call_into_c
+ 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:
/*
* The closure trampoline.
*/
- .text
.globl closure_tramp
.ent closure_tramp
closure_tramp:
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
.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
-
-
-
-
-
;;; the fifth argument, as the first four are passed in registers
;;; and we apparently don't ever need to pass six arguments to a
;;; libc function. -- CSR, 2003-10-29
+;;; Expanded to 8 arguments regardless. -- ths, 2005-03-24
#!+mips "
-#define LDSO_STUBIFY(fct) \\
-.globl ldso_stub__ ## fct ; \\
- .type ldso_stub__ ## fct,@function ; \\
-ldso_stub__ ## fct: ; \\
- addiu $29,-48 ; \\
- sw $28,40($29) ; \\
- sw $31,44($29) ; \\
- lw $25,64($29) ; \\
- sw $25,16($29) ; \\
- la $25, fct ; \\
- jalr $25 ; \\
- lw $31,44($29) ; \\
- lw $28,40($29) ; \\
- addiu $29,48 ; \\
- jr $31 ; \\
-.L ## fct ## e1: ; \\
- .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;"))
+#define LDSO_STUBIFY(fct) \\
+ .globl ldso_stub__ ## fct ; \\
+ .type ldso_stub__ ## fct,@function ; \\
+ .ent ldso_stub__ ## fct ; \\
+ldso_stub__ ## fct: ; \\
+ addiu $29,-48 ; \\
+ sw $28,40($29) ; \\
+ sw $31,44($29) ; \\
+ lw $25,64($29) ; \\
+ sw $25,16($29) ; \\
+ lw $25,68($29) ; \\
+ sw $25,20($29) ; \\
+ lw $25,72($29) ; \\
+ sw $25,24($29) ; \\
+ lw $25,76($29) ; \\
+ sw $25,28($29) ; \\
+ la $25, fct ; \\
+ jalr $25 ; \\
+ lw $31,44($29) ; \\
+ lw $28,40($29) ; \\
+ addiu $29,48 ; \\
+ jr $31 ; \\
+ .end ldso_stub__ ## fct ; \\
+ .size ldso_stub__ ## fct,.-ldso_stub__ ## fct ;"))
(defvar *stubs* (append
'("accept"
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.21.17"
+"0.8.21.18"