struct names when the matching `32' flavour got removed.
Joint work with cheloha@, all bugs mine.
-/* $OpenBSD: creator.c,v 1.56 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: creator.c,v 1.57 2022/10/21 18:55:42 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
#include <sys/conf.h>
#include <sys/malloc.h>
-#include <machine/bus.h>
#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/fsr.h>
#include <machine/openfirm.h>
#include <dev/wscons/wsconsio.h>
-/* $OpenBSD: fpu.c,v 1.22 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: fpu.c,v 1.23 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: fpu.c,v 1.11 2000/12/06 01:47:50 mrg Exp $ */
/*
#include <sparc64/fpu/fpu_extern.h>
int fpu_regoffset(int, int);
-int fpu_insn_fmov(struct fpstate64 *, struct fpemu *, union instr);
-int fpu_insn_fabs(struct fpstate64 *, struct fpemu *, union instr);
-int fpu_insn_fneg(struct fpstate64 *, struct fpemu *, union instr);
+int fpu_insn_fmov(struct fpstate *, struct fpemu *, union instr);
+int fpu_insn_fabs(struct fpstate *, struct fpemu *, union instr);
+int fpu_insn_fneg(struct fpstate *, struct fpemu *, union instr);
int fpu_insn_itof(struct fpemu *, union instr, int, int *,
int *, u_int *);
int fpu_insn_ftoi(struct fpemu *, union instr, int *, int, u_int *);
int fpu_insn_ftof(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fsqrt(struct fpemu *, union instr, int *, int *, u_int *);
-int fpu_insn_fcmp(struct fpstate64 *, struct fpemu *, union instr, int);
+int fpu_insn_fcmp(struct fpstate *, struct fpemu *, union instr, int);
int fpu_insn_fmul(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fmulx(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fdiv(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fadd(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fsub(struct fpemu *, union instr, int *, int *, u_int *);
-int fpu_insn_fmovcc(struct proc *, struct fpstate64 *, union instr);
-int fpu_insn_fmovr(struct proc *, struct fpstate64 *, union instr);
+int fpu_insn_fmovcc(struct proc *, struct fpstate *, union instr);
+int fpu_insn_fmovr(struct proc *, struct fpstate *, union instr);
void fpu_fcopy(u_int *, u_int *, int);
#ifdef DEBUG
fp->fp_mant[2], fp->fp_mant[3], fp->fp_exp);
}
void
-fpu_dumpstate(struct fpstate64 *fs)
+fpu_dumpstate(struct fpstate *fs)
{
int i;
* unknown FPops do enter the queue, however.
*/
void
-fpu_cleanup(register struct proc *p, register struct fpstate64 *fs)
+fpu_cleanup(register struct proc *p, register struct fpstate *fs)
{
register int i, fsr = fs->fs_fsr, error;
union instr instr;
* Handler for FMOV[SDQ] emulation.
*/
int
-fpu_insn_fmov(struct fpstate64 *fs, struct fpemu *fe, union instr instr)
+fpu_insn_fmov(struct fpstate *fs, struct fpemu *fe, union instr instr)
{
int opf = instr.i_opf.i_opf, rs, rd, rtype;
* Handler for FABS[SDQ] emulation.
*/
int
-fpu_insn_fabs(struct fpstate64 *fs, struct fpemu *fe, union instr instr)
+fpu_insn_fabs(struct fpstate *fs, struct fpemu *fe, union instr instr)
{
int opf = instr.i_opf.i_opf, rs, rd, rtype;
* Handler for FNEG[SDQ] emulation.
*/
int
-fpu_insn_fneg(struct fpstate64 *fs, struct fpemu *fe, union instr instr)
+fpu_insn_fneg(struct fpstate *fs, struct fpemu *fe, union instr instr)
{
int opf = instr.i_opf.i_opf, rs, rd, rtype;
* Handler for FCMP{E}[SDQ] emulation.
*/
int
-fpu_insn_fcmp(struct fpstate64 *fs, struct fpemu *fe, union instr instr,
+fpu_insn_fcmp(struct fpstate *fs, struct fpemu *fe, union instr instr,
int cmpe)
{
int opf = instr.i_opf.i_opf, rs1, rs2, rtype, cx, fsr;
* Handler for FMOV[SDQ][cond] emulation.
*/
int
-fpu_insn_fmovcc(struct proc *p, struct fpstate64 *fs, union instr instr)
+fpu_insn_fmovcc(struct proc *p, struct fpstate *fs, union instr instr)
{
int rtype, rd, rs, cond;
* Handler for FMOVR[icond][SDQ] emulation.
*/
int
-fpu_insn_fmovr(struct proc *p, struct fpstate64 *fs, union instr instr)
+fpu_insn_fmovr(struct proc *p, struct fpstate *fs, union instr instr)
{
int rtype, rd, rs2, rs1;
-/* $OpenBSD: fpu_emu.h,v 1.5 2006/06/21 19:24:38 jason Exp $ */
+/* $OpenBSD: fpu_emu.h,v 1.6 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: fpu_emu.h,v 1.4 2000/08/03 18:32:07 eeh Exp $ */
/*
* Emulator state.
*/
struct fpemu {
- struct fpstate64 *fe_fpstate; /* registers, etc */
+ struct fpstate *fe_fpstate; /* registers, etc */
int fe_fsr; /* fsr copy (modified during op) */
int fe_cx; /* exceptions */
struct fpn fe_f1; /* operand 1 */
#define FPE_STATE 0x4
extern int fpe_debug;
void fpu_dumpfpn(struct fpn *);
-void fpu_dumpstate(struct fpstate64 *);
+void fpu_dumpstate(struct fpstate *);
#define DPRINTF(x, y) if (fpe_debug & (x)) printf y
#define DUMPFPN(x, f) if (fpe_debug & (x)) fpu_dumpfpn((f))
#define DUMPSTATE(x, s) if (fpe_debug & (x)) fpu_dumpstate((s))
-/* $OpenBSD: fpu_extern.h,v 1.6 2008/06/26 05:42:13 ray Exp $ */
+/* $OpenBSD: fpu_extern.h,v 1.7 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: fpu_extern.h,v 1.4 2000/08/03 18:32:08 eeh Exp $ */
/*-
*/
struct proc;
-struct fpstate64;
-struct trapframe64;
+struct fpstate;
+struct trapframe;
union instr;
struct fpemu;
struct fpn;
/* fpu.c */
-void fpu_cleanup(struct proc *, struct fpstate64 *);
-int fpu_emulate(struct proc *, struct trapframe64 *, struct fpstate64 *);
+void fpu_cleanup(struct proc *, struct fpstate *);
+int fpu_emulate(struct proc *, struct trapframe *, struct fpstate *);
int fpu_execute(struct proc *, struct fpemu *, union instr);
/* fpu_add.c */
-/* $OpenBSD: cpu.h,v 1.98 2021/07/06 09:34:07 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.99 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
#include <machine/ctlreg.h>
#include <machine/psl.h>
-#include <machine/reg.h>
+#include <machine/frame.h>
#include <machine/intr.h>
#include <sys/sched.h>
paddr_t ci_paddr; /* Phys addr of this structure. */
#ifdef SUN4V
- struct rwindow64 ci_rw;
+ struct rwindow ci_rw;
u_int64_t ci_rwsp;
paddr_t ci_mmfsa;
* as well for strayintr (see locore.s:interrupt and intr.c:strayintr).
*/
struct clockframe {
- struct trapframe64 t;
+ struct trapframe t;
int saved_intr_level;
};
int clockintr(void *);/* level 10 (clock) interrupt code */
int statintr(void *); /* level 14 (statclock) interrupt code */
/* locore.s */
-struct fpstate64;
-void savefpstate(struct fpstate64 *);
-void loadfpstate(struct fpstate64 *);
+struct fpstate;
+void savefpstate(struct fpstate *);
+void loadfpstate(struct fpstate *);
void clearfpstate(void);
u_int64_t probeget(paddr_t, int, int);
#define write_all_windows() __asm volatile("flushw" : : )
void zsconsole(struct tty *, int, int, void (**)(struct tty *, int));
/* fb.c */
void fb_unblank(void);
+/* ltc.c */
+void ltc_full_blast(void);
/* tda.c */
void tda_full_blast(void);
/* emul.c */
-int emul_qf(int32_t, struct proc *, union sigval, struct trapframe64 *);
-int emul_popc(int32_t, struct proc *, union sigval, struct trapframe64 *);
+int emul_qf(int32_t, struct proc *, union sigval, struct trapframe *);
+int emul_popc(int32_t, struct proc *, union sigval, struct trapframe *);
/*
*
-/* $OpenBSD: db_machdep.h,v 1.22 2021/08/30 08:11:12 jasper Exp $ */
+/* $OpenBSD: db_machdep.h,v 1.23 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: db_machdep.h,v 1.12 2001/07/07 15:16:13 eeh Exp $ */
/*
};
#if 1
typedef struct {
- struct trapframe64 ddb_tf;
- struct frame64 ddb_fr;
+ struct trapframe ddb_tf;
+ struct frame ddb_fr;
struct trapstate ddb_ts[5];
int ddb_tl;
- struct fpstate64 ddb_fpstate;
+ struct fpstate ddb_fpstate;
} db_regs_t;
#else
typedef struct db_regs {
#define DB_MACHINE_COMMANDS
void db_machine_init(void);
-int db_ktrap(int, struct trapframe64 *);
+int db_ktrap(int, struct trapframe *);
int db_enter_ddb(void);
void db_startcpu(struct cpu_info *);
-/* $OpenBSD: frame.h,v 1.6 2011/03/23 16:54:37 pirofti Exp $ */
+/* $OpenBSD: frame.h,v 1.7 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: frame.h,v 1.9 2001/03/04 09:28:35 mrg Exp $ */
/*
#ifndef _MACHINE_FRAME_H_
#define _MACHINE_FRAME_H_
-/*
- * Sparc stack frame format.
- *
- * Note that the contents of each stack frame may be held only in
- * machine register windows. In order to get an accurate picture
- * of the frame, you must first force the kernel to write any such
- * windows to the stack.
- */
-#ifndef _LOCORE
-struct frame32 {
- int32_t fr_local[8]; /* space to save locals (%l0..%l7) */
- int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */
- u_int32_t fr_fp; /* space to save frame pointer (%i6) */
- u_int32_t fr_pc; /* space to save return pc (%i7) */
- /*
- * SunOS reserves another 8 words here; this is pointless
- * but we do it for compatibility.
- */
- int32_t fr_xxx; /* `structure return pointer' (unused) */
- int32_t fr_argd[6]; /* `arg dump area' (lunacy) */
- int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */
-};
-#endif
-
-/*
- * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if
- * a function is to call C code. It should be just 64, but Sun defined
- * their frame with space to hold arguments 0 through 5 (plus some junk),
- * and varargs routines (such as kprintf) demand this, and gcc uses this
- * area at times anyway.
- */
-#define CCFSZ 96
-
/*
* Sparc v9 stack frame format.
*
* a v8 frame by testing the stack pointer's lsb.
*/
#if !defined(_LOCORE) && !defined(_LIBC)
-struct frame64 {
+struct frame {
int64_t fr_local[8]; /* space to save locals (%l0..%l7) */
int64_t fr_arg[6]; /* space to save arguments (%i0..%i5) */
u_int64_t fr_fp; /* space to save frame pointer (%i6) */
int64_t fr_argx[0]; /* arg extension (args 7..n; variable size) */
};
-#define v9next_frame(f) ((struct frame64*)(f->fr_fp+BIAS))
+#define v9next_frame(f) ((struct frame*)(f->fr_fp+BIAS))
#endif
/*
*/
#define BIAS (2048-1)
+#ifndef _LOCORE
+/*
+ * The v9 trapframe. Since we don't get a free register window with
+ * each trap we need some way to keep track of pending traps. We use
+ * tf_fault to save the faulting address for memory faults and tf_kstack
+ * to thread trapframes on the kernel stack(s). If tf_kstack == 0 then
+ * this is the lowest level trap; we came from user mode.
+ */
+struct trapframe {
+ int64_t tf_tstate; /* tstate register */
+ int64_t tf_pc; /* return pc */
+ int64_t tf_npc; /* return npc */
+ int64_t tf_fault; /* faulting addr -- need somewhere to save it */
+ int64_t tf_kstack; /* kernel stack of prev tf */
+ int tf_y; /* %y register -- 32-bits */
+ short tf_tt; /* What type of trap this was */
+ char tf_pil; /* What IRQ we're handling */
+ char tf_oldpil; /* What our old SPL was */
+ int64_t tf_global[8]; /* global registers in trap's caller */
+ int64_t tf_out[8]; /* output registers in trap's caller */
+ int64_t tf_local[8]; /* local registers in trap's caller */
+ int64_t tf_in[8]; /* in registers in trap's caller (for debug) */
+};
+
+/*
+ * The v9 register window. Each stack pointer (%o6 aka %sp) in each window
+ * must ALWAYS point to some place at which it is safe to scribble on
+ * 64 bytes. (If not, your process gets mangled.) Furthermore, each
+ * stack pointer should be aligned on a 16-byte boundary (plus the BIAS)
+ * for v9 stacks (the kernel as currently coded allows arbitrary alignment,
+ * but with a hefty performance penalty).
+ */
+struct rwindow {
+ int64_t rw_local[8]; /* %l0..%l7 */
+ int64_t rw_in[8]; /* %i0..%i7 */
+};
+#endif
+
#endif /* _MACHINE_FRAME_H_ */
-/* $OpenBSD: pcb.h,v 1.10 2015/05/05 02:13:47 guenther Exp $ */
+/* $OpenBSD: pcb.h,v 1.11 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: pcb.h,v 1.7 2000/12/29 17:12:05 eeh Exp $ */
/*
u_int64_t pcb_wcookie;
/* the following MUST be aligned on a 64-bit boundary */
- struct rwindow64 pcb_rw[PCB_MAXWIN]; /* saved windows */
+ struct rwindow pcb_rw[PCB_MAXWIN]; /* saved windows */
u_int64_t pcb_rwsp[PCB_MAXWIN];
};
* Machine-dependent part of the proc structure for SPARC.
*/
struct mdproc {
- struct trapframe64 *md_tf; /* trap/syscall registers */
- struct fpstate64 *md_fpstate; /* fpu state, if any; always resident */
+ struct trapframe *md_tf; /* trap/syscall registers */
+ struct fpstate *md_fpstate; /* fpu state, if any; always resident */
volatile int md_astpending;
};
-/* $OpenBSD: reg.h,v 1.5 2008/12/22 23:01:31 kettenis Exp $ */
+/* $OpenBSD: reg.h,v 1.6 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: reg.h,v 1.8 2001/06/19 12:59:16 wiz Exp $ */
/*
#ifndef _MACHINE_REG_H_
#define _MACHINE_REG_H_
-/*
- * Registers passed to trap/syscall/etc.
- * This structure is known to occupy exactly 80 bytes (see locore.s).
- * Note, tf_global[0] is not actually written (since g0 is always 0).
- * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb.
- * This is known as `cheating'.)
- */
-struct trapframe32 {
- int tf_psr; /* psr */
- int tf_pc; /* return pc */
- int tf_npc; /* return npc */
- int tf_y; /* %y register */
- int tf_global[8]; /* global registers in trap's caller */
- int tf_out[8]; /* output registers in trap's caller */
-};
-
-/*
- * The v9 trapframe is a bit more complex. Since we don't get a free
- * register window with each trap we need some way to keep track of
- * pending traps. We use tf_fault to save the faulting address for
- * memory faults and tf_kstack to thread trapframes on the kernel
- * stack(s). If tf_kstack == 0 then this is the lowest level trap;
- * we came from user mode.
- */
-struct trapframe64 {
- int64_t tf_tstate; /* tstate register */
- int64_t tf_pc; /* return pc */
- int64_t tf_npc; /* return npc */
- int64_t tf_fault; /* faulting addr -- need somewhere to save it */
- int64_t tf_kstack; /* kernel stack of prev tf */
- int tf_y; /* %y register -- 32-bits */
- short tf_tt; /* What type of trap this was */
- char tf_pil; /* What IRQ we're handling */
- char tf_oldpil; /* What our old SPL was */
- int64_t tf_global[8]; /* global registers in trap's caller */
- int64_t tf_out[8]; /* output registers in trap's caller */
- int64_t tf_local[8]; /* local registers in trap's caller */
- int64_t tf_in[8]; /* in registers in trap's caller (for debug) */
-};
-
-/*
- * Register windows. Each stack pointer (%o6 aka %sp) in each window
- * must ALWAYS point to some place at which it is safe to scribble on
- * 64 bytes. (If not, your process gets mangled.) Furthermore, each
- * stack pointer should be aligned on an 8-byte boundary for v8 stacks
- * or a 16-byte boundary (plus the BIAS) for v9 stacks (the kernel
- * as currently coded allows arbitrary alignment, but with a hefty
- * performance penalty).
- */
-struct rwindow32 {
- int rw_local[8]; /* %l0..%l7 */
- int rw_in[8]; /* %i0..%i7 */
-};
-
-/* Don't forget the BIAS!! */
-struct rwindow64 {
- int64_t rw_local[8]; /* %l0..%l7 */
- int64_t rw_in[8]; /* %i0..%i7 */
-};
-
-/*
- * Clone trapframe for now; this seems to be the more useful
- * than the old struct reg above.
- */
-struct reg32 {
- int r_psr; /* psr */
- int r_pc; /* return pc */
- int r_npc; /* return npc */
- int r_y; /* %y register */
- int r_global[8]; /* global registers in trap's caller */
- int r_out[8]; /* output registers in trap's caller */
-};
-
-struct reg64 {
+struct reg {
int64_t r_tstate; /* tstate register */
int64_t r_pc; /* return pc */
int64_t r_npc; /* return npc */
* XXXX UltraSPARC processors don't implement a floating point queue.
*/
#define FP_QSIZE 16
-#define ALIGNFPSTATE(f) ((struct fpstate64 *)(((long)(f))&(~BLOCK_ALIGN)))
+#define ALIGNFPSTATE(f) ((struct fpstate *)(((long)(f))&(~BLOCK_ALIGN)))
struct fp_qentry {
int *fq_addr; /* the instruction's address */
int fq_instr; /* the instruction itself */
};
-struct fpstate64 {
+struct fpstate {
u_int fs_regs[64]; /* our view is 64 32-bit registers */
int64_t fs_fsr; /* %fsr */
int fs_gsr; /* graphics state reg */
struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
};
-/*
- * For 32-bit emulations.
- */
-struct fpstate32 {
- u_int fs_regs[32]; /* our view is 32 32-bit registers */
- int fs_fsr; /* %fsr */
- int fs_qsize; /* actual queue depth */
- struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
-};
-
/*
* The actual FP registers are made accessible (c.f. ptrace(2)) through
* a `struct fpreg'; <arch/sparc64/sparc64/process_machdep.c> relies on the
* fact that `fpreg' is a prefix of `fpstate'.
*/
-struct fpreg64 {
+struct fpreg {
u_int fr_regs[64]; /* our view is 64 32-bit registers */
int64_t fr_fsr; /* %fsr */
int fr_gsr; /* graphics state reg */
};
-/*
- * 32-bit fpreg used by 32-bit sparc CPUs
- */
-struct fpreg32 {
- u_int fr_regs[32]; /* our view is 32 32-bit registers */
- int fr_fsr; /* %fsr */
-};
-
-/* Here we gotta do naughty things to let gdb work on 32-bit binaries */
-#define reg reg64
-#define fpreg fpreg64
-#define fpstate fpstate64
-#define trapframe trapframe64
-#define rwindow rwindow64
-
#endif /* _MACHINE_REG_H_ */
-/* $OpenBSD: db_interface.c,v 1.59 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: db_interface.c,v 1.60 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */
/*
extern char *trap_type[];
-void kdb_kbd_trap(struct trapframe64 *);
+void kdb_kbd_trap(struct trapframe *);
void db_prom_cmd(db_expr_t, int, db_expr_t, char *);
void db_proc_cmd(db_expr_t, int, db_expr_t, char *);
void db_ctx_cmd(db_expr_t, int, db_expr_t, char *);
* Received keyboard interrupt sequence.
*/
void
-kdb_kbd_trap(struct trapframe64 *tf)
+kdb_kbd_trap(struct trapframe *tf)
{
if (db_active == 0 /* && (boothowto & RB_KDB) */) {
printf("\n\nkernel: keyboard interrupt tf=%p\n", tf);
* db_ktrap - field a TRACE or BPT trap
*/
int
-db_ktrap(int type, register struct trapframe64 *tf)
+db_ktrap(int type, register struct trapframe *tf)
{
int s, tl;
struct trapstate *ts = &ddb_regs.ddb_ts[0];
-/* $OpenBSD: db_trace.c,v 1.22 2020/04/18 04:45:20 visa Exp $ */
+/* $OpenBSD: db_trace.c,v 1.23 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
/*
db_expr_t offset;
char *name;
vaddr_t pc;
- struct frame64 *f64;
+ struct frame *f64;
/*
* Switch to frame that contains arguments
*/
- f64 = (struct frame64 *)(frame + BIAS);
+ f64 = (struct frame *)(frame + BIAS);
pc = (vaddr_t)KLOAD(f64->fr_pc);
frame = KLOAD(f64->fr_fp);
* Print %i0..%i5; hope these still reflect the
* actual arguments somewhat...
*/
- f64 = (struct frame64 *)(frame + BIAS);
+ f64 = (struct frame *)(frame + BIAS);
for (i = 0; i < 5; i++)
(*pr)("%lx, ", (long)KLOAD(f64->fr_arg[i]));
(*pr)("%lx) at ", (long)KLOAD(f64->fr_arg[i]));
void
stacktrace_save_at(struct stacktrace *st, unsigned int skip)
{
- struct frame64 *f64;
+ struct frame *f64;
vaddr_t pc;
vaddr_t frame;
st->st_count = 0;
while (st->st_count < STACKTRACE_MAX) {
- f64 = (struct frame64 *)(frame + BIAS);
+ f64 = (struct frame *)(frame + BIAS);
pc = (vaddr_t)KLOAD(f64->fr_pc);
frame = KLOAD(f64->fr_fp);
for (i = 0; i < addr && frame; i++) {
if ((frame & 1) == 0)
break;
- frame = ((struct frame64 *)(frame + BIAS))->fr_fp;
+ frame = ((struct frame *)(frame + BIAS))->fr_fp;
}
if ((frame & 1) == 0) {
void
db_print_window(u_int64_t frame)
{
- struct frame64 *f = (struct frame64 *)(frame + BIAS);
+ struct frame *f = (struct frame *)(frame + BIAS);
- db_printf("frame64 %p locals, ins:\n", f);
+ db_printf("frame %p locals, ins:\n", f);
if (INKERNEL(f)) {
db_printf("%llx %llx %llx %llx ",
(unsigned long long)f->fr_local[0],
db_printsym(f->fr_pc, DB_STGY_PROC, db_printf);
db_printf("\n");
} else {
- struct frame64 fr;
+ struct frame fr;
if (copyin(f, &fr, sizeof(fr)))
return;
}
frame += BIAS;
- if (!INKERNEL(((struct frame64 *)frame))
+ if (!INKERNEL(((struct frame *)frame))
&& kernel_only) break;
db_printf("Window %x ", i);
db_print_window(frame - BIAS);
- if (!INKERNEL(((struct frame64 *)frame))) {
- copyin(&((struct frame64 *)frame)->fr_fp, &frame,
+ if (!INKERNEL(((struct frame *)frame))) {
+ copyin(&((struct frame *)frame)->fr_fp, &frame,
sizeof(frame));
} else
- frame = ((struct frame64 *)frame)->fr_fp;
+ frame = ((struct frame *)frame)->fr_fp;
}
}
void
db_dump_trap(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
- struct trapframe64 *tf;
+ struct trapframe *tf;
/* Use our last trapframe? */
tf = &ddb_regs.ddb_tf;
}
/* Or an arbitrary trapframe */
if (have_addr)
- tf = (struct trapframe64 *)addr;
+ tf = (struct trapframe *)addr;
db_printf("Trapframe %p:\ttstate: %llx\tpc: %llx\tnpc: %llx\n",
tf, (unsigned long long)tf->tf_tstate,
void
db_dump_fpstate(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
- struct fpstate64 *fpstate;
+ struct fpstate *fpstate;
/* Use our last trapframe? */
fpstate = &ddb_regs.ddb_fpstate;
/* Or an arbitrary trapframe */
if (have_addr)
- fpstate = (struct fpstate64 *)addr;
+ fpstate = (struct fpstate *)addr;
db_printf("fpstate %p: fsr = %llx gsr = %lx\nfpregs:\n",
fpstate, (unsigned long long)fpstate->fs_fsr,
-/* $OpenBSD: emul.c,v 1.26 2020/09/14 13:30:33 deraadt Exp $ */
+/* $OpenBSD: emul.c,v 1.27 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: emul.c,v 1.8 2001/06/29 23:58:40 eeh Exp $ */
/*-
int
emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf)
{
- extern struct fpstate64 initfpstate;
- struct fpstate64 *fs = p->p_md.md_fpstate;
+ extern struct fpstate initfpstate;
+ struct fpstate *fs = p->p_md.md_fpstate;
int64_t addr, buf[2];
union instr ins;
int freg, isload, err;
-# $OpenBSD: genassym.cf,v 1.38 2019/06/11 15:23:41 mpi Exp $
+# $OpenBSD: genassym.cf,v 1.39 2022/10/21 18:55:42 miod Exp $
# $NetBSD: genassym.cf,v 1.23 2001/08/08 00:09:30 eeh Exp $
#
endif
# FPU state
-struct fpstate64
+struct fpstate
member fs_regs
member fs_fsr
member fs_gsr
member fs_qsize
member fs_queue
-define FS_SIZE sizeof(struct fpstate64)
+define FS_SIZE sizeof(struct fpstate)
export FSR_QNE
export FPRS_FEF
export FPRS_DU
member PCB_LASTCALL lastcall
define PCB_SIZE sizeof(struct pcb)
-# trapframe64 fields
-struct trapframe64
+# trapframe fields
+struct trapframe
member tf_tstate
member tf_pc
member tf_npc
member TF_O tf_out
member TF_L tf_local
member TF_I tf_in
-define TF_SIZE sizeof(struct trapframe64)
+define TF_SIZE sizeof(struct trapframe)
ifdef notyet
# clockframe fields
-/* $OpenBSD: intr.c,v 1.62 2020/12/28 14:23:30 mpi Exp $ */
+/* $OpenBSD: intr.c,v 1.63 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */
/*
#define INTR_DEVINO 0x8000
-void strayintr(const struct trapframe64 *, int);
+void strayintr(const struct trapframe *, int);
int softintr(void *);
-int intr_handler(struct trapframe64 *, struct intrhand *);
+int intr_handler(struct trapframe *, struct intrhand *);
int intr_list_handler(void *);
void intr_ack(struct intrhand *);
int straycnt[16];
void
-strayintr(const struct trapframe64 *fp, int vectored)
+strayintr(const struct trapframe *fp, int vectored)
{
static int straytime, nstray;
int timesince;
}
int
-intr_handler(struct trapframe64 *tf, struct intrhand *ih)
+intr_handler(struct trapframe *tf, struct intrhand *ih)
{
int rc;
#ifdef MULTIPROCESSOR
-/* $OpenBSD: locore.s,v 1.192 2022/09/08 17:44:48 miod Exp $ */
+/* $OpenBSD: locore.s,v 1.193 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
dec %g7 ! Make it into a mask
andncc %g2, %g7, %g0 ! XXXXXXXXXX This assumes kernel addresses are unique from user addresses */ \
movz %xcc, %g1, %g6 ! Stay on interrupt stack?
- add %g6, -CCFSZ, %g6 ! Allocate a stack frame
+ add %g6, -CC64FSZ, %g6 ! Allocate a stack frame
mov %sp, %l6 ! XXXXX Save old stack pointer
mov %g6, %sp
ta 1; nop ! Enter debugger
-/* $OpenBSD: machdep.c,v 1.201 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.202 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
setregs(struct proc *p, struct exec_package *pack, vaddr_t stack,
register_t *retval)
{
- struct trapframe64 *tf = p->p_md.md_tf;
+ struct trapframe *tf = p->p_md.md_tf;
int64_t tstate;
int pstate = PSTATE_USER;
Elf_Ehdr *eh = pack->ep_hdr;
* to save it. In any case, get rid of our FPU state.
*/
fpusave_proc(p, 0);
- free(p->p_md.md_fpstate, M_SUBPROC, sizeof(struct fpstate64));
+ free(p->p_md.md_fpstate, M_SUBPROC, sizeof(struct fpstate));
p->p_md.md_fpstate = NULL;
}
bzero((caddr_t)tf, sizeof *tf);
{
struct proc *p = curproc;
struct sigframe *fp;
- struct trapframe64 *tf;
+ struct trapframe *tf;
vaddr_t addr, oldsp, newsp;
struct sigframe sf;
syscallarg(struct sigcontext *) sigcntxp;
} */ *uap = v;
struct sigcontext ksc, *scp = SCARG(uap, sigcntxp);
- struct trapframe64 *tf;
+ struct trapframe *tf;
int error = EINVAL;
if (PROC_PC(p) != p->p_p->ps_sigcoderet) {
}
}
-void trapdump(struct trapframe64*);
+void trapdump(struct trapframe *);
/*
* dump out a trapframe.
*/
void
-trapdump(struct trapframe64* tf)
+trapdump(struct trapframe *tf)
{
printf("TRAPFRAME: tstate=%llx pc=%llx npc=%llx y=%x\n",
(unsigned long long)tf->tf_tstate, (unsigned long long)tf->tf_pc,
void
stackdump(void)
{
- struct frame32 *fp = (struct frame32 *)getfp(), *sfp;
- struct frame64 *fp64;
+ struct frame *sfp = getfp(), *fp64;
- sfp = fp;
- printf("Frame pointer is at %p\n", fp);
+ fp64 = sfp = v9next_frame(sfp);
+ printf("Frame pointer is at %p\n", fp64);
printf("Call traceback:\n");
- while (fp && ((u_long)fp >> PGSHIFT) == ((u_long)sfp >> PGSHIFT)) {
- if( ((long)fp) & 1 ) {
- fp64 = (struct frame64*)(((char *)fp)+BIAS);
- /* 64-bit frame */
- printf("%llx(%llx, %llx, %llx, %llx, %llx, %llx, %llx) "
- "fp = %llx\n",
- (unsigned long long)fp64->fr_pc,
- (unsigned long long)fp64->fr_arg[0],
- (unsigned long long)fp64->fr_arg[1],
- (unsigned long long)fp64->fr_arg[2],
- (unsigned long long)fp64->fr_arg[3],
- (unsigned long long)fp64->fr_arg[4],
- (unsigned long long)fp64->fr_arg[5],
- (unsigned long long)fp64->fr_arg[6],
- (unsigned long long)fp64->fr_fp);
- fp = (struct frame32 *)(u_long)fp64->fr_fp;
- } else {
- /* 32-bit frame */
- printf(" pc = %x args = (%x, %x, %x, %x, %x, %x) "
- "fp = %x\n", fp->fr_pc, fp->fr_arg[0],
- fp->fr_arg[1], fp->fr_arg[2], fp->fr_arg[3],
- fp->fr_arg[4], fp->fr_arg[5], fp->fr_fp);
- fp = (struct frame32*)(u_long)(u_short)fp->fr_fp;
- }
+ while (fp64 && ((u_long)fp64 >> PGSHIFT) == ((u_long)sfp >> PGSHIFT)) {
+ printf("%llx(%llx, %llx, %llx, %llx, %llx, %llx, %llx) "
+ "fp = %llx\n",
+ (unsigned long long)fp64->fr_pc,
+ (unsigned long long)fp64->fr_arg[0],
+ (unsigned long long)fp64->fr_arg[1],
+ (unsigned long long)fp64->fr_arg[2],
+ (unsigned long long)fp64->fr_arg[3],
+ (unsigned long long)fp64->fr_arg[4],
+ (unsigned long long)fp64->fr_arg[5],
+ (unsigned long long)fp64->fr_arg[6],
+ (unsigned long long)fp64->fr_fp);
+ fp64 = v9next_frame(fp64);
}
}
-/* $OpenBSD: process_machdep.c,v 1.13 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.14 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: process_machdep.c,v 1.10 2000/09/26 22:05:50 eeh Exp $ */
/*
#include <machine/frame.h>
#include <sys/ptrace.h>
-#ifndef P_32
-#define P_32 0
-#endif
/* Unfortunately we need to convert v9 trapframe to v8 regs */
int
process_read_regs(struct proc *p, struct reg *regs)
{
- struct trapframe64* tf = p->p_md.md_tf;
- struct reg32* regp = (struct reg32*)regs;
+ struct trapframe *tf = p->p_md.md_tf;
int i;
- if (!(curproc->p_flag & P_32)) {
- /* 64-bit mode -- copy out regs */
- regs->r_tstate = tf->tf_tstate;
- regs->r_pc = tf->tf_pc;
- regs->r_npc = tf->tf_npc;
- regs->r_y = tf->tf_y;
- for (i = 0; i < 8; i++) {
- regs->r_global[i] = tf->tf_global[i];
- regs->r_out[i] = tf->tf_out[i];
- regs->r_local[i] = tf->tf_local[i];
- regs->r_in[i] = tf->tf_in[i];
- }
- return (0);
- }
-
- /* 32-bit mode -- copy out & convert 32-bit regs */
- regp->r_psr = TSTATECCR_TO_PSR(tf->tf_tstate);
- regp->r_pc = tf->tf_pc;
- regp->r_npc = tf->tf_npc;
- regp->r_y = tf->tf_y;
+ /* copy out regs */
+ regs->r_tstate = tf->tf_tstate;
+ regs->r_pc = tf->tf_pc;
+ regs->r_npc = tf->tf_npc;
+ regs->r_y = tf->tf_y;
for (i = 0; i < 8; i++) {
- regp->r_global[i] = tf->tf_global[i];
- regp->r_out[i] = tf->tf_out[i];
+ regs->r_global[i] = tf->tf_global[i];
+ regs->r_out[i] = tf->tf_out[i];
+ regs->r_local[i] = tf->tf_local[i];
+ regs->r_in[i] = tf->tf_in[i];
}
- /* We should also write out the ins and locals. See signal stuff */
return (0);
}
int
process_read_fpregs(struct proc *p, struct fpreg *regs)
{
- extern struct fpstate64 initfpstate;
- struct fpstate64 *statep = &initfpstate;
- struct fpreg32 *regp = (struct fpreg32 *)regs;
- int i;
+ extern struct fpstate initfpstate;
+ struct fpstate *statep = &initfpstate;
/* NOTE: struct fpreg == struct fpstate */
if (p->p_md.md_fpstate) {
statep = p->p_md.md_fpstate;
}
- if (!(curproc->p_flag & P_32)) {
- /* 64-bit mode -- copy in fregs */
- bcopy(statep, regs, sizeof(struct fpreg64));
- return 0;
- }
- /* 32-bit mode -- copy out & convert 32-bit fregs */
- for (i = 0; i < 32; i++)
- regp->fr_regs[i] = statep->fs_regs[i];
-
+ /* copy in fregs */
+ bcopy(statep, regs, sizeof(struct fpreg));
return 0;
}
int
process_write_regs(struct proc *p, struct reg *regs)
{
- struct trapframe64* tf = p->p_md.md_tf;
- struct reg32* regp = (struct reg32*)regs;
+ struct trapframe *tf = p->p_md.md_tf;
int i;
- if (!(curproc->p_flag & P_32)) {
- /* 64-bit mode -- copy in regs */
- tf->tf_pc = regs->r_pc;
- tf->tf_npc = regs->r_npc;
- tf->tf_y = regs->r_y;
- for (i = 0; i < 8; i++) {
- tf->tf_global[i] = regs->r_global[i];
- tf->tf_out[i] = regs->r_out[i];
- }
- /* We should also read in the ins and locals. See signal stuff */
- tf->tf_tstate = (tf->tf_tstate & ~TSTATE_CCR) |
- (regs->r_tstate & TSTATE_CCR);
- return (0);
- }
-
- /* 32-bit mode -- copy in & convert 32-bit regs */
- tf->tf_pc = regp->r_pc;
- tf->tf_npc = regp->r_npc;
- tf->tf_y = regp->r_y;
+ /* copy in regs */
+ tf->tf_pc = regs->r_pc;
+ tf->tf_npc = regs->r_npc;
+ tf->tf_y = regs->r_y;
for (i = 0; i < 8; i++) {
- tf->tf_global[i] = regp->r_global[i];
- tf->tf_out[i] = regp->r_out[i];
+ tf->tf_global[i] = regs->r_global[i];
+ tf->tf_out[i] = regs->r_out[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);
+ tf->tf_tstate = (tf->tf_tstate & ~TSTATE_CCR) |
+ (regs->r_tstate & TSTATE_CCR);
return (0);
}
int
process_write_fpregs(struct proc *p, struct fpreg *regs)
{
- struct fpreg32 *regp = (struct fpreg32 *)regs;
- int i;
-
if (p->p_md.md_fpstate == NULL) {
- p->p_md.md_fpstate = malloc(sizeof(struct fpstate64),
+ p->p_md.md_fpstate = malloc(sizeof(struct fpstate),
M_SUBPROC, M_WAITOK);
} else
fpusave_proc(p, 1);
- if (!(curproc->p_flag & P_32)) {
- /* 64-bit mode -- copy in fregs */
- bcopy(regs, p->p_md.md_fpstate, sizeof(struct fpreg64));
- p->p_md.md_fpstate->fs_qsize = 0;
- return 0;
- }
- /* 32-bit mode -- copy in & convert 32-bit fregs */
- for (i = 0; i < 32; i++)
- p->p_md.md_fpstate->fs_regs[i] = regp->fr_regs[i];
- p->p_md.md_fpstate->fs_fsr = regp->fr_fsr;
+ /* copy in fregs */
+ bcopy(regs, p->p_md.md_fpstate, sizeof(struct fpreg));
p->p_md.md_fpstate->fs_qsize = 0;
-
return 0;
}
-/* $OpenBSD: trap.c,v 1.110 2021/12/09 00:26:11 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.111 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
* seems to imply that we should do this, and it does make sense.
*/
__asm(".align 64");
-struct fpstate64 initfpstate = {
+struct fpstate initfpstate = {
{ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0 }
};
#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
-static inline void share_fpu(struct proc *, struct trapframe64 *);
+static inline void share_fpu(struct proc *, struct trapframe *);
-void trap(struct trapframe64 *tf, unsigned type, vaddr_t pc, long tstate);
-void data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
+void trap(struct trapframe *tf, unsigned type, vaddr_t pc, long tstate);
+void data_access_fault(struct trapframe *tf, unsigned type, vaddr_t pc,
vaddr_t va, vaddr_t sfva, u_long sfsr);
-void data_access_error(struct trapframe64 *tf, unsigned type,
+void data_access_error(struct trapframe *tf, unsigned type,
vaddr_t afva, u_long afsr, vaddr_t sfva, u_long sfsr);
-void text_access_fault(struct trapframe64 *tf, unsigned type,
+void text_access_fault(struct trapframe *tf, unsigned type,
vaddr_t pc, u_long sfsr);
-void text_access_error(struct trapframe64 *tf, unsigned type,
+void text_access_error(struct trapframe *tf, unsigned type,
vaddr_t pc, u_long sfsr, vaddr_t afva, u_long afsr);
-void syscall(struct trapframe64 *, register_t code, register_t pc);
+void syscall(struct trapframe *, register_t code, register_t pc);
/*
* If someone stole the FPU while we were away, do not enable it
* Oh, and don't touch the FPU bit if we're returning to the kernel.
*/
static inline void
-share_fpu(struct proc *p, struct trapframe64 *tf)
+share_fpu(struct proc *p, struct trapframe *tf)
{
if (!(tf->tf_tstate & TSTATE_PRIV) &&
(tf->tf_tstate & TSTATE_PEF) && fpproc != p)
* (MMU-related traps go through mem_access_fault, below.)
*/
void
-trap(struct trapframe64 *tf, unsigned type, vaddr_t pc, long tstate)
+trap(struct trapframe *tf, unsigned type, vaddr_t pc, long tstate)
{
struct proc *p;
struct pcb *pcb;
break;
case T_FPDISABLED: {
- struct fpstate64 *fs = p->p_md.md_fpstate;
+ struct fpstate *fs = p->p_md.md_fpstate;
if (fs == NULL) {
KERNEL_LOCK();
for (i = 0; i < pcb->pcb_nsaved; i++) {
pcb->pcb_rw[i].rw_in[7] ^= pcb->pcb_wcookie;
if (copyout(&pcb->pcb_rw[i], (void *)(pcb->pcb_rwsp[i] + BIAS),
- sizeof(struct rwindow64)))
+ sizeof(struct rwindow)))
return (-1);
}
* of them could be recoverable through uvm_fault.
*/
void
-data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
+data_access_fault(struct trapframe *tf, unsigned type, vaddr_t pc,
vaddr_t addr, vaddr_t sfva, u_long sfsr)
{
struct proc *p = curproc;
* special PEEK/POKE code sequence.
*/
void
-data_access_error(struct trapframe64 *tf, unsigned type, vaddr_t afva,
+data_access_error(struct trapframe *tf, unsigned type, vaddr_t afva,
u_long afsr, vaddr_t sfva, u_long sfsr)
{
struct proc *p = curproc;
* of them could be recoverable through uvm_fault.
*/
void
-text_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
+text_access_fault(struct trapframe *tf, unsigned type, vaddr_t pc,
u_long sfsr)
{
struct proc *p = curproc;
* special PEEK/POKE code sequence.
*/
void
-text_access_error(struct trapframe64 *tf, unsigned type, vaddr_t pc,
+text_access_error(struct trapframe *tf, unsigned type, vaddr_t pc,
u_long sfsr, vaddr_t afva, u_long afsr)
{
struct proc *p = curproc;
* thing that made the system call, and are named that way here.
*/
void
-syscall(struct trapframe64 *tf, register_t code, register_t pc)
+syscall(struct trapframe *tf, register_t code, register_t pc)
{
int i, nap;
int64_t *ap;
panic("syscall from kernel");
if (curpcb != &p->p_addr->u_pcb)
panic("syscall: cpcb/ppcb mismatch");
- if (tf != (struct trapframe64 *)((caddr_t)curpcb + USPACE) - 1)
+ if (tf != (struct trapframe *)((caddr_t)curpcb + USPACE) - 1)
panic("syscall: trapframe");
#endif
p->p_md.md_tf = tf;
panic("syscall nargs");
/* Read the whole block in */
if ((error = copyin((caddr_t)tf->tf_out[6]
- + BIAS + offsetof(struct frame64, fr_argx),
+ + BIAS + offsetof(struct frame, fr_argx),
&args[nap], (i - nap) * sizeof(register_t))))
goto bad;
i = nap;
child_return(void *arg)
{
struct proc *p = arg;
- struct trapframe64 *tf = p->p_md.md_tf;
+ struct trapframe *tf = p->p_md.md_tf;
vaddr_t dest;
/* Duplicate efforts of syscall(), but slightly differently */
-/* $OpenBSD: vm_machdep.c,v 1.40 2022/05/27 18:55:30 kettenis Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.41 2022/10/21 18:55:42 miod Exp $ */
/* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */
/*
bcopy((caddr_t)opcb, (caddr_t)npcb, sizeof(struct pcb));
if (p1->p_md.md_fpstate) {
fpusave_proc(p1, 1);
- p2->p_md.md_fpstate = malloc(sizeof(struct fpstate64),
+ p2->p_md.md_fpstate = malloc(sizeof(struct fpstate),
M_SUBPROC, M_WAITOK);
bcopy(p1->p_md.md_fpstate, p2->p_md.md_fpstate,
- sizeof(struct fpstate64));
+ sizeof(struct fpstate));
} else
p2->p_md.md_fpstate = NULL;
{
if (p->p_md.md_fpstate != NULL) {
fpusave_proc(p, 0);
- free(p->p_md.md_fpstate, M_SUBPROC, sizeof(struct fpstate64));
+ free(p->p_md.md_fpstate, M_SUBPROC, sizeof(struct fpstate));
}
pmap_deactivate(p);