diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-12 07:46:18 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-12 07:46:18 +0000 |
commit | 170dae2c938af5d9cb2a5aea51bce8b4c98d3eac (patch) | |
tree | 832d628d860886ad3062453502fad23e0ba5bd75 /sys/arch | |
parent | e759627b6dfb57df52989e702cb98fc24ac41cb8 (diff) |
Get rid of that ugly m88100_saved_state structure, use trapframe everywhere
instead.
Allow struct reg and struct trapframe to live different lives and grow
separately. Righty now they are still the same, and code expects a trapframe
to always start with a struct reg. This may change...
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/ddb/db_interface.c | 97 | ||||
-rw-r--r-- | sys/arch/mvme88k/ddb/db_trace.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/cpu.h | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/db_machdep.h | 13 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/frame.h | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/locore.h | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/pcb.h | 75 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/proc.h | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/reg.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/trap.h | 11 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/genassym.cf | 100 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 255 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/trap.c | 304 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/vm_machdep.c | 4 |
14 files changed, 472 insertions, 424 deletions
diff --git a/sys/arch/mvme88k/ddb/db_interface.c b/sys/arch/mvme88k/ddb/db_interface.c index 8e39795a6a0..5d61f5ee6c0 100644 --- a/sys/arch/mvme88k/ddb/db_interface.c +++ b/sys/arch/mvme88k/ddb/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.37 2004/01/09 11:03:36 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.38 2004/01/12 07:46:14 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -59,7 +59,7 @@ extern int frame_is_sane(db_regs_t *); extern void cnpollc(int); void kdbprinttrap(int, int); -void m88k_db_trap(int, struct m88100_saved_state *); +void m88k_db_trap(int, struct trapframe *); int ddb_nmi_trap(int, db_regs_t *); void ddb_error_trap(char *, db_regs_t *); void db_putc(int); @@ -178,7 +178,7 @@ m88k_db_print_frame(addr, have_addr, count, modif) db_expr_t count; char *modif; { - struct m88100_saved_state *s = (struct m88100_saved_state *)addr; + struct trapframe *s = (struct trapframe *)addr; char *name; db_expr_t offset; int suppress1 = 0, suppress2 = 0; @@ -227,7 +227,7 @@ m88k_db_print_frame(addr, have_addr, count, modif) } } -#define R(i) s->r[i] +#define R(i) s->tf_r[i] #define IPMASK(x) ((x) & ~(3)) db_printf("R00-05: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", R(0), R(1), R(2), R(3), R(4), R(5)); @@ -242,17 +242,17 @@ m88k_db_print_frame(addr, have_addr, count, modif) db_printf("R30-31: 0x%08x 0x%08x\n", R(30), R(31)); db_printf("%cxip: 0x%08x ", - cputyp == CPU_88110 ? 'e' : 's', s->sxip & ~3); - db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->sxip), + cputyp == CPU_88110 ? 'e' : 's', s->tf_sxip & ~3); + db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->tf_sxip), &name, &offset); if (name != NULL && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); db_printf("\n"); - if (s->snip != s->sxip + 4) { + if (s->tf_snip != s->tf_sxip + 4) { db_printf("%cnip: 0x%08x ", - cputyp == CPU_88110 ? 'e' : 's', s->snip); - db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->snip), + cputyp == CPU_88110 ? 'e' : 's', s->tf_snip); + db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->tf_snip), &name, &offset); if (name != NULL && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); @@ -260,9 +260,9 @@ m88k_db_print_frame(addr, have_addr, count, modif) } if (cputyp != CPU_88110) { - if (s->sfip != s->snip + 4) { - db_printf("sfip: 0x%08x ", s->sfip); - db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->sfip), + if (s->tf_sfip != s->tf_snip + 4) { + db_printf("sfip: 0x%08x ", s->tf_sfip); + db_find_xtrn_sym_and_offset((db_addr_t)IPMASK(s->tf_sfip), &name, &offset); if (name != NULL && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); @@ -270,17 +270,17 @@ m88k_db_print_frame(addr, have_addr, count, modif) } } else { db_printf("fpsr: 0x%08x fpcr: 0x%08x fpecr: 0x%08x\n", - s->fpsr, s->fpcr, s->fpecr); + s->tf_fpsr, s->tf_fpcr, s->tf_fpecr); db_printf("dsap 0x%08x duap 0x%08x dsr 0x%08x dlar 0x%08x dpar 0x%08x\n", - s->dsap, s->duap, s->dsr, s->dlar, s->dpar); + s->tf_dsap, s->tf_duap, s->tf_dsr, s->tf_dlar, s->tf_dpar); db_printf("isap 0x%08x iuap 0x%08x isr 0x%08x ilar 0x%08x ipar 0x%08x\n", - s->isap, s->iuap, s->isr, s->ilar, s->ipar); + s->tf_isap, s->tf_iuap, s->tf_isr, s->tf_ilar, s->tf_ipar); } db_printf("epsr: 0x%08x current process: %p\n", - s->epsr, curproc); + s->tf_epsr, curproc); db_printf("vector: 0x%02x interrupt mask: 0x%08x\n", - s->vector, s->mask); + s->tf_vector, s->tf_mask); /* * If the vector indicates trap, instead of an exception or @@ -289,64 +289,64 @@ m88k_db_print_frame(addr, have_addr, count, modif) * Interrupt and exceptions are vectored at 0-10 and 114-127. */ - if (!(s->vector <= 10 || (114 <= s->vector && s->vector <= 127))) { + if (!(s->tf_vector <= 10 || (114 <= s->tf_vector && s->tf_vector <= 127))) { db_printf("\n"); return; } #ifdef M88100 if (cputyp != CPU_88110) { - if (s->vector == /*data*/3 || s->dmt0 & DMT_VALID) { + if (s->tf_vector == /*data*/3 || s->tf_dmt0 & DMT_VALID) { db_printf("dmt,d,a0: 0x%08x 0x%08x 0x%08x ", - s->dmt0, s->dmd0, s->dma0); - db_find_xtrn_sym_and_offset((db_addr_t)s->dma0, &name, &offset); + s->tf_dmt0, s->tf_dmd0, s->tf_dma0); + db_find_xtrn_sym_and_offset((db_addr_t)s->tf_dma0, &name, &offset); if (name != NULL && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); db_printf("\n "); - suppress1 = m88k_dmx_print(s->dmt0, s->dmd0, s->dma0, 0); + suppress1 = m88k_dmx_print(s->tf_dmt0, s->tf_dmd0, s->tf_dma0, 0); db_printf("\n"); - if ((s->dmt1 & DMT_VALID) && (!suppress1)) { + if ((s->tf_dmt1 & DMT_VALID) && (!suppress1)) { db_printf("dmt,d,a1: 0x%08x 0x%08x 0x%08x ", - s->dmt1, s->dmd1, s->dma1); - db_find_xtrn_sym_and_offset((db_addr_t)s->dma1, + s->tf_dmt1, s->tf_dmd1, s->tf_dma1); + db_find_xtrn_sym_and_offset((db_addr_t)s->tf_dma1, &name, &offset); if (name != NULL && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); db_printf("\n "); - suppress2 = m88k_dmx_print(s->dmt1, s->dmd1, s->dma1, 1); + suppress2 = m88k_dmx_print(s->tf_dmt1, s->tf_dmd1, s->tf_dma1, 1); db_printf("\n"); - if ((s->dmt2 & DMT_VALID) && (!suppress2)) { + if ((s->tf_dmt2 & DMT_VALID) && (!suppress2)) { db_printf("dmt,d,a2: 0x%08x 0x%08x 0x%08x ", - s->dmt2, s->dmd2, s->dma2); - db_find_xtrn_sym_and_offset((db_addr_t)s->dma2, + s->tf_dmt2, s->tf_dmd2, s->tf_dma2); + db_find_xtrn_sym_and_offset((db_addr_t)s->tf_dma2, &name, &offset); if (name != 0 && (unsigned)offset <= db_maxoff) db_printf("%s+0x%08x", name, (unsigned)offset); db_printf("\n "); - m88k_dmx_print(s->dmt2, s->dmd2, s->dma2, 2); + m88k_dmx_print(s->tf_dmt2, s->tf_dmd2, s->tf_dma2, 2); db_printf("\n"); } } db_printf("fault code %d dpfsr %x\n", - (s->dpfsr >> 16) & 0x07, s->dpfsr); + (s->tf_dpfsr >> 16) & 0x07, s->tf_dpfsr); } } #endif /* M88100 */ - if (s->fpecr & 255) { /* floating point error occurred */ + if (s->tf_fpecr & 255) { /* floating point error occurred */ db_printf("fpecr: 0x%08x fpsr: 0x%08x fpcr: 0x%08x\n", - s->fpecr, s->fpsr, s->fpcr); + s->tf_fpecr, s->tf_fpsr, s->tf_fpcr); #ifdef M88100 if (cputyp != CPU_88110) { db_printf("fcr1-4: 0x%08x 0x%08x 0x%08x 0x%08x\n", - s->fphs1, s->fpls1, s->fphs2, s->fpls2); + s->tf_fphs1, s->tf_fpls1, s->tf_fphs2, s->tf_fpls2); db_printf("fcr5-8: 0x%08x 0x%08x 0x%08x 0x%08x\n", - s->fppt, s->fprh, s->fprl, s->fpit); + s->tf_fppt, s->tf_fprh, s->tf_fprl, s->tf_fpit); } #endif } @@ -380,7 +380,7 @@ m88k_db_pause(ticks) void m88k_db_trap(type, regs) int type; - struct m88100_saved_state *regs; + struct trapframe *regs; { #if 0 int i; @@ -408,7 +408,7 @@ m88k_db_trap(type, regs) } } - ddb_regs = *regs; + ddb_regs = *((struct reg *)regs); db_active++; cnpollc(TRUE); @@ -416,7 +416,7 @@ m88k_db_trap(type, regs) cnpollc(FALSE); db_active--; - *regs = ddb_regs; + *((struct reg *)regs) = ddb_regs; #if 0 (void) spl7(); @@ -456,7 +456,7 @@ ddb_nmi_trap(level, eframe) { if (db_noisy) db_printf("kernel: nmi interrupt\n"); - m88k_db_trap(T_KDB_ENTRY, eframe); + m88k_db_trap(T_KDB_ENTRY, (struct trapframe *)eframe); return 0; } @@ -474,7 +474,7 @@ ddb_break_trap(type, eframe) int type; db_regs_t *eframe; { - m88k_db_trap(type, eframe); + m88k_db_trap(type, (struct trapframe *)eframe); if (type == T_KDB_BREAK) { /* @@ -497,7 +497,7 @@ ddb_entry_trap(level, eframe) int level; db_regs_t *eframe; { - m88k_db_trap(T_KDB_ENTRY, eframe); + m88k_db_trap(T_KDB_ENTRY, (struct trapframe *)eframe); return 0; } @@ -508,16 +508,16 @@ ddb_entry_trap(level, eframe) */ /* error trap - unreturnable */ void -ddb_error_trap(error, eframe) +ddb_error_trap(error, regs) char *error; - db_regs_t *eframe; + db_regs_t *regs; { db_printf("KERNEL: terminal error [%s]\n", error); db_printf("KERNEL: Exiting debugger will cause abort to rom\n"); - db_printf("at 0x%x ", eframe->sxip & ~3); - db_printf("dmt0 0x%x dma0 0x%x", eframe->dmt0, eframe->dma0); + db_printf("at 0x%x ", regs->sxip & ~3); + db_printf("dmt0 0x%x dma0 0x%x", regs->dmt0, regs->dma0); m88k_db_pause(1000000); - m88k_db_trap(T_KDB_BREAK, eframe); + m88k_db_trap(T_KDB_BREAK, (struct trapframe *)regs); } /* @@ -584,14 +584,11 @@ m88k_db_where(addr, have_addr, count, modif) db_expr_t count; char *modif; { - struct m88100_saved_state *s; char *name; db_expr_t offset; db_addr_t l; - s = DDB_REGS; - - l = PC_REGS(s); /* clear low bits */ + l = PC_REGS(DDB_REGS); /* clear low bits */ db_find_xtrn_sym_and_offset(l, &name, &offset); if (name && (unsigned)offset <= db_maxoff) diff --git a/sys/arch/mvme88k/ddb/db_trace.c b/sys/arch/mvme88k/ddb/db_trace.c index e62dbc6172b..02c186536e3 100644 --- a/sys/arch/mvme88k/ddb/db_trace.c +++ b/sys/arch/mvme88k/ddb/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.23 2004/01/07 17:52:30 miod Exp $ */ +/* $OpenBSD: db_trace.c,v 1.24 2004/01/12 07:46:14 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -1007,7 +1007,7 @@ db_stack_trace_print(db_expr_t addr, enum { Default, Stack, Frame } style = Default; - db_regs_t frame; /* a m88100_saved_state */ + db_regs_t frame; db_regs_t *regs; union { db_regs_t *frame; diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h index 8ead0a53482..a85294dc3f3 100644 --- a/sys/arch/mvme88k/include/cpu.h +++ b/sys/arch/mvme88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.23 2003/11/09 00:32:00 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.24 2004/01/12 07:46:16 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -77,9 +77,9 @@ struct clockframe { struct trapframe tf; }; -#define CLKF_USERMODE(framep) ((((struct trapframe *)(framep))->epsr & PSR_MODE) == 0) -#define CLKF_PC(framep) (((struct trapframe *)(framep))->sxip & XIP_ADDR) -#define CLKF_INTR(framep) (((struct trapframe *)(framep))->r[31] >= UADDR) +#define CLKF_USERMODE(framep) ((((struct trapframe *)(framep))->tf_epsr & PSR_MODE) == 0) +#define CLKF_PC(framep) (((struct trapframe *)(framep))->tf_sxip & XIP_ADDR) +#define CLKF_INTR(framep) (((struct trapframe *)(framep))->tf_r[31] >= UADDR) /* * Get interrupt glue. @@ -183,7 +183,7 @@ struct md_p { void (*statclock_init_func)(void); /* statistics clock init function */ void (*delayclock_init_func)(void); /* delay clock init function */ void (*delay_func)(void); /* delay clock function */ - void (*interrupt_func)(u_int, struct m88100_saved_state *); /* interrupt func */ + void (*interrupt_func)(u_int, struct trapframe *); /* interrupt func */ u_char *volatile intr_mask; u_char *volatile intr_ipl; u_char *volatile intr_src; diff --git a/sys/arch/mvme88k/include/db_machdep.h b/sys/arch/mvme88k/include/db_machdep.h index b8a56442e40..0626b3d0aac 100644 --- a/sys/arch/mvme88k/include/db_machdep.h +++ b/sys/arch/mvme88k/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.26 2004/01/07 16:22:18 miod Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.27 2004/01/12 07:46:16 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -40,7 +40,7 @@ #ifndef _LOCORE -#include <machine/pcb.h> /* m88100_saved_state */ +#include <machine/pcb.h> #include <machine/trap.h> #include <uvm/uvm_param.h> @@ -49,9 +49,10 @@ * The low two bits of sxip, snip, sfip have valid bits * in them that need to masked to get the correct addresses */ -#define PC_REGS(regs) cputyp == CPU_88110 ? (regs->exip & ~3) :\ - ((regs->sxip & 2) ? regs->sxip & ~3 : \ - (regs->snip & 2 ? regs->snip & ~3 : regs->sfip & ~3)) +#define PC_REGS(regs) \ + cputyp == CPU_88110 ? ((regs)->exip & ~3) : \ + (((regs)->sxip & 2) ? (regs)->sxip & ~3 : \ + ((regs)->snip & 2 ? (regs)->snip & ~3 : (regs)->sfip & ~3)) /* inst_return(ins) - is the instruction a function call return. * Not mutually exclusive with inst_branch. Should be a jmp r1. */ @@ -85,7 +86,7 @@ typedef vaddr_t db_addr_t; typedef long db_expr_t; -typedef struct m88100_saved_state db_regs_t; +typedef struct reg db_regs_t; extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) diff --git a/sys/arch/mvme88k/include/frame.h b/sys/arch/mvme88k/include/frame.h index 0d23bcc53bf..997d61e8004 100644 --- a/sys/arch/mvme88k/include/frame.h +++ b/sys/arch/mvme88k/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.6 2003/11/16 20:30:06 avsm Exp $ */ +/* $OpenBSD: frame.h,v 1.7 2004/01/12 07:46:16 miod Exp $ */ /* $NetBSD: frame.h,v 1.15 1997/05/03 12:49:05 mycroft Exp $ */ /* @@ -43,7 +43,7 @@ #define _M88K_FRAME_H_ struct frame { - struct m88100_saved_state __packed F_t; + struct trapframe __packed F_t; }; #endif /* _M88K_FRAME_H_ */ diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index f45fc68659d..2c8c0cb8046 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.19 2003/10/05 20:27:46 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.20 2004/01/12 07:46:16 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -60,11 +60,11 @@ void dosoftint(void); void MY_info(struct trapframe *f, caddr_t p, int flags, char *s); void MY_info_done(struct trapframe *f, int flags); void mvme_bootstrap(void); -void m187_ext_int(u_int v, struct m88100_saved_state *eframe); +void m187_ext_int(u_int v, struct trapframe *eframe); void m188_reset(void); -void m188_ext_int(u_int v, struct m88100_saved_state *eframe); +void m188_ext_int(u_int v, struct trapframe *eframe); unsigned int safe_level(unsigned mask, unsigned curlevel); -void m197_ext_int(u_int v, struct m88100_saved_state *eframe); +void m197_ext_int(u_int v, struct trapframe *eframe); /* eh.S */ diff --git a/sys/arch/mvme88k/include/pcb.h b/sys/arch/mvme88k/include/pcb.h index e94954c93b4..424c90db755 100644 --- a/sys/arch/mvme88k/include/pcb.h +++ b/sys/arch/mvme88k/include/pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcb.h,v 1.11 2003/11/08 16:43:00 miod Exp $ */ +/* $OpenBSD: pcb.h,v 1.12 2004/01/12 07:46:16 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Mach Operating System @@ -42,18 +42,11 @@ * in the saved_state area - this is passed as the exception frame. * On a context switch, only registers that need to be saved by the * C calling convention and few other regs (pc, psr etc) are saved - * in the kernel_state part of the PCB. Typically, trap fames are - * save on the stack (by low level handlers or by hardware) but, + * in the kernel_state part of the PCB. Typically, trap frames are + * saved on the stack (by low level handlers or by hardware) but, * we just decided to do it in the PCB. */ -/* - * This must always be an even number of words long so that our stack - * will always be properly aligned (88k need 8 byte alignment). Also, - * place r14 on double word boundary so that we can use st.d while - * saving the regs. - */ - struct m88100_pcb { unsigned pcb_pc; /* address to return */ unsigned pcb_ipl; @@ -80,21 +73,71 @@ struct m88100_pcb { unsigned pcb_fcr63; }; -#define m88100_saved_state reg -#define trapframe m88100_saved_state +struct trapframe { + union { + struct reg r; + } F_r; +}; + +#define tf_r F_r.r.r +#define tf_sp F_r.r.r[31] +#define tf_epsr F_r.r.epsr +#define tf_fpsr F_r.r.fpsr +#define tf_fpcr F_r.r.fpcr +#define tf_sxip F_r.r.sxip +#define tf_snip F_r.r.snip +#define tf_sfip F_r.r.sfip +#define tf_exip F_r.r.sxip +#define tf_enip F_r.r.snip +#define tf_ssbr F_r.r.ssbr +#define tf_dmt0 F_r.r.dmt0 +#define tf_dmd0 F_r.r.dmd0 +#define tf_dma0 F_r.r.dma0 +#define tf_dmt1 F_r.r.dmt1 +#define tf_dmd1 F_r.r.dmd1 +#define tf_dma1 F_r.r.dma1 +#define tf_dmt2 F_r.r.dmt2 +#define tf_dmd2 F_r.r.dmd2 +#define tf_dma2 F_r.r.dma2 +#define tf_duap F_r.r.ssbr +#define tf_dsr F_r.r.dmt0 +#define tf_dlar F_r.r.dmd0 +#define tf_dpar F_r.r.dma0 +#define tf_isr F_r.r.dmt1 +#define tf_ilar F_r.r.dmd1 +#define tf_ipar F_r.r.dma1 +#define tf_isap F_r.r.dmt2 +#define tf_dsap F_r.r.dmd2 +#define tf_iuap F_r.r.dma2 +#define tf_fpecr F_r.r.fpecr +#define tf_fphs1 F_r.r.fphs1 +#define tf_fpls1 F_r.r.fpls1 +#define tf_fphs2 F_r.r.fphs2 +#define tf_fpls2 F_r.r.fpls2 +#define tf_fppt F_r.r.fppt +#define tf_fprh F_r.r.fprh +#define tf_fprl F_r.r.fprl +#define tf_fpit F_r.r.fpit +#define tf_scratch1 F_r.r.scratch1 +#define tf_vector F_r.r.vector +#define tf_mask F_r.r.mask +#define tf_mode F_r.r.mode +#define tf_ipfsr F_r.r.ipfsr +#define tf_dpfsr F_r.r.dpfsr +#define tf_cpu F_r.r.cpu struct pcb { - struct m88100_pcb kernel_state; - struct m88100_saved_state user_state; - int pcb_onfault; + struct m88100_pcb kernel_state; + struct trapframe user_state; + int pcb_onfault; }; /* * Location of saved user registers for the proc. */ #define USER_REGS(p) \ - (((struct m88100_saved_state *) (&((p)->p_addr->u_pcb.user_state)))) + (((struct reg *)(&((p)->p_addr->u_pcb.user_state)))) /* * The pcb is augmented with machine-dependent additional data for * core dumps. Note that the trapframe here is a copy of the one diff --git a/sys/arch/mvme88k/include/proc.h b/sys/arch/mvme88k/include/proc.h index a6b75090343..d67741204dc 100644 --- a/sys/arch/mvme88k/include/proc.h +++ b/sys/arch/mvme88k/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.10 2003/12/25 00:26:25 miod Exp $ */ +/* $OpenBSD: proc.h,v 1.11 2004/01/12 07:46:16 miod Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -43,20 +43,22 @@ #ifndef __MACHINE_PROC_H__ #define __MACHINE_PROC_H__ + #include <machine/pcb.h> -#include <machine/mmu.h> /* - * Machine-dependent part of the proc structure for VME1X7. + * Machine-dependent part of the proc structure for mvme88k. */ struct mdproc { struct trapframe *md_tf; /* trap/syscall registers */ struct fpstate *md_fpstate; /* fpu state, if any; always resident */ int md_upte[UPAGES]; /* ptes for mapping u page */ + unsigned md_ss_addr; /* single step address for ptrace */ unsigned md_ss_instr; /* single step instruction for ptrace */ unsigned md_ss_taken_addr; /* single step address for ptrace */ unsigned md_ss_taken_instr; /* single step instruction for ptrace */ }; + #endif /* __MACHINE_PROC_H__ */ diff --git a/sys/arch/mvme88k/include/reg.h b/sys/arch/mvme88k/include/reg.h index a74923844ff..42e341cff9c 100644 --- a/sys/arch/mvme88k/include/reg.h +++ b/sys/arch/mvme88k/include/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.11 2001/12/20 06:20:26 smurph Exp $ */ +/* $OpenBSD: reg.h,v 1.12 2004/01/12 07:46:17 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -36,7 +36,6 @@ /* This must always be an even number of words long */ struct reg { unsigned r[32]; /* 0 - 31 */ -#define tf_sp r[31] unsigned epsr; /* 32 */ unsigned fpsr; unsigned fpcr; diff --git a/sys/arch/mvme88k/include/trap.h b/sys/arch/mvme88k/include/trap.h index b1b89b556e4..bcf0c91dc28 100644 --- a/sys/arch/mvme88k/include/trap.h +++ b/sys/arch/mvme88k/include/trap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.h,v 1.21 2004/01/11 23:52:45 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.22 2004/01/12 07:46:17 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -67,13 +67,12 @@ #ifndef _LOCORE -void m88100_trap(unsigned, struct m88100_saved_state *); -void m88100_syscall(register_t, struct m88100_saved_state *); +void m88100_trap(unsigned, struct trapframe *); +void m88100_syscall(register_t, struct trapframe *); -void m88110_trap(unsigned, struct m88100_saved_state *); -void m88110_syscall(register_t, struct m88100_saved_state *); +void m88110_trap(unsigned, struct trapframe *); +void m88110_syscall(register_t, struct trapframe *); #endif /* _LOCORE */ #endif /* __MACHINE_TRAP_H__ */ - diff --git a/sys/arch/mvme88k/mvme88k/genassym.cf b/sys/arch/mvme88k/mvme88k/genassym.cf index f3b2b25a609..efb3f5e8a50 100644 --- a/sys/arch/mvme88k/mvme88k/genassym.cf +++ b/sys/arch/mvme88k/mvme88k/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.9 2003/11/08 16:43:02 miod Exp $ +# $OpenBSD: genassym.cf,v 1.10 2004/01/12 07:46:17 miod Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -28,7 +28,7 @@ # SUCH DAMAGE. # # @(#)genassym.c 7.8 (Berkeley) 5/7/91 -# $Id: genassym.cf,v 1.9 2003/11/08 16:43:02 miod Exp $ +# $Id: genassym.cf,v 1.10 2004/01/12 07:46:17 miod Exp $ # include <sys/param.h> @@ -67,56 +67,56 @@ member PCB_USER_STATE user_state export SYS_exit export SYS_sigreturn -# m88100_saved_state element indexes -define EF_R0 offsetof(struct m88100_saved_state, r[0]) / sizeof(int) -define EF_FPSR offsetof(struct m88100_saved_state, fpsr) / sizeof(int) -define EF_FPCR offsetof(struct m88100_saved_state, fpcr) / sizeof(int) -define EF_EPSR offsetof(struct m88100_saved_state, epsr) / sizeof(int) -define EF_SXIP offsetof(struct m88100_saved_state, sxip) / sizeof(int) -define EF_SFIP offsetof(struct m88100_saved_state, sfip) / sizeof(int) -define EF_SNIP offsetof(struct m88100_saved_state, snip) / sizeof(int) -define EF_SSBR offsetof(struct m88100_saved_state, ssbr) / sizeof(int) -define EF_DMT0 offsetof(struct m88100_saved_state, dmt0) / sizeof(int) -define EF_DMD0 offsetof(struct m88100_saved_state, dmd0) / sizeof(int) -define EF_DMA0 offsetof(struct m88100_saved_state, dma0) / sizeof(int) -define EF_DMT1 offsetof(struct m88100_saved_state, dmt1) / sizeof(int) -define EF_DMD1 offsetof(struct m88100_saved_state, dmd1) / sizeof(int) -define EF_DMA1 offsetof(struct m88100_saved_state, dma1) / sizeof(int) -define EF_DMT2 offsetof(struct m88100_saved_state, dmt2) / sizeof(int) -define EF_DMD2 offsetof(struct m88100_saved_state, dmd2) / sizeof(int) -define EF_DMA2 offsetof(struct m88100_saved_state, dma2) / sizeof(int) -define EF_FPECR offsetof(struct m88100_saved_state, fpecr) / sizeof(int) -define EF_FPHS1 offsetof(struct m88100_saved_state, fphs1) / sizeof(int) -define EF_FPLS1 offsetof(struct m88100_saved_state, fpls1) / sizeof(int) -define EF_FPHS2 offsetof(struct m88100_saved_state, fphs2) / sizeof(int) -define EF_FPLS2 offsetof(struct m88100_saved_state, fpls2) / sizeof(int) -define EF_FPPT offsetof(struct m88100_saved_state, fppt) / sizeof(int) -define EF_FPRH offsetof(struct m88100_saved_state, fprh) / sizeof(int) -define EF_FPRL offsetof(struct m88100_saved_state, fprl) / sizeof(int) -define EF_FPIT offsetof(struct m88100_saved_state, fpit) / sizeof(int) -define EF_VECTOR offsetof(struct m88100_saved_state, vector) / sizeof(int) -define EF_MASK offsetof(struct m88100_saved_state, mask) / sizeof(int) -define EF_MODE offsetof(struct m88100_saved_state, mode) / sizeof(int) -define EF_RET offsetof(struct m88100_saved_state, scratch1) / sizeof(int) -define EF_IPFSR offsetof(struct m88100_saved_state, ipfsr) / sizeof(int) -define EF_DPFSR offsetof(struct m88100_saved_state, dpfsr) / sizeof(int) -define EF_CPU offsetof(struct m88100_saved_state, cpu) / sizeof(int) +# trapframe element indexes +define EF_R0 offsetof(struct trapframe, tf_r[0]) / sizeof(int) +define EF_FPSR offsetof(struct trapframe, tf_fpsr) / sizeof(int) +define EF_FPCR offsetof(struct trapframe, tf_fpcr) / sizeof(int) +define EF_EPSR offsetof(struct trapframe, tf_epsr) / sizeof(int) +define EF_SXIP offsetof(struct trapframe, tf_sxip) / sizeof(int) +define EF_SFIP offsetof(struct trapframe, tf_sfip) / sizeof(int) +define EF_SNIP offsetof(struct trapframe, tf_snip) / sizeof(int) +define EF_SSBR offsetof(struct trapframe, tf_ssbr) / sizeof(int) +define EF_DMT0 offsetof(struct trapframe, tf_dmt0) / sizeof(int) +define EF_DMD0 offsetof(struct trapframe, tf_dmd0) / sizeof(int) +define EF_DMA0 offsetof(struct trapframe, tf_dma0) / sizeof(int) +define EF_DMT1 offsetof(struct trapframe, tf_dmt1) / sizeof(int) +define EF_DMD1 offsetof(struct trapframe, tf_dmd1) / sizeof(int) +define EF_DMA1 offsetof(struct trapframe, tf_dma1) / sizeof(int) +define EF_DMT2 offsetof(struct trapframe, tf_dmt2) / sizeof(int) +define EF_DMD2 offsetof(struct trapframe, tf_dmd2) / sizeof(int) +define EF_DMA2 offsetof(struct trapframe, tf_dma2) / sizeof(int) +define EF_FPECR offsetof(struct trapframe, tf_fpecr) / sizeof(int) +define EF_FPHS1 offsetof(struct trapframe, tf_fphs1) / sizeof(int) +define EF_FPLS1 offsetof(struct trapframe, tf_fpls1) / sizeof(int) +define EF_FPHS2 offsetof(struct trapframe, tf_fphs2) / sizeof(int) +define EF_FPLS2 offsetof(struct trapframe, tf_fpls2) / sizeof(int) +define EF_FPPT offsetof(struct trapframe, tf_fppt) / sizeof(int) +define EF_FPRH offsetof(struct trapframe, tf_fprh) / sizeof(int) +define EF_FPRL offsetof(struct trapframe, tf_fprl) / sizeof(int) +define EF_FPIT offsetof(struct trapframe, tf_fpit) / sizeof(int) +define EF_VECTOR offsetof(struct trapframe, tf_vector) / sizeof(int) +define EF_MASK offsetof(struct trapframe, tf_mask) / sizeof(int) +define EF_MODE offsetof(struct trapframe, tf_mode) / sizeof(int) +define EF_RET offsetof(struct trapframe, tf_scratch1) / sizeof(int) +define EF_IPFSR offsetof(struct trapframe, tf_ipfsr) / sizeof(int) +define EF_DPFSR offsetof(struct trapframe, tf_dpfsr) / sizeof(int) +define EF_CPU offsetof(struct trapframe, tf_cpu) / sizeof(int) -# m88110 m88100_saved_state element indexes -define EF_EXIP offsetof(struct m88100_saved_state, exip) / sizeof(int) -define EF_ENIP offsetof(struct m88100_saved_state, enip) / sizeof(int) -define EF_DSR offsetof(struct m88100_saved_state, dsr) / sizeof(int) -define EF_DLAR offsetof(struct m88100_saved_state, dlar) / sizeof(int) -define EF_DPAR offsetof(struct m88100_saved_state, dpar) / sizeof(int) -define EF_ISR offsetof(struct m88100_saved_state, isr) / sizeof(int) -define EF_ILAR offsetof(struct m88100_saved_state, ilar) / sizeof(int) -define EF_IPAR offsetof(struct m88100_saved_state, ipar) / sizeof(int) -define EF_ISAP offsetof(struct m88100_saved_state, isap) / sizeof(int) -define EF_DSAP offsetof(struct m88100_saved_state, dsap) / sizeof(int) -define EF_IUAP offsetof(struct m88100_saved_state, iuap) / sizeof(int) -define EF_DUAP offsetof(struct m88100_saved_state, duap) / sizeof(int) +# m88110 trapframe element indexes +define EF_EXIP offsetof(struct trapframe, tf_exip) / sizeof(int) +define EF_ENIP offsetof(struct trapframe, tf_enip) / sizeof(int) +define EF_DSR offsetof(struct trapframe, tf_dsr) / sizeof(int) +define EF_DLAR offsetof(struct trapframe, tf_dlar) / sizeof(int) +define EF_DPAR offsetof(struct trapframe, tf_dpar) / sizeof(int) +define EF_ISR offsetof(struct trapframe, tf_isr) / sizeof(int) +define EF_ILAR offsetof(struct trapframe, tf_ilar) / sizeof(int) +define EF_IPAR offsetof(struct trapframe, tf_ipar) / sizeof(int) +define EF_ISAP offsetof(struct trapframe, tf_isap) / sizeof(int) +define EF_DSAP offsetof(struct trapframe, tf_dsap) / sizeof(int) +define EF_IUAP offsetof(struct trapframe, tf_iuap) / sizeof(int) +define EF_DUAP offsetof(struct trapframe, tf_duap) / sizeof(int) -define SIZEOF_EF sizeof(struct m88100_saved_state) +define SIZEOF_EF sizeof(struct trapframe) # more (machine-dependent) pcb fields struct m88100_pcb diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 1689024f4b6..4a0def5e274 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.127 2004/01/05 20:07:03 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.128 2004/01/12 07:46:17 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -130,9 +130,9 @@ void identifycpu(void); void save_u_area(struct proc *, vaddr_t); void load_u_area(struct proc *); void dumpconf(void); -void m187_ext_int(u_int v, struct m88100_saved_state *eframe); -void m188_ext_int(u_int v, struct m88100_saved_state *eframe); -void m197_ext_int(u_int v, struct m88100_saved_state *eframe); +void m187_ext_int(u_int v, struct trapframe *eframe); +void m188_ext_int(u_int v, struct trapframe *eframe); +void m197_ext_int(u_int v, struct trapframe *eframe); unsigned char *volatile ivec[] = { (unsigned char *)0xFFFE0003, /* not used, no such thing as int 0 */ @@ -760,7 +760,7 @@ setregs(p, pack, stack, retval) u_long stack; int retval[2]; { - struct trapframe *tf = USER_REGS(p); + struct trapframe *tf = (struct trapframe *)USER_REGS(p); /* * The syscall will ``return'' to snip; set it. @@ -796,17 +796,17 @@ setregs(p, pack, stack, retval) * user mode, serialize mem, interrupts enabled, * graphics unit, fp enabled */ - tf->epsr = PSR_SRM | PSR_SFD; + tf->tf_epsr = PSR_SRM | PSR_SFD; /* * XXX disable OoO for now... */ - tf->epsr |= PSR_SER; + tf->tf_epsr |= PSR_SER; } else { /* * user mode, interrupts enabled, * no graphics unit, fp enabled */ - tf->epsr = PSR_SFD | PSR_SFD2; + tf->tf_epsr = PSR_SFD | PSR_SFD2; } /* @@ -817,16 +817,16 @@ setregs(p, pack, stack, retval) * fetched. mc88110 - just set exip to pack->ep_entry. */ if (cputyp == CPU_88110) { - tf->exip = pack->ep_entry & ~3; + tf->tf_exip = pack->ep_entry & ~3; #ifdef DEBUG - printf("exec @ 0x%x\n", tf->exip); + printf("exec @ 0x%x\n", tf->tf_exip); #endif } else { - tf->snip = pack->ep_entry & ~3; - tf->sfip = (pack->ep_entry & ~3) | FIP_V; + tf->tf_snip = pack->ep_entry & ~3; + tf->tf_sfip = (pack->ep_entry & ~3) | FIP_V; } - tf->r[2] = stack; - tf->r[31] = stack; + tf->tf_r[2] = stack; + tf->tf_r[31] = stack; retval[1] = 0; } @@ -892,7 +892,7 @@ sendsig(catcher, sig, mask, code, type, val) psp->ps_sigstk.ss_size - fsize); psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else - fp = (struct sigframe *)(tf->r[31] - fsize); + fp = (struct sigframe *)(tf->tf_r[31] - fsize); if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) (void)uvm_grow(p, (unsigned)fp); @@ -920,7 +920,7 @@ sendsig(catcher, sig, mask, code, type, val) * Copy the whole user context into signal context that we * are building. */ - bcopy((caddr_t)tf->r, (caddr_t)sf.sf_sc.sc_regs, + bcopy((caddr_t)tf->tf_r, (caddr_t)sf.sf_sc.sc_regs, sizeof(sf.sf_sc.sc_regs)); /* @@ -930,53 +930,53 @@ sendsig(catcher, sig, mask, code, type, val) */ if (cputyp != CPU_88110) { /* mc88100 */ - sf.sf_sc.sc_xip = tf->sxip; - sf.sf_sc.sc_nip = tf->snip; - sf.sf_sc.sc_fip = tf->sfip; + sf.sf_sc.sc_xip = tf->tf_sxip; + sf.sf_sc.sc_nip = tf->tf_snip; + sf.sf_sc.sc_fip = tf->tf_sfip; } else { /* mc88110 */ - sf.sf_sc.sc_xip = tf->exip; - sf.sf_sc.sc_nip = tf->enip; + sf.sf_sc.sc_xip = tf->tf_exip; + sf.sf_sc.sc_nip = tf->tf_enip; sf.sf_sc.sc_fip = 0; } - sf.sf_sc.sc_ps = tf->epsr; - sf.sf_sc.sc_sp = tf->r[31]; - sf.sf_sc.sc_fpsr = tf->fpsr; - sf.sf_sc.sc_fpcr = tf->fpcr; + sf.sf_sc.sc_ps = tf->tf_epsr; + sf.sf_sc.sc_sp = tf->tf_r[31]; + sf.sf_sc.sc_fpsr = tf->tf_fpsr; + sf.sf_sc.sc_fpcr = tf->tf_fpcr; if (cputyp != CPU_88110) { /* mc88100 */ - sf.sf_sc.sc_ssbr = tf->ssbr; - sf.sf_sc.sc_dmt0 = tf->dmt0; - sf.sf_sc.sc_dmd0 = tf->dmd0; - sf.sf_sc.sc_dma0 = tf->dma0; - sf.sf_sc.sc_dmt1 = tf->dmt1; - sf.sf_sc.sc_dmd1 = tf->dmd1; - sf.sf_sc.sc_dma1 = tf->dma1; - sf.sf_sc.sc_dmt2 = tf->dmt2; - sf.sf_sc.sc_dmd2 = tf->dmd2; - sf.sf_sc.sc_dma2 = tf->dma2; + sf.sf_sc.sc_ssbr = tf->tf_ssbr; + sf.sf_sc.sc_dmt0 = tf->tf_dmt0; + sf.sf_sc.sc_dmd0 = tf->tf_dmd0; + sf.sf_sc.sc_dma0 = tf->tf_dma0; + sf.sf_sc.sc_dmt1 = tf->tf_dmt1; + sf.sf_sc.sc_dmd1 = tf->tf_dmd1; + sf.sf_sc.sc_dma1 = tf->tf_dma1; + sf.sf_sc.sc_dmt2 = tf->tf_dmt2; + sf.sf_sc.sc_dmd2 = tf->tf_dmd2; + sf.sf_sc.sc_dma2 = tf->tf_dma2; } else { /* mc88110 */ - sf.sf_sc.sc_dsr = tf->dsr; - sf.sf_sc.sc_dlar = tf->dlar; - sf.sf_sc.sc_dpar = tf->dpar; - sf.sf_sc.sc_isr = tf->isr; - sf.sf_sc.sc_ilar = tf->ilar; - sf.sf_sc.sc_ipar = tf->ipar; - sf.sf_sc.sc_isap = tf->isap; - sf.sf_sc.sc_dsap = tf->dsap; - sf.sf_sc.sc_iuap = tf->iuap; - sf.sf_sc.sc_duap = tf->duap; + sf.sf_sc.sc_dsr = tf->tf_dsr; + sf.sf_sc.sc_dlar = tf->tf_dlar; + sf.sf_sc.sc_dpar = tf->tf_dpar; + sf.sf_sc.sc_isr = tf->tf_isr; + sf.sf_sc.sc_ilar = tf->tf_ilar; + sf.sf_sc.sc_ipar = tf->tf_ipar; + sf.sf_sc.sc_isap = tf->tf_isap; + sf.sf_sc.sc_dsap = tf->tf_dsap; + sf.sf_sc.sc_iuap = tf->tf_iuap; + sf.sf_sc.sc_duap = tf->tf_duap; } - sf.sf_sc.sc_fpecr = tf->fpecr; - sf.sf_sc.sc_fphs1 = tf->fphs1; - sf.sf_sc.sc_fpls1 = tf->fpls1; - sf.sf_sc.sc_fphs2 = tf->fphs2; - sf.sf_sc.sc_fpls2 = tf->fpls2; - sf.sf_sc.sc_fppt = tf->fppt; - sf.sf_sc.sc_fprh = tf->fprh; - sf.sf_sc.sc_fprl = tf->fprl; - sf.sf_sc.sc_fpit = tf->fpit; + sf.sf_sc.sc_fpecr = tf->tf_fpecr; + sf.sf_sc.sc_fphs1 = tf->tf_fphs1; + sf.sf_sc.sc_fpls1 = tf->tf_fpls1; + sf.sf_sc.sc_fphs2 = tf->tf_fphs2; + sf.sf_sc.sc_fpls2 = tf->tf_fpls2; + sf.sf_sc.sc_fppt = tf->tf_fppt; + sf.sf_sc.sc_fprh = tf->tf_fprh; + sf.sf_sc.sc_fprl = tf->tf_fprl; + sf.sf_sc.sc_fpit = tf->tf_fpit; if (copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf)) { /* @@ -998,14 +998,14 @@ sendsig(catcher, sig, mask, code, type, val) addr = p->p_sigcode; if (cputyp != CPU_88110) { /* mc88100 */ - tf->snip = (addr & ~3) | NIP_V; - tf->sfip = (tf->snip + 4) | FIP_V; + tf->tf_snip = (addr & ~3) | NIP_V; + tf->tf_sfip = (tf->tf_snip + 4) | FIP_V; } else { /* mc88110 */ - tf->exip = (addr & ~3); - tf->enip = (tf->exip + 4); + tf->tf_exip = (addr & ~3); + tf->tf_enip = (tf->tf_exip + 4); } - tf->r[31] = (unsigned)fp; + tf->tf_r[31] = (unsigned)fp; #ifdef DEBUG if ((sigdebug & SDB_FOLLOW) || ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)) @@ -1055,56 +1055,56 @@ sys_sigreturn(p, v, retval) * bcopy(sc_reg to tf, sizeof sigcontext - 2 words) * XXX nivas */ - bcopy((caddr_t)scp->sc_regs, (caddr_t)tf->r, sizeof(scp->sc_regs)); + bcopy((caddr_t)scp->sc_regs, (caddr_t)tf->tf_r, sizeof(scp->sc_regs)); if (cputyp != CPU_88110) { /* mc88100 */ - tf->sxip = scp->sc_xip; - tf->snip = scp->sc_nip; - tf->sfip = scp->sc_fip; + tf->tf_sxip = scp->sc_xip; + tf->tf_snip = scp->sc_nip; + tf->tf_sfip = scp->sc_fip; } else { /* mc88110 */ - tf->exip = scp->sc_xip; - tf->enip = scp->sc_nip; - tf->sfip = 0; + tf->tf_exip = scp->sc_xip; + tf->tf_enip = scp->sc_nip; + tf->tf_sfip = 0; } - tf->epsr = scp->sc_ps; - tf->r[31] = scp->sc_sp; - tf->fpsr = scp->sc_fpsr; - tf->fpcr = scp->sc_fpcr; + tf->tf_epsr = scp->sc_ps; + tf->tf_r[31] = scp->sc_sp; + tf->tf_fpsr = scp->sc_fpsr; + tf->tf_fpcr = scp->sc_fpcr; if (cputyp != CPU_88110) { /* mc88100 */ - tf->ssbr = scp->sc_ssbr; - tf->dmt0 = scp->sc_dmt0; - tf->dmd0 = scp->sc_dmd0; - tf->dma0 = scp->sc_dma0; - tf->dmt1 = scp->sc_dmt1; - tf->dmd1 = scp->sc_dmd1; - tf->dma1 = scp->sc_dma1; - tf->dmt2 = scp->sc_dmt2; - tf->dmd2 = scp->sc_dmd2; - tf->dma2 = scp->sc_dma2; + tf->tf_ssbr = scp->sc_ssbr; + tf->tf_dmt0 = scp->sc_dmt0; + tf->tf_dmd0 = scp->sc_dmd0; + tf->tf_dma0 = scp->sc_dma0; + tf->tf_dmt1 = scp->sc_dmt1; + tf->tf_dmd1 = scp->sc_dmd1; + tf->tf_dma1 = scp->sc_dma1; + tf->tf_dmt2 = scp->sc_dmt2; + tf->tf_dmd2 = scp->sc_dmd2; + tf->tf_dma2 = scp->sc_dma2; } else { /* mc88110 */ - tf->dsr = scp->sc_dsr; - tf->dlar = scp->sc_dlar; - tf->dpar = scp->sc_dpar; - tf->isr = scp->sc_isr; - tf->ilar = scp->sc_ilar; - tf->ipar = scp->sc_ipar; - tf->isap = scp->sc_isap; - tf->dsap = scp->sc_dsap; - tf->iuap = scp->sc_iuap; - tf->duap = scp->sc_duap; + tf->tf_dsr = scp->sc_dsr; + tf->tf_dlar = scp->sc_dlar; + tf->tf_dpar = scp->sc_dpar; + tf->tf_isr = scp->sc_isr; + tf->tf_ilar = scp->sc_ilar; + tf->tf_ipar = scp->sc_ipar; + tf->tf_isap = scp->sc_isap; + tf->tf_dsap = scp->sc_dsap; + tf->tf_iuap = scp->sc_iuap; + tf->tf_duap = scp->sc_duap; } - tf->fpecr = scp->sc_fpecr; - tf->fphs1 = scp->sc_fphs1; - tf->fpls1 = scp->sc_fpls1; - tf->fphs2 = scp->sc_fphs2; - tf->fpls2 = scp->sc_fpls2; - tf->fppt = scp->sc_fppt; - tf->fprh = scp->sc_fprh; - tf->fprl = scp->sc_fprl; - tf->fpit = scp->sc_fpit; + tf->tf_fpecr = scp->sc_fpecr; + tf->tf_fphs1 = scp->sc_fphs1; + tf->tf_fpls1 = scp->sc_fpls1; + tf->tf_fphs2 = scp->sc_fphs2; + tf->tf_fpls2 = scp->sc_fpls2; + tf->tf_fppt = scp->sc_fppt; + tf->tf_fprh = scp->sc_fprh; + tf->tf_fprl = scp->sc_fprl; + tf->tf_fpit = scp->sc_fpit; /* * Restore the user supplied information @@ -1566,7 +1566,7 @@ unsigned obio_vec[32] = { #define VME_BERR_MASK 0x100 /* timeout during VME IACK cycle */ void -m188_ext_int(u_int v, struct m88100_saved_state *eframe) +m188_ext_int(u_int v, struct trapframe *eframe) { int cpu = cpu_number(); unsigned int cur_mask; @@ -1577,7 +1577,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) cur_mask = ISR_GET_CURRENT_MASK(cpu); old_spl = m188_curspl[cpu]; - eframe->mask = old_spl; + eframe->tf_mask = old_spl; if (cur_mask == 0) { /* @@ -1716,14 +1716,14 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) */ disable_interrupt(); out: - if (eframe->dmt0 & DMT_VALID) + if (eframe->tf_dmt0 & DMT_VALID) m88100_trap(T_DATAFLT, eframe); /* * Restore the mask level to what it was when the interrupt * was taken. */ - setipl(eframe->mask); + setipl(eframe->tf_mask); } #endif /* MVME188 */ @@ -1739,7 +1739,7 @@ out: #ifdef MVME187 void -m187_ext_int(u_int v, struct m88100_saved_state *eframe) +m187_ext_int(u_int v, struct trapframe *eframe) { int mask, level; struct intrhand *intr; @@ -1831,7 +1831,7 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) * returning to assembler */ disable_interrupt(); - if (eframe->dmt0 & DMT_VALID) + if (eframe->tf_dmt0 & DMT_VALID) m88100_trap(T_DATAFLT, eframe); /* @@ -1844,7 +1844,7 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) #ifdef MVME197 void -m197_ext_int(u_int v, struct m88100_saved_state *eframe) +m197_ext_int(u_int v, struct trapframe *eframe) { int mask, level, src; struct intrhand *intr; @@ -2207,7 +2207,7 @@ void nmihand(void *framep) { #if 0 - struct m88100_saved_state *frame = framep; + struct trapframe *frame = framep; #endif #if DDB @@ -2221,7 +2221,7 @@ nmihand(void *framep) void regdump(struct trapframe *f) { -#define R(i) f->r[i] +#define R(i) f->tf_r[i] printf("R00-05: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", R(0),R(1),R(2),R(3),R(4),R(5)); printf("R06-11: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", @@ -2234,40 +2234,47 @@ regdump(struct trapframe *f) R(24),R(25),R(26),R(27),R(28),R(29)); printf("R30-31: 0x%08x 0x%08x\n",R(30),R(31)); if (cputyp == CPU_88110) { - printf("exip %x enip %x\n", f->exip, f->enip); + printf("exip %x enip %x\n", f->tf_exip, f->tf_enip); } else { - printf("sxip %x snip %x sfip %x\n", f->sxip, f->snip, f->sfip); + printf("sxip %x snip %x sfip %x\n", + f->tf_sxip, f->tf_snip, f->tf_sfip); } #ifdef M88100 - if (f->vector == 0x3 && cputyp != CPU_88110) { + if (f->tf_vector == 0x3 && cputyp != CPU_88110) { /* print dmt stuff for data access fault */ - printf("dmt0 %x dmd0 %x dma0 %x\n", f->dmt0, f->dmd0, f->dma0); - printf("dmt1 %x dmd1 %x dma1 %x\n", f->dmt1, f->dmd1, f->dma1); - printf("dmt2 %x dmd2 %x dma2 %x\n", f->dmt2, f->dmd2, f->dma2); - printf("fault type %d\n", (f->dpfsr >> 16) & 0x7); + printf("dmt0 %x dmd0 %x dma0 %x\n", + f->tf_dmt0, f->tf_dmd0, f->tf_dma0); + printf("dmt1 %x dmd1 %x dma1 %x\n", + f->tf_dmt1, f->tf_dmd1, f->tf_dma1); + printf("dmt2 %x dmd2 %x dma2 %x\n", + f->tf_dmt2, f->tf_dmd2, f->tf_dma2); + printf("fault type %d\n", (f->tf_dpfsr >> 16) & 0x7); dae_print((unsigned *)f); } if (longformat && cputyp != CPU_88110) { printf("fpsr %x fpcr %x epsr %x ssbr %x\n", - f->fpsr, f->fpcr, f->epsr, f->ssbr); + f->tf_fpsr, f->tf_fpcr, f->tf_epsr, f->tf_ssbr); printf("fpecr %x fphs1 %x fpls1 %x fphs2 %x fpls2 %x\n", - f->fpecr, f->fphs1, f->fpls1, f->fphs2, f->fpls2); + f->tf_fpecr, f->tf_fphs1, f->tf_fpls1, + f->tf_fphs2, f->tf_fpls2); printf("fppt %x fprh %x fprl %x fpit %x\n", - f->fppt, f->fprh, f->fprl, f->fpit); + f->tf_fppt, f->tf_fprh, f->tf_fprl, f->tf_fpit); printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", - f->vector, f->mask, f->mode, f->scratch1, f->cpu); + f->tf_vector, f->tf_mask, f->tf_mode, + f->tf_scratch1, f->tf_cpu); } #endif #ifdef M88110 if (longformat && cputyp == CPU_88110) { printf("fpsr %x fpcr %x fpecr %x epsr %x\n", - f->fpsr, f->fpcr, f->fpecr, f->epsr); + f->tf_fpsr, f->tf_fpcr, f->tf_fpecr, f->tf_epsr); printf("dsap %x duap %x dsr %x dlar %x dpar %x\n", - f->dsap, f->duap, f->dsr, f->dlar, f->dpar); + f->tf_dsap, f->tf_duap, f->tf_dsr, f->tf_dlar, f->tf_dpar); printf("isap %x iuap %x isr %x ilar %x ipar %x\n", - f->isap, f->iuap, f->isr, f->ilar, f->ipar); + f->tf_isap, f->tf_iuap, f->tf_isr, f->tf_ilar, f->tf_ipar); printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", - f->vector, f->mask, f->mode, f->scratch1, f->cpu); + f->tf_vector, f->tf_mask, f->tf_mode, + f->tf_scratch1, f->tf_cpu); } #endif #ifdef MVME188 @@ -2276,7 +2283,7 @@ regdump(struct trapframe *f) istr = *(int *volatile)IST_REG; cur_mask = GET_MASK(0, istr); - printf("emask = 0x%b\n", f->mask, IST_STRING); + printf("emask = 0x%b\n", f->tf_mask, IST_STRING); printf("istr = 0x%b\n", istr, IST_STRING); printf("cmask = 0x%b\n", cur_mask, IST_STRING); } diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index fa22f748d19..9faf3e37f4e 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.66 2004/01/11 23:52:47 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.67 2004/01/12 07:46:17 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -90,8 +90,8 @@ /* sigh */ extern int procfs_domem(struct proc *, struct proc *, void *, struct uio *); -__dead void panictrap(int, struct m88100_saved_state *); -__dead void error_fatal(struct m88100_saved_state *); +__dead void panictrap(int, struct trapframe *); +__dead void error_fatal(struct trapframe *); extern void regdump(struct trapframe *f); @@ -123,7 +123,7 @@ const char *pbus_exception_type[] = { }; static inline void -userret(struct proc *p, struct m88100_saved_state *frame, u_quad_t oticks) +userret(struct proc *p, struct trapframe *frame, u_quad_t oticks) { int sig; @@ -147,14 +147,14 @@ userret(struct proc *p, struct m88100_saved_state *frame, u_quad_t oticks) if (p->p_flag & P_PROFIL) { extern int psratio; - addupc_task(p, frame->sxip & XIP_ADDR, + addupc_task(p, frame->tf_sxip & XIP_ADDR, (int)(p->p_sticks - oticks) * psratio); } curpriority = p->p_priority; } __dead void -panictrap(int type, struct m88100_saved_state *frame) +panictrap(int type, struct trapframe *frame) { #ifdef DDB static int panicing = 0; @@ -167,23 +167,23 @@ panictrap(int type, struct m88100_saved_state *frame) /* instruction exception */ db_printf("\nInstr access fault (%s) v = %x, " "frame %p\n", - pbus_exception_type[(frame->ipfsr >> 16) & 0x7], - frame->sxip & XIP_ADDR, frame); + pbus_exception_type[(frame->tf_ipfsr >> 16) & 0x7], + frame->tf_sxip & XIP_ADDR, frame); } else if (type == 3) { /* data access exception */ db_printf("\nData access fault (%s) v = %x, " "frame %p\n", - pbus_exception_type[(frame->dpfsr >> 16) & 0x7], - frame->sxip & XIP_ADDR, frame); + pbus_exception_type[(frame->tf_dpfsr >> 16) & 0x7], + frame->tf_sxip & XIP_ADDR, frame); } else db_printf("\nTrap type %d, v = %x, frame %p\n", - type, frame->sxip & XIP_ADDR, frame); + type, frame->tf_sxip & XIP_ADDR, frame); break; #endif #ifdef M88110 case CPU_88110: db_printf("\nTrap type %d, v = %x, frame %p\n", - type, frame->exip, frame); + type, frame->tf_exip, frame); break; #endif } @@ -199,7 +199,7 @@ panictrap(int type, struct m88100_saved_state *frame) #ifdef M88100 void -m88100_trap(unsigned type, struct m88100_saved_state *frame) +m88100_trap(unsigned type, struct trapframe *frame) { struct proc *p; u_quad_t sticks = 0; @@ -226,18 +226,18 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) if ((p = curproc) == NULL) p = &proc0; - if (USERMODE(frame->epsr)) { + if (USERMODE(frame->tf_epsr)) { sticks = p->p_sticks; type += T_USER; p->p_md.md_tf = frame; /* for ptrace/signals */ } fault_type = 0; fault_code = 0; - fault_addr = frame->sxip & XIP_ADDR; + fault_addr = frame->tf_sxip & XIP_ADDR; switch (type) { default: - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ @@ -259,7 +259,7 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) #endif /* DDB */ case T_ILLFLT: DEBUG_MSG(("Unimplemented opcode!\n")); - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; case T_INT: case T_INT+T_USER: @@ -271,8 +271,8 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) case T_MISALGNFLT: DEBUG_MSG(("kernel misaligned " - "access exception @ 0x%08x\n", frame->sxip)); - panictrap(frame->vector, frame); + "access exception @ 0x%08x\n", frame->tf_sxip)); + panictrap(frame->tf_vector, frame); break; case T_INSTFLT: @@ -280,21 +280,21 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) * Should never, never happen for a non-paged kernel. */ DEBUG_MSG(("kernel mode instruction " - "page fault @ 0x%08x\n", frame->sxip)); - panictrap(frame->vector, frame); + "page fault @ 0x%08x\n", frame->tf_sxip)); + panictrap(frame->tf_vector, frame); break; case T_DATAFLT: /* kernel mode data fault */ /* data fault on the user address? */ - if ((frame->dmt0 & DMT_DAS) == 0) { + if ((frame->tf_dmt0 & DMT_DAS) == 0) { type = T_DATAFLT + T_USER; goto user_fault; } - fault_addr = frame->dma0; - if (frame->dmt0 & (DMT_WRITE|DMT_LOCKBAR)) { + fault_addr = frame->tf_dma0; + if (frame->tf_dmt0 & (DMT_WRITE|DMT_LOCKBAR)) { ftype = VM_PROT_READ|VM_PROT_WRITE; fault_code = VM_PROT_WRITE; } else { @@ -310,11 +310,11 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) vm = p->p_vmspace; map = kernel_map; - pbus_type = (frame->dpfsr >> 16) & 0x07; + pbus_type = (frame->tf_dpfsr >> 16) & 0x07; #ifdef DEBUG printf("Kernel Data access fault #%d (%s) v = 0x%x, frame 0x%x cpu %d\n", pbus_type, pbus_exception_type[pbus_type], - fault_addr, frame, frame->cpu); + fault_addr, frame, frame->tf_cpu); #endif switch (pbus_type) { @@ -322,15 +322,15 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) /* * If it is a guarded access, bus error is OK. */ - if ((frame->sxip & XIP_ADDR) >= + if ((frame->tf_sxip & XIP_ADDR) >= (unsigned)&guarded_access_start && - (frame->sxip & XIP_ADDR) <= + (frame->tf_sxip & XIP_ADDR) <= (unsigned)&guarded_access_end) { - frame->snip = + frame->tf_snip = ((unsigned)&guarded_access_bad ) | NIP_V; - frame->sfip = + frame->tf_sfip = ((unsigned)&guarded_access_bad + 4) | FIP_V; - frame->sxip = 0; + frame->tf_sxip = 0; /* We sort of resolved the fault ourselves * because we know where it came from * [guarded_access()]. But we must still think @@ -338,10 +338,10 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) * dmt1 & dmt2. Mark dmt0 so that * data_access_emulation skips it. XXX smurph */ - frame->dmt0 |= DMT_SKIP; + frame->tf_dmt0 |= DMT_SKIP; data_access_emulation((unsigned *)frame); - frame->dpfsr = 0; - frame->dmt0 = 0; + frame->tf_dpfsr = 0; + frame->tf_dmt0 = 0; return; } break; @@ -352,8 +352,8 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) * so that trap won't get called again. */ data_access_emulation((unsigned *)frame); - frame->dpfsr = 0; - frame->dmt0 = 0; + frame->tf_dpfsr = 0; + frame->tf_dmt0 = 0; return; case CMMU_PFSR_SFAULT: case CMMU_PFSR_PFAULT: @@ -366,8 +366,8 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) * won't get called again. */ data_access_emulation((unsigned *)frame); - frame->dpfsr = 0; - frame->dmt0 = 0; + frame->tf_dpfsr = 0; + frame->tf_dmt0 = 0; return; } break; @@ -376,7 +376,7 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) printf ("PBUS Fault %d (%s) va = 0x%x\n", pbus_type, pbus_exception_type[pbus_type], va); #endif - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); /* NOTREACHED */ case T_INSTFLT+T_USER: /* User mode instruction access fault */ @@ -384,18 +384,18 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) case T_DATAFLT+T_USER: user_fault: if (type == T_INSTFLT + T_USER) { - pbus_type = (frame->ipfsr >> 16) & 0x07; + pbus_type = (frame->tf_ipfsr >> 16) & 0x07; } else { - fault_addr = frame->dma0; - pbus_type = (frame->dpfsr >> 16) & 0x07; + fault_addr = frame->tf_dma0; + pbus_type = (frame->tf_dpfsr >> 16) & 0x07; } #ifdef DEBUG printf("User Data access fault #%d (%s) v = 0x%x, frame 0x%x cpu %d\n", pbus_type, pbus_exception_type[pbus_type], - fault_addr, frame, frame->cpu); + fault_addr, frame, frame->tf_cpu); #endif - if (frame->dmt0 & (DMT_WRITE | DMT_LOCKBAR)) { + if (frame->tf_dmt0 & (DMT_WRITE | DMT_LOCKBAR)) { ftype = VM_PROT_READ | VM_PROT_WRITE; fault_code = VM_PROT_WRITE; } else { @@ -436,14 +436,14 @@ user_fault: * while accessing user space. */ if (result != 0 && p->p_addr->u_pcb.pcb_onfault != NULL) { - frame->snip = p->p_addr->u_pcb.pcb_onfault | NIP_V; - frame->sfip = (p->p_addr->u_pcb.pcb_onfault + 4) | FIP_V; - frame->sxip = 0; + frame->tf_snip = p->p_addr->u_pcb.pcb_onfault | NIP_V; + frame->tf_sfip = (p->p_addr->u_pcb.pcb_onfault + 4) | FIP_V; + frame->tf_sxip = 0; /* * Continue as if the fault had been resolved, but * do not try to complete the faulting access. */ - frame->dmt0 |= DMT_SKIP; + frame->tf_dmt0 |= DMT_SKIP; result = 0; } @@ -456,16 +456,16 @@ user_fault: * get called again. */ data_access_emulation((unsigned *)frame); - frame->dpfsr = 0; - frame->dmt0 = 0; + frame->tf_dpfsr = 0; + frame->tf_dmt0 = 0; } else { /* * back up SXIP, SNIP, * clearing the Error bit */ - frame->sfip = frame->snip & ~FIP_E; - frame->snip = frame->sxip & ~NIP_E; - frame->ipfsr = 0; + frame->tf_sfip = frame->tf_snip & ~FIP_E; + frame->tf_snip = frame->tf_sxip & ~NIP_E; + frame->tf_ipfsr = 0; } } else { sig = result == EACCES ? SIGBUS : SIGSEGV; @@ -528,7 +528,7 @@ user_fault: unsigned instr; struct uio uio; struct iovec iov; - unsigned pc = PC_REGS(frame); + unsigned pc = PC_REGS((struct reg *)frame); /* read break instruction */ copyin((caddr_t)pc, &instr, sizeof(unsigned)); @@ -577,9 +577,9 @@ user_fault: procfs_domem(p, p, NULL, &uio); } #if 1 - frame->sfip = frame->snip; /* set up next FIP */ - frame->snip = pc; /* set up next NIP */ - frame->snip |= 2; /* set valid bit */ + frame->tf_sfip = frame->tf_snip; /* set up next FIP */ + frame->tf_snip = pc; /* set up next NIP */ + frame->tf_snip |= 2; /* set valid bit */ #endif p->p_md.md_ss_addr = 0; p->p_md.md_ss_instr = 0; @@ -596,8 +596,8 @@ user_fault: * breakpoint debugging. When we get this trap, we just * return a signal which gets caught by the debugger. */ - frame->sfip = frame->snip; /* set up the next FIP */ - frame->snip = frame->sxip; /* set up the next NIP */ + frame->tf_sfip = frame->tf_snip; /* set up the next FIP */ + frame->tf_snip = frame->tf_sxip; /* set up the next NIP */ sig = SIGTRAP; fault_type = TRAP_BRKPT; break; @@ -625,8 +625,8 @@ user_fault: * don't want multiple faults - we are going to * deliver signal. */ - frame->dmt0 = 0; - frame->ipfsr = frame->dpfsr = 0; + frame->tf_dmt0 = 0; + frame->tf_ipfsr = frame->tf_dpfsr = 0; } userret(p, frame, sticks); @@ -635,7 +635,7 @@ user_fault: #ifdef M88110 void -m88110_trap(unsigned type, struct m88100_saved_state *frame) +m88110_trap(unsigned type, struct trapframe *frame) { struct proc *p; u_quad_t sticks = 0; @@ -664,37 +664,37 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) if ((p = curproc) == NULL) p = &proc0; - if (USERMODE(frame->epsr)) { + if (USERMODE(frame->tf_epsr)) { sticks = p->p_sticks; type += T_USER; p->p_md.md_tf = frame; /* for ptrace/signals */ } fault_type = 0; fault_code = 0; - fault_addr = frame->exip & XIP_ADDR; + fault_addr = frame->tf_exip & XIP_ADDR; switch (type) { default: - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ case T_197_READ+T_USER: case T_197_READ: DEBUG_MSG(("DMMU read miss: Hardware Table Searches should be enabled!\n")); - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ case T_197_WRITE+T_USER: case T_197_WRITE: DEBUG_MSG(("DMMU write miss: Hardware Table Searches should be enabled!\n")); - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ case T_197_INST+T_USER: case T_197_INST: DEBUG_MSG(("IMMU miss: Hardware Table Searches should be enabled!\n")); - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ #ifdef DDB @@ -717,10 +717,10 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) db_enable_interrupt(); ddb_entry_trap(T_KDB_ENTRY, (db_regs_t*)frame); db_disable_interrupt(); - if (frame->enip) { - frame->exip = frame->enip; + if (frame->tf_enip) { + frame->tf_exip = frame->tf_enip; } else { - frame->exip += 4; + frame->tf_exip += 4; } splx(s); return; @@ -737,7 +737,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) #endif /* DDB */ case T_ILLFLT: DEBUG_MSG(("Unimplemented opcode!\n")); - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); break; case T_NON_MASK: case T_NON_MASK+T_USER: @@ -751,8 +751,8 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) return; case T_MISALGNFLT: DEBUG_MSG(("kernel mode misaligned " - "access exception @ 0x%08x\n", frame->exip)); - panictrap(frame->vector, frame); + "access exception @ 0x%08x\n", frame->tf_exip)); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ @@ -761,8 +761,8 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) * Should never, never happen for a non-paged kernel. */ DEBUG_MSG(("kernel mode instruction " - "page fault @ 0x%08x\n", frame->exip)); - panictrap(frame->vector, frame); + "page fault @ 0x%08x\n", frame->tf_exip)); + panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ @@ -770,13 +770,13 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) /* kernel mode data fault */ /* data fault on the user address? */ - if ((frame->dsr & CMMU_DSR_SU) == 0) { + if ((frame->tf_dsr & CMMU_DSR_SU) == 0) { type = T_DATAFLT + T_USER; goto m88110_user_fault; } - fault_addr = frame->dlar; - if (frame->dsr & CMMU_DSR_RW) { + fault_addr = frame->tf_dlar; + if (frame->tf_dsr & CMMU_DSR_RW) { ftype = VM_PROT_READ; fault_code = VM_PROT_READ; } else { @@ -792,20 +792,20 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) vm = p->p_vmspace; map = kernel_map; - if (frame->dsr & CMMU_DSR_BE) { + if (frame->tf_dsr & CMMU_DSR_BE) { /* * If it is a guarded access, bus error is OK. */ - if ((frame->exip & XIP_ADDR) >= + if ((frame->tf_exip & XIP_ADDR) >= (unsigned)&guarded_access_start && - (frame->exip & XIP_ADDR) <= + (frame->tf_exip & XIP_ADDR) <= (unsigned)&guarded_access_end) { - frame->exip = (unsigned)&guarded_access_bad; + frame->tf_exip = (unsigned)&guarded_access_bad; return; } } - if (frame->dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) { - frame->dsr &= ~CMMU_DSR_WE; /* undefined */ + if (frame->tf_dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) { + frame->tf_dsr &= ~CMMU_DSR_WE; /* undefined */ /* * On a segment or a page fault, call uvm_fault() to * resolve the fault. @@ -814,7 +814,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) if (result == 0) return; } - if (frame->dsr & CMMU_DSR_WE) { /* write fault */ + if (frame->tf_dsr & CMMU_DSR_WE) { /* write fault */ /* * This could be a write protection fault or an * exception to set the used and modified bits @@ -845,7 +845,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) #endif } } - panictrap(frame->vector, frame); + panictrap(frame->tf_vector, frame); /* NOTREACHED */ case T_INSTFLT+T_USER: /* User mode instruction access fault */ @@ -856,8 +856,8 @@ m88110_user_fault: ftype = VM_PROT_READ; fault_code = VM_PROT_READ; } else { - fault_addr = frame->dlar; - if (frame->dsr & CMMU_DSR_RW) { + fault_addr = frame->tf_dlar; + if (frame->tf_dsr & CMMU_DSR_RW) { ftype = VM_PROT_READ; fault_code = VM_PROT_READ; } else { @@ -877,11 +877,11 @@ m88110_user_fault: */ if (type == T_DATAFLT+T_USER) { /* data faults */ - if (frame->dsr & CMMU_DSR_BE) { + if (frame->tf_dsr & CMMU_DSR_BE) { /* bus error */ result = EACCES; } else - if (frame->dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) { + if (frame->tf_dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) { /* segment or page fault */ result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == EACCES) @@ -891,11 +891,11 @@ m88110_user_fault: printf("Data Access Error @ 0x%x\n", va); #endif } else - if (frame->dsr & (CMMU_DSR_CP | CMMU_DSR_WA)) { + if (frame->tf_dsr & (CMMU_DSR_CP | CMMU_DSR_WA)) { /* copyback or write allocate error */ result = 0; } else - if (frame->dsr & CMMU_DSR_WE) { + if (frame->tf_dsr & CMMU_DSR_WE) { /* write fault */ /* This could be a write protection fault or an * exception to set the used and modified bits @@ -935,7 +935,7 @@ m88110_user_fault: } else { #ifdef DEBUG printf("unexpected data fault dsr %x\n", - frame->dsr); + frame->tf_dsr); #endif result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == EACCES) @@ -943,12 +943,12 @@ m88110_user_fault: } } else { /* instruction faults */ - if (frame->isr & + if (frame->tf_isr & (CMMU_ISR_BE | CMMU_ISR_SP | CMMU_ISR_TBE)) { /* bus error, supervisor protection */ result = EACCES; } else - if (frame->isr & (CMMU_ISR_SI | CMMU_ISR_PI)) { + if (frame->tf_isr & (CMMU_ISR_SI | CMMU_ISR_PI)) { /* segment or page fault */ result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == EACCES) @@ -956,7 +956,7 @@ m88110_user_fault: } else { #ifdef DEBUG printf("unexpected instr fault dsr %x\n", - frame->isr); + frame->tf_isr); #endif result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == EACCES) @@ -977,8 +977,8 @@ m88110_user_fault: * while accessing user space. */ if (result != 0 && p->p_addr->u_pcb.pcb_onfault != NULL) { - frame->exip = p->p_addr->u_pcb.pcb_onfault; - frame->dsr = frame->isr = 0; + frame->tf_exip = p->p_addr->u_pcb.pcb_onfault; + frame->tf_dsr = frame->tf_isr = 0; /* * Continue as if the fault had been resolved. */ @@ -1045,7 +1045,7 @@ m88110_user_fault: unsigned instr; struct uio uio; struct iovec iov; - unsigned pc = PC_REGS(frame); + unsigned pc = PC_REGS((struct reg *)frame); /* read break instruction */ copyin((caddr_t)pc, &instr, sizeof(unsigned)); @@ -1115,7 +1115,7 @@ m88110_user_fault: * don't want multiple faults - we are going to * deliver signal. */ - frame->dsr = frame->isr = 0; + frame->tf_dsr = frame->tf_isr = 0; } userret(p, frame, sticks); @@ -1123,10 +1123,10 @@ m88110_user_fault: #endif /* MVME197 */ __dead void -error_fatal(struct m88100_saved_state *frame) +error_fatal(struct trapframe *frame) { #ifdef DDB - switch (frame->vector) { + switch (frame->tf_vector) { case 0: db_printf("\n[RESET EXCEPTION (Really Bad News[tm]) frame %8p]\n", frame); db_printf("This is usually caused by a branch to a NULL function pointer.\n"); @@ -1141,12 +1141,12 @@ error_fatal(struct m88100_saved_state *frame) } regdump((struct trapframe*)frame); #endif /* DDB */ - panic("unrecoverable exception %d", frame->vector); + panic("unrecoverable exception %d", frame->tf_vector); } #ifdef M88100 void -m88100_syscall(register_t code, struct m88100_saved_state *tf) +m88100_syscall(register_t code, struct trapframe *tf) { int i, nsys, nap; struct sysent *callp; @@ -1166,7 +1166,7 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf) nsys = p->p_emul->e_nsysent; #ifdef DIAGNOSTIC - if (USERMODE(tf->epsr) == 0) + if (USERMODE(tf->tf_epsr) == 0) panic("syscall"); if (curpcb != &p->p_addr->u_pcb) panic("syscall curpcb/ppcb"); @@ -1183,7 +1183,7 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf) * __syscall takes a quad syscall number, so that other * arguments are at their natural alignments. */ - ap = &tf->r[2]; + ap = &tf->tf_r[2]; nap = 11; /* r2-r12 */ switch (code) { @@ -1272,34 +1272,34 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf) * tippity-top of the u. area.) */ p = curproc; - tf = USER_REGS(p); - tf->r[2] = rval[0]; - tf->r[3] = rval[1]; - tf->epsr &= ~PSR_C; - tf->snip = tf->sfip & ~NIP_E; - tf->sfip = tf->snip + 4; + tf = (struct trapframe *)USER_REGS(p); + tf->tf_r[2] = rval[0]; + tf->tf_r[3] = rval[1]; + tf->tf_epsr &= ~PSR_C; + tf->tf_snip = tf->tf_sfip & ~NIP_E; + tf->tf_sfip = tf->tf_snip + 4; break; case ERESTART: /* * If (error == ERESTART), back up the pipe line. This * will end up reexecuting the trap. */ - tf->epsr &= ~PSR_C; - tf->sfip = tf->snip & ~FIP_E; - tf->snip = tf->sxip & ~NIP_E; + tf->tf_epsr &= ~PSR_C; + tf->tf_sfip = tf->tf_snip & ~FIP_E; + tf->tf_snip = tf->tf_sxip & ~NIP_E; break; case EJUSTRETURN: /* if (error == EJUSTRETURN), leave the ip's alone */ - tf->epsr &= ~PSR_C; + tf->tf_epsr &= ~PSR_C; break; default: /* error != ERESTART && error != EJUSTRETURN*/ if (p->p_emul->e_errno) error = p->p_emul->e_errno[error]; - tf->r[2] = error; - tf->epsr |= PSR_C; /* fail */ - tf->snip = tf->snip & ~NIP_E; - tf->sfip = tf->sfip & ~FIP_E; + tf->tf_r[2] = error; + tf->tf_epsr |= PSR_C; /* fail */ + tf->tf_snip = tf->tf_snip & ~NIP_E; + tf->tf_sfip = tf->tf_sfip & ~FIP_E; break; } #ifdef SYSCALL_DEBUG @@ -1316,7 +1316,7 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf) #ifdef M88110 /* Instruction pointers operate differently on mc88110 */ void -m88110_syscall(register_t code, struct m88100_saved_state *tf) +m88110_syscall(register_t code, struct trapframe *tf) { int i, nsys, nap; struct sysent *callp; @@ -1336,7 +1336,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) nsys = p->p_emul->e_nsysent; #ifdef DIAGNOSTIC - if (USERMODE(tf->epsr) == 0) + if (USERMODE(tf->tf_epsr) == 0) panic("syscall"); if (curpcb != &p->p_addr->u_pcb) panic("syscall curpcb/ppcb"); @@ -1353,7 +1353,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) * __syscall takes a quad syscall number, so that other * arguments are at their natural alignments. */ - ap = &tf->r[2]; + ap = &tf->tf_r[2]; nap = 11; /* r2-r12 */ switch (code) { @@ -1440,12 +1440,12 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) * tippity-top of the u. area.) */ p = curproc; - tf = USER_REGS(p); - tf->r[2] = rval[0]; - tf->r[3] = rval[1]; - tf->epsr &= ~PSR_C; - tf->exip += 4 + 4; - tf->exip &= XIP_ADDR; + tf = (struct trapframe *)USER_REGS(p); + tf->tf_r[2] = rval[0]; + tf->tf_r[3] = rval[1]; + tf->tf_epsr &= ~PSR_C; + tf->tf_exip += 4 + 4; + tf->tf_exip &= XIP_ADDR; break; case ERESTART: /* @@ -1453,20 +1453,20 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) * exip is already at the trap instruction, so * there is nothing to do. */ - tf->epsr &= ~PSR_C; + tf->tf_epsr &= ~PSR_C; break; case EJUSTRETURN: - tf->epsr &= ~PSR_C; - tf->exip += 4; - tf->exip &= XIP_ADDR; + tf->tf_epsr &= ~PSR_C; + tf->tf_exip += 4; + tf->tf_exip &= XIP_ADDR; break; default: if (p->p_emul->e_errno) error = p->p_emul->e_errno[error]; - tf->r[2] = error; - tf->epsr |= PSR_C; /* fail */ - tf->exip += 4; - tf->exip &= XIP_ADDR; + tf->tf_r[2] = error; + tf->tf_epsr |= PSR_C; /* fail */ + tf->tf_exip += 4; + tf->tf_exip &= XIP_ADDR; break; } @@ -1492,16 +1492,16 @@ child_return(arg) struct proc *p = arg; struct trapframe *tf; - tf = USER_REGS(p); - tf->r[2] = 0; - tf->r[3] = 0; - tf->epsr &= ~PSR_C; + tf = (struct trapframe *)USER_REGS(p); + tf->tf_r[2] = 0; + tf->tf_r[3] = 0; + tf->tf_epsr &= ~PSR_C; if (cputyp != CPU_88110) { - tf->snip = tf->sfip & XIP_ADDR; - tf->sfip = tf->snip + 4; + tf->tf_snip = tf->tf_sfip & XIP_ADDR; + tf->tf_sfip = tf->tf_snip + 4; } else { - tf->exip += 4 + 4; - tf->exip &= XIP_ADDR; + tf->tf_exip += 4 + 4; + tf->tf_exip &= XIP_ADDR; } userret(p, tf, p->p_sticks); @@ -1522,8 +1522,8 @@ child_return(arg) unsigned ss_get_value(struct proc *, unsigned, int); int ss_put_value(struct proc *, unsigned, unsigned, int); unsigned ss_branch_taken(unsigned, unsigned, - unsigned (*func)(unsigned int, struct trapframe *), struct trapframe *); -unsigned int ss_getreg_val(unsigned int, struct trapframe *); + unsigned (*func)(unsigned int, struct reg *), struct reg *); +unsigned int ss_getreg_val(unsigned int, struct reg *); int ss_inst_branch(unsigned); int ss_inst_delayed(unsigned); unsigned ss_next_instr_address(struct proc *, unsigned, unsigned); @@ -1579,7 +1579,7 @@ ss_put_value(struct proc *p, unsigned addr, unsigned value, int size) */ unsigned ss_branch_taken(unsigned inst, unsigned pc, - unsigned (*func)(unsigned int, struct trapframe *), struct trapframe *func_data) + unsigned (*func)(unsigned int, struct reg *), struct reg *func_data) { /* check if br/bsr */ if ((inst & 0xf0000000) == 0xc0000000) { @@ -1619,9 +1619,9 @@ ss_branch_taken(unsigned inst, unsigned pc, * frame. Only makes sense for general registers. */ unsigned int -ss_getreg_val(unsigned int regno, struct trapframe *tf) +ss_getreg_val(unsigned int regno, struct reg *regs) { - return (regno == 0 ? 0 : tf->r[regno]); + return (regno == 0 ? 0 : regs->r[regno]); } int @@ -1682,7 +1682,7 @@ int cpu_singlestep(p) struct proc *p; { - struct trapframe *sstf = USER_REGS(p); + struct reg *sstf = USER_REGS(p); unsigned pc, brpc; int bpinstr = SSBREAKPOINT; unsigned curinstr; diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index f82e1f52076..ad9e5171679 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.58 2004/01/08 14:35:33 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.59 2004/01/12 07:46:17 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -111,7 +111,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) bcopy(&p1->p_addr->u_pcb, &p2->p_addr->u_pcb, sizeof(struct pcb)); p2->p_addr->u_pcb.kernel_state.pcb_ipl = IPL_NONE; /* XXX */ - p2->p_md.md_tf = USER_REGS(p2); + p2->p_md.md_tf = (struct trapframe *)USER_REGS(p2); /*XXX these may not be necessary nivas */ save_u_area(p2, (vaddr_t)p2->p_addr); |