Add LINTSTUBs and make oea_init() agree with them.

This commit is contained in:
matt 2003-03-15 07:21:02 +00:00
parent b105ddb1d6
commit 2b8417e488
2 changed files with 64 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: oea_machdep.c,v 1.5 2003/03/05 05:27:25 matt Exp $ */
/* $NetBSD: oea_machdep.c,v 1.6 2003/03/15 07:21:02 matt Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@ -102,20 +102,20 @@ void
oea_init(void (*handler)(void))
{
extern int trapstart[], trapend[];
extern int trapcode, trapsize;
extern int sctrap, scsize;
extern int alitrap, alisize;
extern int dsitrap, dsisize;
extern int dsi601trap, dsi601size;
extern int decrint, decrsize;
extern int tlbimiss, tlbimsize;
extern int tlbdlmiss, tlbdlmsize;
extern int tlbdsmiss, tlbdsmsize;
extern int trapcode[], trapsize[];
extern int sctrap[], scsize[];
extern int alitrap[], alisize[];
extern int dsitrap[], dsisize[];
extern int dsi601trap[], dsi601size[];
extern int decrint[], decrsize[];
extern int tlbimiss[], tlbimsize[];
extern int tlbdlmiss[], tlbdlmsize[];
extern int tlbdsmiss[], tlbdsmsize[];
#if defined(DDB) || defined(KGDB)
extern int ddblow, ddbsize;
extern int ddblow[], ddbsize[];
#endif
#ifdef IPKDB
extern int ipkdblow, ipkdbsize;
extern int ipkdblow[], ipkdbsize[];
#endif
#ifdef ALTIVEC
register_t msr;
@ -168,8 +168,8 @@ oea_init(void (*handler)(void))
for (exc = 0; exc <= EXC_LAST; exc += 0x100) {
switch (exc) {
default:
size = (size_t)&trapsize;
memcpy((void *)exc, &trapcode, size);
size = (size_t)trapsize;
memcpy((void *)exc, trapcode, size);
break;
#if 0
case EXC_EXI:
@ -179,48 +179,48 @@ oea_init(void (*handler)(void))
break;
#endif
case EXC_SC:
size = (size_t)&scsize;
memcpy((void *)EXC_SC, &sctrap, size);
size = (size_t)scsize;
memcpy((void *)EXC_SC, sctrap, size);
break;
case EXC_ALI:
size = (size_t)&alisize;
memcpy((void *)EXC_ALI, &alitrap, size);
size = (size_t)alisize;
memcpy((void *)EXC_ALI, alitrap, size);
break;
case EXC_DSI:
if (cpuvers == MPC601) {
size = (size_t)&dsi601size;
memcpy((void *)EXC_DSI, &dsi601trap, size);
size = (size_t)dsi601size;
memcpy((void *)EXC_DSI, dsi601trap, size);
} else {
size = (size_t)&dsisize;
memcpy((void *)EXC_DSI, &dsitrap, size);
size = (size_t)dsisize;
memcpy((void *)EXC_DSI, dsitrap, size);
}
break;
case EXC_DECR:
size = (size_t)&decrsize;
memcpy((void *)EXC_DECR, &decrint, size);
size = (size_t)decrsize;
memcpy((void *)EXC_DECR, decrint, size);
break;
case EXC_IMISS:
size = (size_t)&tlbimsize;
memcpy((void *)EXC_IMISS, &tlbimiss, size);
size = (size_t)tlbimsize;
memcpy((void *)EXC_IMISS, tlbimiss, size);
break;
case EXC_DLMISS:
size = (size_t)&tlbdlmsize;
memcpy((void *)EXC_DLMISS, &tlbdlmiss, size);
size = (size_t)tlbdlmsize;
memcpy((void *)EXC_DLMISS, tlbdlmiss, size);
break;
case EXC_DSMISS:
size = (size_t)&tlbdsmsize;
memcpy((void *)EXC_DSMISS, &tlbdsmiss, size);
size = (size_t)tlbdsmsize;
memcpy((void *)EXC_DSMISS, tlbdsmiss, size);
break;
case EXC_PERF:
size = (size_t)&trapsize;
memcpy((void *)EXC_PERF, &trapcode, size);
memcpy((void *)EXC_VEC, &trapcode, size);
size = (size_t)trapsize;
memcpy((void *)EXC_PERF, trapcode, size);
memcpy((void *)EXC_VEC, trapcode, size);
break;
#if defined(DDB) || defined(IPKDB) || defined(KGDB)
case EXC_RUNMODETRC:
if (cpuvers != MPC601) {
size = (size_t)&trapsize;
memcpy((void *)EXC_RUNMODETRC, &trapcode, size);
size = (size_t)trapsize;
memcpy((void *)EXC_RUNMODETRC, trapcode, size);
break;
}
/* FALLTHROUGH */
@ -228,14 +228,14 @@ oea_init(void (*handler)(void))
case EXC_TRC:
case EXC_BPT:
#if defined(DDB) || defined(KGDB)
size = (size_t)&ddbsize;
memcpy((void *)exc, &ddblow, size);
size = (size_t)ddbsize;
memcpy((void *)exc, ddblow, size);
#if defined(IPKDB)
#error "cannot enable IPKDB with DDB or KGDB"
#endif
#else
size = (size_t)&ipkdbsize;
memcpy((void *)exc, &ipkdblow, size);
size = (size_t)ipkdbsize;
memcpy((void *)exc, ipkdblow, size);
#endif
break;
#endif /* DDB || IPKDB || KGDB */
@ -576,9 +576,9 @@ oea_batinit(paddr_t pa, ...)
void
oea_install_extint(void (*handler)(void))
{
extern int extint, extsize;
extern int extint_call;
uintptr_t offset = (uintptr_t)handler - (uintptr_t)&extint_call;
extern int extint[], extsize[];
extern int extint_call[];
uintptr_t offset = (uintptr_t)handler - (uintptr_t)extint_call;
int omsr, msr;
#ifdef DIAGNOSTIC
@ -589,10 +589,10 @@ oea_install_extint(void (*handler)(void))
__asm __volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
: "=r" (omsr), "=r" (msr)
: "K" ((u_short)~PSL_EE));
extint_call = (extint_call & 0xfc000003) | offset;
memcpy((void *)EXC_EXI, &extint, (size_t)&extsize);
__syncicache((void *)&extint_call, sizeof extint_call);
__syncicache((void *)EXC_EXI, (int)&extsize);
extint_call[0] = (extint_call[0] & 0xfc000003) | offset;
memcpy((void *)EXC_EXI, extint, (size_t)extsize);
__syncicache((void *)extint_call, sizeof extint_call[0]);
__syncicache((void *)EXC_EXI, (int)extsize);
__asm __volatile ("mtmsr %0" :: "r"(omsr));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap_subr.S,v 1.36 2003/03/04 08:34:12 matt Exp $ */
/* $NetBSD: trap_subr.S,v 1.37 2003/03/15 07:21:02 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -39,6 +39,9 @@
*/
#include "opt_altivec.h"
/* LINTSTUB: include <sys/param.h> */
/* LINTSTUB: include <powerpc/oea/bat.h> */
#ifdef ALTIVEC
#define SAVE_VRSAVE(tf,b) \
mfspr b,SPR_VRSAVE; \
@ -102,6 +105,7 @@
* (except ISI/DSI, ALI, the interrupts, and possibly the debugging
* traps when using IPKDB).
*/
/* LINTSTUB: Var: int trapcode[1], trapsize[1]; */
.text
.globl _C_LABEL(trapcode),_C_LABEL(trapsize)
_C_LABEL(trapcode):
@ -120,6 +124,7 @@ _C_LABEL(trapsize) = .-_C_LABEL(trapcode)
/*
* For ALI: has to save DSISR and DAR
*/
/* LINTSTUB: Var: int alicode[1], alisize[1]; */
.globl _C_LABEL(alitrap),_C_LABEL(alisize)
_C_LABEL(alitrap):
mtsprg 1,1 /* save SP */
@ -142,6 +147,7 @@ _C_LABEL(alisize) = .-_C_LABEL(alitrap)
* Has to handle BAT spills
* and standard pagetable spills
*/
/* LINTSTUB: Var: int dsicode[1], dsisize[1]; */
.globl _C_LABEL(dsitrap),_C_LABEL(dsisize)
_C_LABEL(dsitrap):
mtsprg 1,1
@ -195,6 +201,7 @@ _C_LABEL(dsisize) = .-_C_LABEL(dsitrap)
* Considers different BAT format and combined implementation
* (being addressed as I-BAT).
*/
/* LINTSTUB: Var: int dsi601code[1], dsi601size[1]; */
.globl _C_LABEL(dsi601trap),_C_LABEL(dsi601size)
_C_LABEL(dsi601trap):
mtsprg 1,1
@ -247,6 +254,7 @@ _C_LABEL(dsi601size) = .-_C_LABEL(dsi601trap)
/*
* This one for the external interrupt handler.
*/
/* LINTSTUB: Var: int extint[1], extsize[1]; */
.globl _C_LABEL(extint),_C_LABEL(extsize)
_C_LABEL(extint):
mtsprg 1,1 /* save SP */
@ -268,6 +276,7 @@ _C_LABEL(extsize) = .-_C_LABEL(extint)
/*
* And this one for the decrementer interrupt handler.
*/
/* LINTSTUB: Var: int decrint[1], decrsize[1]; */
.globl _C_LABEL(decrint),_C_LABEL(decrsize)
_C_LABEL(decrint):
mtsprg 1,1 /* save SP */
@ -291,6 +300,7 @@ _C_LABEL(decrsize) = .-_C_LABEL(decrint)
* (Code essentially from the 603e User Manual, Chapter 5, but
* corrected a lot.)
*/
/* LINTSTUB: Var: int tlbimiss[1], tlbimsize[1]; */
.globl _C_LABEL(tlbimiss),_C_LABEL(tlbimsize)
_C_LABEL(tlbimiss):
#ifdef PMAPDEBUG
@ -365,6 +375,7 @@ _C_LABEL(tlbimiss):
ba EXC_ISI
_C_LABEL(tlbimsize) = .-_C_LABEL(tlbimiss)
/* LINTSTUB: Var: int tlbdlmiss[1], tlbdlmsize[1]; */
.globl _C_LABEL(tlbdlmiss),_C_LABEL(tlbdlmsize)
_C_LABEL(tlbdlmiss):
mfspr 2,SPR_HASH1 /* get first pointer */
@ -416,6 +427,7 @@ _C_LABEL(tlbdlmiss):
ba EXC_DSI
_C_LABEL(tlbdlmsize) = .-_C_LABEL(tlbdlmiss)
/* LINTSTUB: Var: int tlbdsmiss[1], tlbdsmsize[1]; */
.globl _C_LABEL(tlbdsmiss),_C_LABEL(tlbdsmsize)
_C_LABEL(tlbdsmiss):
mfspr 2,SPR_HASH1 /* get first pointer */
@ -499,6 +511,7 @@ _C_LABEL(tlbdsmsize) = .-_C_LABEL(tlbdsmiss)
.local ddbstk
.comm ddbstk,INTSTK,8 /* ddb stack */
/* LINTSTUB: Var: int ddblow[1], ddbsize[1]; */
.globl _C_LABEL(ddblow),_C_LABEL(ddbsize)
_C_LABEL(ddblow):
mtsprg 1,1 /* save SP */
@ -521,6 +534,7 @@ _C_LABEL(ddbsize) = .-_C_LABEL(ddblow)
.local ipkdbstk
.comm ipkdbstk,INTSTK,8 /* ipkdb stack */
/* LINTSTUB: Var: int ipkdblow[1], ipkdbsize[1]; */
.globl _C_LABEL(ipkdblow),_C_LABEL(ipkdbsize)
_C_LABEL(ipkdblow):
mtsprg 1,1 /* save SP */
@ -700,6 +714,7 @@ trapagain:
/* Call C trap code: */
addi 3,1,8
bl _C_LABEL(trap)
/* LINTSTUB: Var: int trapexit[1]; */
.globl trapexit
trapexit:
/* Disable interrupts: */
@ -724,7 +739,7 @@ trapexit:
/*
* Trap handler for syscalls (EXC_SC)
*/
/* LINTSTUB: Var: int sctrap[1], scsize[1]; */
.globl _C_LABEL(sctrap),_C_LABEL(scsize)
_C_LABEL(sctrap):
mtsprg 1,1 /* save SP */
@ -813,6 +828,7 @@ s_sctrap:
mtmsr 5; \
isync
/* LINTSTUB: Var: int extint_call[1]; */
.globl _C_LABEL(extint_call)
extintr:
INTRENTER