From 7b60d6a0ed7a232f3da1706a11d0cbc477948937 Mon Sep 17 00:00:00 2001 From: eeh Date: Sat, 6 Nov 1999 20:13:49 +0000 Subject: [PATCH] Provide explicit 64-bit and 32-bit types for compatibility with sparc userland. --- sys/arch/sparc64/include/cpu.h | 14 ++++----- sys/arch/sparc64/include/db_machdep.h | 6 ++-- sys/arch/sparc64/include/pcb.h | 42 +++++++++++++++++++++++++-- sys/arch/sparc64/include/proc.h | 6 ++-- sys/arch/sparc64/include/reg.h | 21 ++++++++++---- 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index 80a37036e797..bf1980513f47 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.13 1999/10/11 01:57:44 eeh Exp $ */ +/* $NetBSD: cpu.h,v 1.14 1999/11/06 20:13:49 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -85,7 +85,7 @@ */ extern int eintstack[]; struct clockframe { - struct trapframe t; + struct trapframe64 t; }; #define CLKF_USERMODE(framep) (((framep)->t.tf_tstate & TSTATE_PRIV) == 0) @@ -171,9 +171,9 @@ int tickintr __P((void *)); /* level 10 (tick) interrupt code */ int clockintr __P((void *));/* level 10 (clock) interrupt code */ int statintr __P((void *)); /* level 14 (statclock) interrupt code */ /* locore.s */ -struct fpstate; -void savefpstate __P((struct fpstate *)); -void loadfpstate __P((struct fpstate *)); +struct fpstate64; +void savefpstate __P((struct fpstate64 *)); +void loadfpstate __P((struct fpstate64 *)); int probeget __P((paddr_t, int, int)); int probeset __P((paddr_t, int, int, u_int64_t)); #if 0 @@ -216,8 +216,8 @@ void kgdb_connect __P((int)); void kgdb_panic __P((void)); #endif /* emul.c */ -int fixalign __P((struct proc *, struct trapframe *)); -int emulinstr __P((vaddr_t, struct trapframe *)); +int fixalign __P((struct proc *, struct trapframe64 *)); +int emulinstr __P((vaddr_t, struct trapframe64 *)); /* * diff --git a/sys/arch/sparc64/include/db_machdep.h b/sys/arch/sparc64/include/db_machdep.h index a63bbaf67dbd..4e11f61dfa43 100644 --- a/sys/arch/sparc64/include/db_machdep.h +++ b/sys/arch/sparc64/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.7 1999/01/31 09:21:19 mrg Exp $ */ +/* $NetBSD: db_machdep.h,v 1.8 1999/11/06 20:13:50 eeh Exp $ */ /* * Mach Operating System @@ -47,7 +47,7 @@ typedef long db_expr_t; /* expression - signed */ #if 1 typedef struct { - struct trapframe ddb_tf; + struct trapframe64 ddb_tf; struct frame64 ddb_fr; } db_regs_t; #else @@ -112,7 +112,7 @@ db_regs_t ddb_regs; /* register state */ #define DB_MACHINE_COMMANDS void db_machine_init __P((void)); -int kdb_trap __P((int, struct trapframe *)); +int kdb_trap __P((int, struct trapframe64 *)); /* * We will use elf symbols in DDB when they work. diff --git a/sys/arch/sparc64/include/pcb.h b/sys/arch/sparc64/include/pcb.h index 25a030301ae4..ea1e698d955d 100644 --- a/sys/arch/sparc64/include/pcb.h +++ b/sys/arch/sparc64/include/pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcb.h,v 1.2 1999/10/11 01:57:45 eeh Exp $ */ +/* $NetBSD: pcb.h,v 1.3 1999/11/06 20:13:50 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -150,9 +150,45 @@ struct pcb { * from the top of the kernel stack (included here so that the kernel * stack itself need not be dumped). */ -struct md_coredump { +struct md_coredump32 { struct trapframe32 md_tf; - struct fpstate md_fpstate; + struct fpstate32 md_fpstate; +}; + +struct md_coredump { + struct trapframe64 md_tf; + struct fpstate64 md_fpstate; +}; + +/* + * A core file consists of a header followed by a number of segments. + * Each segment is preceeded by a `coreseg' structure giving the + * segment's type, the virtual address where the bits resided in + * process address space and the size of the segment. + * + * The core header specifies the lengths of the core header itself and + * each of the following core segment headers to allow for any machine + * dependent alignment requirements. + */ + +struct core32 { + u_int32_t c_midmag; /* magic, id, flags */ + u_int16_t c_hdrsize; /* Size of this header (machdep algn) */ + u_int16_t c_seghdrsize; /* Size of a segment header */ + u_int32_t c_nseg; /* # of core segments */ + char c_name[MAXCOMLEN+1]; /* Copy of p->p_comm */ + u_int32_t c_signo; /* Killing signal */ + u_int c_ucode; /* Hmm ? */ + u_int c_cpusize; /* Size of machine dependent segment */ + u_int c_tsize; /* Size of traditional text segment */ + u_int c_dsize; /* Size of traditional data segment */ + u_int c_ssize; /* Size of traditional stack segment */ +}; + +struct coreseg32 { + u_int32_t c_midmag; /* magic, id, flags */ + u_int c_addr; /* Virtual address of segment */ + u_int c_size; /* Size of this segment */ }; #ifdef _KERNEL diff --git a/sys/arch/sparc64/include/proc.h b/sys/arch/sparc64/include/proc.h index 22d6ae51aa2a..714fb55f871c 100644 --- a/sys/arch/sparc64/include/proc.h +++ b/sys/arch/sparc64/include/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */ +/* $NetBSD: proc.h,v 1.2 1999/11/06 20:13:50 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -48,8 +48,8 @@ * Machine-dependent part of the proc structure for SPARC. */ struct mdproc { - struct trapframe *md_tf; /* trap/syscall registers */ - struct fpstate *md_fpstate; /* fpu state, if any; always resident */ + struct trapframe64 *md_tf; /* trap/syscall registers */ + struct fpstate64 *md_fpstate; /* fpu state, if any; always resident */ u_long md_flags; }; diff --git a/sys/arch/sparc64/include/reg.h b/sys/arch/sparc64/include/reg.h index c26aef92e003..a342314e3da4 100644 --- a/sys/arch/sparc64/include/reg.h +++ b/sys/arch/sparc64/include/reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: reg.h,v 1.3 1999/10/11 01:57:45 eeh Exp $ */ +/* $NetBSD: reg.h,v 1.4 1999/11/06 20:13:50 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -144,19 +144,30 @@ struct reg64 { * need to malloc these. */ #define FP_QSIZE 16 -#define ALIGNFPSTATE(f) ((struct fpstate *)(((long)(f))&(~BLOCK_ALIGN))) +#define ALIGNFPSTATE(f) ((struct fpstate64 *)(((long)(f))&(~BLOCK_ALIGN))) struct fp_qentry { int *fq_addr; /* the instruction's address */ int fq_instr; /* the instruction itself */ }; -struct fpstate { + +struct fpstate64 { u_int fs_regs[64]; /* our view is 64 32-bit registers */ int64_t fs_fsr; /* %fsr */ int fs_qsize; /* actual queue depth */ 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 */ +}; + /* * Clone fpstate into an fpreg structure to satisfy */ @@ -177,7 +188,7 @@ struct fpreg32 { struct fp_qentry fr_queue[FP_QSIZE]; /* queue contents */ }; -#if defined(_KERNEL) || defined(__arch64__) +#if defined(__arch64__) /* Here we gotta do naughty things to let gdb work on 32-bit binaries */ #define reg reg64 #define fpreg fpreg64 @@ -187,7 +198,7 @@ struct fpreg32 { #define reg reg32 #define fpreg fpreg32 #define trapframe trapframe32 -#define rwindow rwindow64 +#define rwindow rwindow32 #endif #endif /* _MACHINE_REG_H_ */