kettenis@ suggested in a different thread that we ought to clean up
the 32-bit compatibility cruft in the sparc64 machine headers before
it would be safe to move the clockframe definition into frame.h:

https://marc.info/?l=openbsd-tech&m=166179164008301&w=2

> We really should be getting rid of the xxx32 stuff and rename the
> xxx64 ones to xxx.  And move trapframe (and possibly rwindow) to
> frame.h.

miod@ came forward in private and offered the attached patch to do so.

I don't have a sparc64 machine so I can't test it.  But if this
cleanup is indeed a necessary step to consolidating the clockframe
definitions I guess I can just ask:

Does this patch work for everyone?  Can we go ahead with this?

Index: dev/creator.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/dev/creator.c,v
retrieving revision 1.55
diff -u -p -r1.55 creator.c
--- dev/creator.c       15 Jul 2022 17:57:26 -0000      1.55
+++ dev/creator.c       30 Aug 2022 18:33:27 -0000
@@ -33,8 +33,9 @@
 #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>
Index: fpu/fpu.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/fpu/fpu.c,v
retrieving revision 1.21
diff -u -p -r1.21 fpu.c
--- fpu/fpu.c   19 Aug 2020 10:10:58 -0000      1.21
+++ fpu/fpu.c   30 Aug 2022 18:33:27 -0000
@@ -81,22 +81,22 @@
 #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
@@ -115,7 +115,7 @@ fpu_dumpfpn(struct fpn *fp)
            fp->fp_mant[2], fp->fp_mant[3], fp->fp_exp);
 }
 void
-fpu_dumpstate(struct fpstate64 *fs)
+fpu_dumpstate(struct fpstate *fs)
 {
        int i;
 
@@ -189,7 +189,7 @@ fpu_fcopy(src, dst, type)
 void
 fpu_cleanup(p, fs)
        register struct proc *p;
-       register struct fpstate64 *fs;
+       register struct fpstate *fs;
 {
        register int i, fsr = fs->fs_fsr, error;
        union instr instr;
@@ -455,7 +455,7 @@ fpu_execute(p, fe, instr)
  */
 int
 fpu_insn_fmov(fs, fe, instr)
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        struct fpemu *fe;
        union instr instr;
 {
@@ -478,7 +478,7 @@ fpu_insn_fmov(fs, fe, instr)
  */
 int
 fpu_insn_fabs(fs, fe, instr)
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        struct fpemu *fe;
        union instr instr;
 {
@@ -502,7 +502,7 @@ fpu_insn_fabs(fs, fe, instr)
  */
 int
 fpu_insn_fneg(fs, fe, instr)
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        struct fpemu *fe;
        union instr instr;
 {
@@ -644,7 +644,7 @@ fpu_insn_fsqrt(fe, instr, rdp, rdtypep, 
  */
 int
 fpu_insn_fcmp(fs, fe, instr, cmpe)
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        struct fpemu *fe;
        union instr instr;
        int cmpe;
@@ -848,7 +848,7 @@ fpu_insn_fsub(fe, instr, rdp, rdtypep, s
 int
 fpu_insn_fmovcc(p, fs, instr)
        struct proc *p;
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        union instr instr;
 {
        int rtype, rd, rs, cond;
@@ -900,7 +900,7 @@ fpu_insn_fmovcc(p, fs, instr)
 int
 fpu_insn_fmovr(p, fs, instr)
        struct proc *p;
-       struct fpstate64 *fs;
+       struct fpstate *fs;
        union instr instr;
 {
        int rtype, rd, rs2, rs1;
Index: fpu/fpu_emu.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/fpu/fpu_emu.h,v
retrieving revision 1.5
diff -u -p -r1.5 fpu_emu.h
--- fpu/fpu_emu.h       21 Jun 2006 19:24:38 -0000      1.5
+++ fpu/fpu_emu.h       30 Aug 2022 18:33:27 -0000
@@ -136,7 +136,7 @@ struct fpn {
  * 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 */
@@ -181,7 +181,7 @@ void        fpu_implode(struct fpemu *, struct 
 #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))
Index: fpu/fpu_extern.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/fpu/fpu_extern.h,v
retrieving revision 1.6
diff -u -p -r1.6 fpu_extern.h
--- fpu/fpu_extern.h    26 Jun 2008 05:42:13 -0000      1.6
+++ fpu/fpu_extern.h    30 Aug 2022 18:33:27 -0000
@@ -31,15 +31,15 @@
  */
 
 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 */
Index: include/cpu.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/cpu.h,v
retrieving revision 1.98
diff -u -p -r1.98 cpu.h
--- include/cpu.h       6 Jul 2021 09:34:07 -0000       1.98
+++ include/cpu.h       30 Aug 2022 18:33:27 -0000
@@ -74,7 +74,7 @@
 
 #include <machine/ctlreg.h>
 #include <machine/psl.h>
-#include <machine/reg.h>
+#include <machine/frame.h>
 #include <machine/intr.h>
 
 #include <sys/sched.h>
@@ -144,7 +144,7 @@ struct cpu_info {
        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;
@@ -271,7 +271,7 @@ do {                                                        
                \
  * as well for strayintr (see locore.s:interrupt and intr.c:strayintr).
  */
 struct clockframe {
-       struct trapframe64 t;
+       struct trapframe t;
        int saved_intr_level;
 };
 
@@ -316,9 +316,9 @@ struct timeval;
 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" : : )
@@ -344,11 +344,13 @@ int       cnrom(void);
 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 *);
 
 /*
  *
Index: include/db_machdep.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/db_machdep.h,v
retrieving revision 1.22
diff -u -p -r1.22 db_machdep.h
--- include/db_machdep.h        30 Aug 2021 08:11:12 -0000      1.22
+++ include/db_machdep.h        30 Aug 2022 18:33:27 -0000
@@ -53,11 +53,11 @@ struct trapstate {
 };
 #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 {
@@ -129,7 +129,7 @@ vaddr_t             db_branch_taken(int inst, vaddr
 #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 *);
Index: include/frame.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/frame.h,v
retrieving revision 1.6
diff -u -p -r1.6 frame.h
--- include/frame.h     23 Mar 2011 16:54:37 -0000      1.6
+++ include/frame.h     30 Aug 2022 18:33:27 -0000
@@ -45,39 +45,6 @@
 #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.
  *
  * Note that the contents of each stack frame may be held only in
@@ -89,7 +56,7 @@ struct frame32 {
  * 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) */
@@ -101,7 +68,7 @@ struct frame64 {
        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
 
 /*
@@ -115,5 +82,43 @@ struct frame64 {
  * detect it by testing the register for an odd value.  Why 2K-1 I don't know.
  */
 #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_ */
Index: include/pcb.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/pcb.h,v
retrieving revision 1.10
diff -u -p -r1.10 pcb.h
--- include/pcb.h       5 May 2015 02:13:47 -0000       1.10
+++ include/pcb.h       30 Aug 2022 18:33:27 -0000
@@ -139,7 +139,7 @@ struct pcb {
        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];
 };
 
Index: include/proc.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/proc.h,v
retrieving revision 1.7
diff -u -p -r1.7 proc.h
--- include/proc.h      13 Apr 2017 03:52:25 -0000      1.7
+++ include/proc.h      30 Aug 2022 18:33:27 -0000
@@ -44,7 +44,7 @@
  * 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;
 };
Index: include/reg.h
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/include/reg.h,v
retrieving revision 1.5
diff -u -p -r1.5 reg.h
--- include/reg.h       22 Dec 2008 23:01:31 -0000      1.5
+++ include/reg.h       30 Aug 2022 18:33:27 -0000
@@ -44,80 +44,7 @@
 #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 */
@@ -142,14 +69,14 @@ struct reg64 {
  * 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 */
@@ -157,40 +84,15 @@ struct fpstate64 {
        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_ */
Index: sparc64/db_interface.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/db_interface.c,v
retrieving revision 1.58
diff -u -p -r1.58 db_interface.c
--- sparc64/db_interface.c      14 Apr 2022 19:47:12 -0000      1.58
+++ sparc64/db_interface.c      30 Aug 2022 18:33:27 -0000
@@ -200,7 +200,7 @@ extern label_t      *db_recover;
 
 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 *);
@@ -238,7 +238,7 @@ void db_ddbproc_cmd(db_expr_t, int, db_e
  */
 void
 kdb_kbd_trap(tf)
-       struct trapframe64 *tf;
+       struct trapframe *tf;
 {
        if (db_active == 0 /* && (boothowto & RB_KDB) */) {
                printf("\n\nkernel: keyboard interrupt tf=%p\n", tf);
@@ -252,7 +252,7 @@ kdb_kbd_trap(tf)
 int
 db_ktrap(type, tf)
        int     type;
-       register struct trapframe64 *tf;
+       register struct trapframe *tf;
 {
        int s, tl;
        struct trapstate *ts = &ddb_regs.ddb_ts[0];
Index: sparc64/db_trace.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/db_trace.c,v
retrieving revision 1.22
diff -u -p -r1.22 db_trace.c
--- sparc64/db_trace.c  18 Apr 2020 04:45:20 -0000      1.22
+++ sparc64/db_trace.c  30 Aug 2022 18:33:27 -0000
@@ -104,13 +104,13 @@ db_stack_trace_print(db_expr_t addr, int
                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);
@@ -145,7 +145,7 @@ db_stack_trace_print(db_expr_t addr, int
                 * 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]));
@@ -157,7 +157,7 @@ db_stack_trace_print(db_expr_t addr, int
 void
 stacktrace_save_at(struct stacktrace *st, unsigned int skip)
 {
-       struct frame64  *f64;
+       struct frame    *f64;
        vaddr_t         pc;
        vaddr_t         frame;
 
@@ -169,7 +169,7 @@ stacktrace_save_at(struct stacktrace *st
 
        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);
@@ -202,7 +202,7 @@ db_dump_window(db_expr_t addr, int have_
        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) {
@@ -217,9 +217,9 @@ db_dump_window(db_expr_t addr, int have_
 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],
@@ -245,7 +245,7 @@ db_print_window(u_int64_t frame)
                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;
@@ -309,15 +309,15 @@ db_dump_stack(db_expr_t addr, int have_a
                }
 
                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;
        }
 
 }
@@ -326,7 +326,7 @@ db_dump_stack(db_expr_t addr, int have_a
 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;
@@ -339,7 +339,7 @@ db_dump_trap(db_expr_t addr, int have_ad
        }
        /* 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,
@@ -409,13 +409,13 @@ db_dump_trap(db_expr_t addr, int have_ad
 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,
Index: sparc64/emul.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/emul.c,v
retrieving revision 1.26
diff -u -p -r1.26 emul.c
--- sparc64/emul.c      14 Sep 2020 13:30:33 -0000      1.26
+++ sparc64/emul.c      30 Aug 2022 18:33:27 -0000
@@ -67,8 +67,8 @@ swap_quad(int64_t *p)
 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;
Index: sparc64/genassym.cf
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/genassym.cf,v
retrieving revision 1.38
diff -u -p -r1.38 genassym.cf
--- sparc64/genassym.cf 11 Jun 2019 15:23:41 -0000      1.38
+++ sparc64/genassym.cf 30 Aug 2022 18:33:27 -0000
@@ -157,13 +157,13 @@ member    ci_mutex_level
 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
@@ -193,8 +193,8 @@ member      pcb_pc
 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
@@ -213,7 +213,7 @@ member      TF_G            tf_global
 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 
Index: sparc64/intr.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/intr.c,v
retrieving revision 1.62
diff -u -p -r1.62 intr.c
--- sparc64/intr.c      28 Dec 2020 14:23:30 -0000      1.62
+++ sparc64/intr.c      30 Aug 2022 18:33:27 -0000
@@ -67,9 +67,9 @@ struct intrhand *intrlev[MAXINTNUM];
 
 #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 *);
 
@@ -81,7 +81,7 @@ int ignore_stray = 1;
 int straycnt[16];
 
 void
-strayintr(const struct trapframe64 *fp, int vectored)
+strayintr(const struct trapframe *fp, int vectored)
 {
        static int straytime, nstray;
        int timesince;
@@ -116,7 +116,7 @@ strayintr(const struct trapframe64 *fp, 
 }
 
 int
-intr_handler(struct trapframe64 *tf, struct intrhand *ih)
+intr_handler(struct trapframe *tf, struct intrhand *ih)
 {
        int rc;
 #ifdef MULTIPROCESSOR
Index: sparc64/locore.s
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/locore.s,v
retrieving revision 1.191
diff -u -p -r1.191 locore.s
--- sparc64/locore.s    2 Jan 2022 23:34:15 -0000       1.191
+++ sparc64/locore.s    30 Aug 2022 18:33:27 -0000
@@ -2220,7 +2220,7 @@ winfixsave:
        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
Index: sparc64/machdep.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/machdep.c,v
retrieving revision 1.200
diff -u -p -r1.200 machdep.c
--- sparc64/machdep.c   6 Oct 2021 15:46:03 -0000       1.200
+++ sparc64/machdep.c   30 Aug 2022 18:33:27 -0000
@@ -268,7 +268,7 @@ setregs(p, pack, stack, retval)
        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;
@@ -327,7 +327,7 @@ setregs(p, pack, stack, retval)
                 * 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);
@@ -408,7 +408,7 @@ sendsig(sig_t catcher, int sig, sigset_t
 {
        struct proc *p = curproc;
        struct sigframe *fp;
-       struct trapframe64 *tf;
+       struct trapframe *tf;
        vaddr_t addr, oldsp, newsp;
        struct sigframe sf;
 
@@ -510,7 +510,7 @@ sys_sigreturn(struct proc *p, void *v, r
                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) {
@@ -836,13 +836,13 @@ printf("starting dump, blkno %lld\n", (l
        }
 }
 
-void trapdump(struct trapframe64*);
+void trapdump(struct trapframe*);
 /*
  * dump out a trapframe.
  */
 void
 trapdump(tf)
-       struct trapframe64* tf;
+       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,
@@ -872,36 +872,24 @@ trapdump(tf)
 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);
        }
 }
 
Index: sparc64/process_machdep.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/process_machdep.c,v
retrieving revision 1.12
diff -u -p -r1.12 process_machdep.c
--- sparc64/process_machdep.c   5 Mar 2009 19:52:23 -0000       1.12
+++ sparc64/process_machdep.c   30 Aug 2022 18:33:27 -0000
@@ -71,44 +71,25 @@
 #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(p, 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);
 }
 
@@ -117,10 +98,8 @@ process_read_fpregs(p, regs)
        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) {
@@ -128,15 +107,8 @@ process_read_fpregs(p, regs)
                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;
 }
 
@@ -147,36 +119,20 @@ process_write_regs(p, 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);
 }
 
@@ -207,27 +163,15 @@ process_write_fpregs(p, regs)
        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;
 }
 
Index: sparc64/trap.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/trap.c,v
retrieving revision 1.110
diff -u -p -r1.110 trap.c
--- sparc64/trap.c      9 Dec 2021 00:26:11 -0000       1.110
+++ sparc64/trap.c      30 Aug 2022 18:33:27 -0000
@@ -117,7 +117,7 @@ int rftkcnt[5] = { 0, 0, 0, 0, 0 };
  * 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 }
 };
@@ -309,18 +309,18 @@ const char *trap_type[] = {
 
 #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
@@ -331,7 +331,7 @@ void syscall(struct trapframe64 *, regis
  * 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)
@@ -343,7 +343,7 @@ share_fpu(struct proc *p, struct trapfra
  * (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;
@@ -498,7 +498,7 @@ dopanic:
                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();
@@ -697,7 +697,7 @@ rwindow_save(struct proc *p)
        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);
        }
 
@@ -738,7 +738,7 @@ accesstype(unsigned int type, u_long sfs
  * 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;
@@ -858,7 +858,7 @@ out:
  * 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;
@@ -926,7 +926,7 @@ out:
  * 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;
@@ -1004,7 +1004,7 @@ out:
  * 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;
@@ -1100,7 +1100,7 @@ out:
  * 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;
@@ -1119,7 +1119,7 @@ syscall(struct trapframe64 *tf, register
                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;
@@ -1161,7 +1161,7 @@ syscall(struct trapframe64 *tf, register
                                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;
@@ -1227,7 +1227,7 @@ void
 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 */
Index: sparc64/vm_machdep.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/vm_machdep.c,v
retrieving revision 1.40
diff -u -p -r1.40 vm_machdep.c
--- sparc64/vm_machdep.c        27 May 2022 18:55:30 -0000      1.40
+++ sparc64/vm_machdep.c        30 Aug 2022 18:33:27 -0000
@@ -140,10 +140,10 @@ cpu_fork(struct proc *p1, struct proc *p
        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;
 
@@ -265,7 +265,7 @@ cpu_exit(struct proc *p)
 {
        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);

Reply via email to