Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.
This commit is contained in:
parent
6736de02e8
commit
526dbbab7e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_trace.c,v 1.4 1998/09/05 23:57:27 eeh Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.5 1998/09/11 00:16:59 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -175,9 +175,21 @@ u_int64_t frame;
|
|||
f->fr_arg[0], f->fr_arg[1], f->fr_fp, f->fr_pc);
|
||||
db_printsym(f->fr_pc, DB_STGY_PROC);
|
||||
db_printf("\n");
|
||||
} else
|
||||
db_printf("frame64 in user space not supported\n");
|
||||
|
||||
} else {
|
||||
struct frame64 fr;
|
||||
|
||||
if (copyin(f, &fr, sizeof(fr))) return;
|
||||
f = &fr;
|
||||
db_printf("%llx %llx %llx %llx ",
|
||||
f->fr_local[0], f->fr_local[1], f->fr_local[2], f->fr_local[3]);
|
||||
db_printf("%llx %llx %llx %llx\n",
|
||||
f->fr_local[4], f->fr_local[5], f->fr_local[6], f->fr_local[7]);
|
||||
db_printf("%llx %llx %llx %llx ",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_arg[2], f->fr_arg[3]);
|
||||
db_printf("%llx %llx %llxsp %llxpc=",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_fp, f->fr_pc);
|
||||
db_printf("\n");
|
||||
}
|
||||
} else {
|
||||
struct frame32* f = (struct frame32*)frame;
|
||||
|
||||
|
@ -192,16 +204,20 @@ u_int64_t frame;
|
|||
db_printsym(f->fr_pc, DB_STGY_PROC);
|
||||
db_printf("\n");
|
||||
} else {
|
||||
struct frame32 fr;
|
||||
|
||||
if (copyin(f, &fr, sizeof(fr))) return;
|
||||
f = &fr;
|
||||
db_printf("%8x %8x %8x %8x %8x %8x %8x %8x\n",
|
||||
fuword(&f->fr_local[0]), fuword(&f->fr_local[1]),
|
||||
fuword(&f->fr_local[2]), fuword(&f->fr_local[3]),
|
||||
fuword(&f->fr_local[4]), fuword(&f->fr_local[5]),
|
||||
fuword(&f->fr_local[6]), fuword(&f->fr_local[7]));
|
||||
f->fr_local[0], f->fr_local[1],
|
||||
f->fr_local[2], f->fr_local[3],
|
||||
f->fr_local[4], f->fr_local[5],
|
||||
f->fr_local[6], f->fr_local[7]);
|
||||
db_printf("%8x %8x %8x %8x %8x %8x %8x=sp %8x=pc\n",
|
||||
fuword(&f->fr_arg[0]), fuword(&f->fr_arg[1]),
|
||||
fuword(&f->fr_arg[2]), fuword(&f->fr_arg[3]),
|
||||
fuword(&f->fr_arg[0]), fuword(&f->fr_arg[1]),
|
||||
fuword(&f->fr_fp), fuword(&f->fr_pc));
|
||||
f->fr_arg[0], f->fr_arg[1],
|
||||
f->fr_arg[2], f->fr_arg[3],
|
||||
f->fr_arg[0], f->fr_arg[1],
|
||||
f->fr_fp, f->fr_pc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,17 +263,19 @@ db_dump_stack(addr, have_addr, count, modif)
|
|||
db_printf("Window %x ", i);
|
||||
db_print_window(frame - BIAS);
|
||||
if (!INKERNEL(((struct frame64 *)(frame))))
|
||||
frame = fuword(((caddr_t)&((struct frame64 *)frame)->fr_fp)+4);
|
||||
copyin(((caddr_t)&((struct frame64 *)frame)->fr_fp)+4, &frame, sizeof(frame));
|
||||
else
|
||||
frame = ((struct frame64 *)frame)->fr_fp;
|
||||
} else {
|
||||
u_int32_t tmp;
|
||||
if (!INKERNEL(((struct frame32 *)frame))
|
||||
&& kernel_only) break;
|
||||
db_printf("Window %x ", i);
|
||||
db_print_window(frame);
|
||||
if (!INKERNEL(((struct frame32 *)frame)))
|
||||
frame = (u_int64_t)fuword(&((struct frame32 *)frame)->fr_fp);
|
||||
else
|
||||
if (!INKERNEL(((struct frame32 *)frame))) {
|
||||
copyin(&((struct frame32 *)frame)->fr_fp, &tmp, sizeof(tmp));
|
||||
frame = (u_int64_t)tmp;
|
||||
} else
|
||||
frame = (u_int64_t)((struct frame32 *)frame)->fr_fp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4397,189 +4397,7 @@ badregs:
|
|||
.globl _C_LABEL(endtrapcode)
|
||||
_C_LABEL(endtrapcode):
|
||||
|
||||
#if 0
|
||||
#define xword word 0,
|
||||
.data
|
||||
.align 8
|
||||
Lcons:
|
||||
.xword 0 ! This is our device handle
|
||||
|
||||
.align 8
|
||||
of_finddev: ! Here are the commands themselves. 64 bits each field.
|
||||
.xword Lfinddevice ! command name
|
||||
.xword 1 ! # params
|
||||
.xword 1 ! # returns
|
||||
.xword Lchosen ! Name of device
|
||||
.xword 0 ! handle -- return value
|
||||
.align 8
|
||||
of_getprop:
|
||||
.xword Lgetprop
|
||||
.xword 4
|
||||
.xword 1
|
||||
.xword 0 ! handle to "/chosen"
|
||||
.xword Lstdout
|
||||
.xword Lcons ! buffer
|
||||
.xword 4 ! size of buffer value
|
||||
.xword 0
|
||||
.align 8
|
||||
of_write:
|
||||
.xword Lwrite
|
||||
.xword 3
|
||||
.xword 1
|
||||
.xword 0 ! the handle
|
||||
of_mesg:
|
||||
.xword Lstring
|
||||
.xword (Lfinddevice-Lstring-1)! strlen
|
||||
.xword 0 ! number written
|
||||
.align 8
|
||||
|
||||
of_enter:
|
||||
.xword Lenter
|
||||
.xword 0
|
||||
.xword 0
|
||||
|
||||
.text
|
||||
.align 8
|
||||
|
||||
.global start
|
||||
.type start, #function
|
||||
|
||||
/*
|
||||
* Yet another debug rom_halt
|
||||
*/
|
||||
trap_enter:
|
||||
set panicstack - CC64FSZ + STKB - BIAS, %sp
|
||||
mov 7, %o3
|
||||
wrpr %g0, %o3, %cleanwin
|
||||
set of_enter, %o1
|
||||
set romp, %o2
|
||||
CHKPT(%o3,%o4,0x34)
|
||||
jmpl %o2, %o7 ! Call prom
|
||||
wrpr %g0, 0, %tl
|
||||
|
||||
/*
|
||||
* Panic to prom -- panic str in %g1
|
||||
*/
|
||||
.global _C_LABEL(prom_panic)
|
||||
_C_LABEL(prom_panic):
|
||||
set romitsbp, %g2
|
||||
ldx [%g2], %g5 ! Restore TSB pointers
|
||||
set TSB, %g3
|
||||
stxa %g5, [%g3] ASI_IMMU
|
||||
membar #Sync
|
||||
set romdtsbp, %g2
|
||||
ldx [%g2], %g5
|
||||
stxa %g5, [%g3] ASI_DMMU
|
||||
membar #Sync
|
||||
|
||||
set romtrapbase, %g3 ! Restore trapbase
|
||||
ldx [%g3], %g5
|
||||
wrpr %g5, 0, %tba
|
||||
set romwstate, %g3 ! Restore wstate
|
||||
ldx [%g3], %g5
|
||||
wrpr %g5, 0, %wstate
|
||||
|
||||
#ifndef NOTDEF
|
||||
set .ebootstack, %o1
|
||||
and %o1, ~(STACK_ALIGN64-1), %o1
|
||||
sub %o1, SA64(CC64FSZ), %o1
|
||||
save %o1, -SA64(CC64FSZ), %sp
|
||||
sub %sp, BIAS, %sp ! delay; Now a 64 bit frame ????????
|
||||
#else
|
||||
save %sp, -CC64FSZ, %sp
|
||||
andcc %sp, 1, %g0
|
||||
bz,a 0f
|
||||
sub %sp, BIAS, %sp
|
||||
0:
|
||||
#endif
|
||||
|
||||
mov %g1, %i0 ! Save our input param
|
||||
set of_mesg, %l1
|
||||
stx %i0, [%l1] ! Save str
|
||||
set romp, %l0
|
||||
LDPTR [%l0], %i4 ! Load romp
|
||||
|
||||
clr %i1
|
||||
1:
|
||||
ldub [%i0+%i1], %i2 ! Calculate strlen
|
||||
brnz,a,pt %i2, 1b
|
||||
inc %i1
|
||||
|
||||
stx %i1, [%l1+8] ! Save strlen
|
||||
|
||||
/*
|
||||
* Set the psr into a known state:
|
||||
* Set supervisor mode, interrupt level >= 13, traps enabled
|
||||
*/
|
||||
wrpr %g0, 13, %pil
|
||||
wrpr %g0, PSTATE_KERN, %pstate
|
||||
|
||||
set of_finddev, %o0
|
||||
jmpl %i4, %o7 ! Call prom
|
||||
mov %o0, %l1
|
||||
|
||||
ldx [%l1+(4*8)], %l2 ! get retval
|
||||
set of_getprop,%o0
|
||||
jmpl %i4, %o7 ! Call prom
|
||||
stx %l2, [%o0+(3*8)] ! store handle
|
||||
|
||||
set Lcons, %l1
|
||||
ld [%l1], %l2 ! get fd
|
||||
set of_write, %o0 ! Store fd in command
|
||||
jmpl %i4, %o7 ! Call prom
|
||||
stx %l2, [%o0+(3*8)]
|
||||
|
||||
mov %i4, %o4 ! Set things up again like they were when we started
|
||||
|
||||
ret ! Looks like we got problems w/the stack here.
|
||||
restore
|
||||
|
||||
set of_enter, %o0 ! Halt
|
||||
jmpl %i4, %o7
|
||||
nop
|
||||
|
||||
ret
|
||||
restore
|
||||
|
||||
.data
|
||||
.align 8
|
||||
#define STACK_SIZE 0x14000
|
||||
.space STACK_SIZE
|
||||
.ebootstack: ! end (top) of boot stack
|
||||
|
||||
.align 8
|
||||
Lstring:
|
||||
.asciz "This is a test message from Eduardo\r\n"
|
||||
.align 8
|
||||
Lfinddevice:
|
||||
.asciz "finddevice"
|
||||
.align 8
|
||||
Lchosen:
|
||||
.asciz "/chosen"
|
||||
.align 8
|
||||
Lgetprop:
|
||||
.asciz "getprop"
|
||||
.align 8
|
||||
Lstdout:
|
||||
.asciz "stdout"
|
||||
.align 8
|
||||
Lwrite:
|
||||
.asciz "write"
|
||||
.align 8
|
||||
Lenter:
|
||||
.asciz "exit"
|
||||
.align 8
|
||||
romp: .xword 0 ! ROM interface pointer
|
||||
romtrapbase:
|
||||
.xword 0
|
||||
romitsbp:
|
||||
.xword 0
|
||||
romdtsbp:
|
||||
.xword 0
|
||||
romwstate:
|
||||
.xword 0
|
||||
.text
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
!!!
|
||||
!!! Dump the DTLB to phys address in %o0 and print it
|
||||
!!!
|
||||
|
@ -4689,6 +4507,8 @@ print_dtlb:
|
|||
3:
|
||||
.asciz "%2d:%08x:%08x %08x:%08x\r\n"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
.align 8
|
||||
dostart:
|
||||
/*
|
||||
|
@ -5583,9 +5403,9 @@ _C_LABEL(esigcode):
|
|||
* work out.
|
||||
*/
|
||||
#ifdef _LP64
|
||||
.globl _C_LABEL(SPARC32_sigcode)
|
||||
.globl _C_LABEL(SPARC32_esigcode)
|
||||
_C_LABEL(SPARC32_sigcode):
|
||||
.globl _C_LABEL(sparc32_sigcode)
|
||||
.globl _C_LABEL(sparc32_esigcode)
|
||||
_C_LABEL(sparc32_sigcode):
|
||||
#else
|
||||
.globl _C_LABEL(sigcode)
|
||||
.globl _C_LABEL(esigcode)
|
||||
|
@ -5674,6 +5494,13 @@ _C_LABEL(sigcode):
|
|||
mov %l7, %g7
|
||||
|
||||
#ifdef _LP64
|
||||
restore %g0, sparc32_SYS_sigreturn, %g1 ! get registers back & set syscall #
|
||||
add %sp, 64 + 16, %o0 ! compute scp
|
||||
t ST_SYSCALL ! sigreturn(scp)
|
||||
! sigreturn does not return unless it fails
|
||||
mov sparc32_SYS_exit, %g1 ! exit(errno)
|
||||
t ST_SYSCALL
|
||||
_C_LABEL(sparc32_esigcode):
|
||||
#else
|
||||
restore %g0, SYS_sigreturn, %g1 ! get registers back & set syscall #
|
||||
add %sp, 64 + 16, %o0 ! compute scp
|
||||
|
@ -7310,7 +7137,7 @@ ENTRY(fuword)
|
|||
set Lfserr, %o3
|
||||
LDPTR [%o2 + %lo(_C_LABEL(cpcb))], %o2
|
||||
STPTR %o3, [%o2 + PCB_ONFAULT]
|
||||
lda [%o0] ASI_AIUS, %o0 ! fetch the word
|
||||
LDPTRA [%o0] ASI_AIUS, %o0 ! fetch the word
|
||||
retl ! phew, made it, return the word
|
||||
STPTR %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
|
||||
|
||||
|
@ -7372,7 +7199,7 @@ ENTRY(suword)
|
|||
LDPTR [%o2 + %lo(_C_LABEL(cpcb))], %o2
|
||||
set Lfserr, %o3
|
||||
STPTR %o3, [%o2 + PCB_ONFAULT]
|
||||
sta %o1, [%o0] ASI_AIUS ! store the word
|
||||
STPTRA %o1, [%o0] ASI_AIUS ! store the word
|
||||
STPTR %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
|
||||
retl ! and return 0
|
||||
clr %o0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.11 1998/09/07 23:59:07 eeh Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.12 1998/09/11 00:16:59 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -476,7 +476,7 @@ allocsys(v)
|
|||
#else
|
||||
#define rwindow rwindow32
|
||||
#define STACK_OFFSET 0
|
||||
#define CPOUTREG(l,v) suword((l), (v))
|
||||
#define CPOUTREG(l,v) copyout(&(v), (l), sizeof(v))
|
||||
#endif
|
||||
|
||||
/* ARGSUSED */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: process_machdep.c,v 1.3 1998/09/07 23:59:08 eeh Exp $ */
|
||||
/* $NetBSD: process_machdep.c,v 1.4 1998/09/11 00:16:59 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
|
@ -89,11 +89,10 @@ process_read_regs(p, regs)
|
|||
regp->r_y = tf->tf_y;
|
||||
for (i=0; i<8; i++) {
|
||||
struct rwindow32 *rw = (struct rwindow32 *)tf->tf_out[6];
|
||||
int32_t tmp;
|
||||
|
||||
regp->r_global[i] = tf->tf_global[i];
|
||||
regp->r_out[i] = tf->tf_out[i];
|
||||
suword((void*)&rw->rw_local[i], tf->tf_local[i]);
|
||||
suword((void*)&rw->rw_in[i], tf->tf_in[i]);
|
||||
}
|
||||
/* We should also write out the ins and locals. See signal stuff */
|
||||
return (0);
|
||||
|
@ -116,8 +115,6 @@ process_write_regs(p, regs)
|
|||
|
||||
tf->tf_global[i] = regp->r_global[i];
|
||||
tf->tf_out[i] = regp->r_out[i];
|
||||
tf->tf_local[i] = fuword((void*)&rw->rw_local[i]);
|
||||
tf->tf_in[i] = fuword((void*)&rw->rw_in[i]);
|
||||
}
|
||||
/* We should also read in the ins and locals. See signal stuff */
|
||||
tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(regp->r_psr);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_machdep.c,v 1.2 1998/09/05 15:28:10 christos Exp $ */
|
||||
/* $NetBSD: svr4_machdep.c,v 1.3 1998/09/11 00:16:59 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
|
@ -549,7 +549,7 @@ svr4_sendsig(catcher, sig, mask, code)
|
|||
write_user_windows();
|
||||
|
||||
if (rwindow_save(p) || copyout(&frame, fp, sizeof(frame)) != 0 ||
|
||||
suword(&((struct rwindow32 *)newsp)->rw_in[6], oldsp)) {
|
||||
copyout(&oldsp, &((struct rwindow32 *)newsp)->rw_in[6], sizeof(oldsp))) {
|
||||
/*
|
||||
* Process has trashed its stack; give it an illegal
|
||||
* instruction to halt it in its tracks.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.14 1998/09/07 23:49:21 eeh Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.15 1998/09/11 00:17:00 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
|
@ -773,7 +773,7 @@ badtrap:
|
|||
fpproc = NULL;
|
||||
/* tf->tf_psr &= ~PSR_EF; */ /* share_fpu will do this */
|
||||
if (p->p_md.md_fpstate->fs_qsize == 0) {
|
||||
p->p_md.md_fpstate->fs_queue[0].fq_instr = fuword((caddr_t)pc);
|
||||
copyin((caddr_t)pc, &p->p_md.md_fpstate->fs_queue[0].fq_instr, sizeof(int));
|
||||
p->p_md.md_fpstate->fs_qsize = 1;
|
||||
fpu_cleanup(p, p->p_md.md_fpstate);
|
||||
ADVANCE;
|
||||
|
@ -919,33 +919,19 @@ rwindow_save(p)
|
|||
}
|
||||
#endif
|
||||
} else {
|
||||
struct rwindow32 *rwstack;
|
||||
struct rwindow32 rwstack;
|
||||
|
||||
/* 32-bit window */
|
||||
rwstack = (struct rwindow32 *)rwdest;
|
||||
for (j=0; j<8; j++) {
|
||||
rwstack.rw_local[j] = (int)rw[i].rw_local[j];
|
||||
rwstack.rw_in[j] = (int)rw[i].rw_in[j];
|
||||
}
|
||||
if (copyout(&rwstack, rwdest, sizeof(rwstack))) {
|
||||
#ifdef DEBUG
|
||||
if (rwindow_debug&RW_FOLLOW)
|
||||
printf("%%l%d[%x]->%p\t", j, (int)rw[i].rw_local[j], &rwstack->rw_local[j]);
|
||||
if (rwindow_debug&RW_ERR)
|
||||
printf("rwindow_save: 32-bit pcb copyout to %p failed\n", rwdest);
|
||||
#endif
|
||||
if(suword((void *)(&rwstack->rw_local[j]), (int)rw[i].rw_local[j])) {
|
||||
#ifdef DEBUG
|
||||
if (rwindow_debug&RW_ERR)
|
||||
printf("rwindow_save: 32-bit pcb suword of %%l%d to %p failed\n", j, &rwstack->rw_local[j]);
|
||||
#endif
|
||||
return (-1);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (rwindow_debug&RW_FOLLOW)
|
||||
printf("%%i%d[%x]->%p\n", j, (int)rw[i].rw_in[j], &rwstack->rw_in[j]);
|
||||
#endif
|
||||
if(suword((void *)(&rwstack->rw_in[j]), (int)rw[i].rw_in[j])) {
|
||||
#ifdef DEBUG
|
||||
if (rwindow_debug&RW_ERR)
|
||||
printf("rwindow_save: 32-bit pcb suword of %%i%d to %p failed\n", j, &rwstack->rw_in[j]);
|
||||
#endif
|
||||
return (-1);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
/* rw++; */
|
||||
|
|
Loading…
Reference in New Issue