From 29d8227e6d16aa2e8c116b3835ef5c33495741c5 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 2 Dec 1996 19:48:29 +0000 Subject: Updates from Derrick Ostertag to fix bug in interrupt handling. --- c/src/exec/score/cpu/a29k/a29k.h | 8 +++++++- c/src/exec/score/cpu/a29k/cpu.c | 23 +++++++++++++++-------- c/src/exec/score/cpu/a29k/cpu.h | 7 ++++++- c/src/exec/score/cpu/a29k/cpu_asm.s | 25 ++++++++++++++++++++----- cpukit/score/cpu/a29k/cpu.c | 23 +++++++++++++++-------- 5 files changed, 63 insertions(+), 23 deletions(-) diff --git a/c/src/exec/score/cpu/a29k/a29k.h b/c/src/exec/score/cpu/a29k/a29k.h index c2fa60cd08..f948abe5e4 100644 --- a/c/src/exec/score/cpu/a29k/a29k.h +++ b/c/src/exec/score/cpu/a29k/a29k.h @@ -10,7 +10,7 @@ * $Id$ * */ -/* @(#)a29k.h 09/12/96 1.2 */ +/* @(#)a29k.h 10/21/96 1.3 */ #ifndef _INCLUDE_A29K_h #define _INCLUDE_A29K_h @@ -67,6 +67,12 @@ extern "C" { #define CPU_NAME "AMD 29K" +/* + * Some bits in the CPS: + */ +#define TD 0x20000 +#define DI 0x00002 + #ifdef __cplusplus } #endif diff --git a/c/src/exec/score/cpu/a29k/cpu.c b/c/src/exec/score/cpu/a29k/cpu.c index 4312e85035..d091b6074f 100644 --- a/c/src/exec/score/cpu/a29k/cpu.c +++ b/c/src/exec/score/cpu/a29k/cpu.c @@ -29,7 +29,7 @@ * $Id$ */ #ifndef lint -static char _sccsid[] = "@(#)cpu.c 21 Aug 1996 1.6\n"; +static char _sccsid[] = "@(#)cpu.c 10/21/96 1.8\n"; #endif #include @@ -94,10 +94,16 @@ void _CPU_Initialize( unsigned32 _CPU_ISR_Get_level( void ) { + unsigned32 cps; + /* * This routine returns the current interrupt level. */ - return 0; + cps = a29k_getops(); + if (cps & (TD|DI)) + return 1; + else + return 0; } /*PAGE @@ -106,8 +112,8 @@ unsigned32 _CPU_ISR_Get_level( void ) */ extern void intr14( void ); -extern void intr3( void ); -extern void intr2( void ); +extern void intr18( void ); +extern void intr19( void ); void _CPU_ISR_install_raw_handler( unsigned32 vector, @@ -124,12 +130,13 @@ void _CPU_ISR_install_raw_handler( case 14: _settrap( vector, intr14 ); break; - case 3: - _settrap( vector, intr3 ); + case 18: + _settrap( vector, intr18 ); break; - case 2: - _settrap( vector, intr2 ); + case 19: + _settrap( vector, intr19 ); break; + default: break; } diff --git a/c/src/exec/score/cpu/a29k/cpu.h b/c/src/exec/score/cpu/a29k/cpu.h index 17a7d718e6..6e0e5adf98 100644 --- a/c/src/exec/score/cpu/a29k/cpu.h +++ b/c/src/exec/score/cpu/a29k/cpu.h @@ -30,7 +30,7 @@ * * $Id$ */ -/* @(#)cpu.h 09/06/96 1.10 */ +/* @(#)cpu.h 10/21/96 1.11 */ #ifndef __CPU_h #define __CPU_h @@ -46,6 +46,8 @@ extern "C" { extern unsigned int a29k_disable( void ); extern void a29k_enable( unsigned int cookie ); +extern unsigned int a29k_getops( void ); +extern void a29k_getops_sup( void ); extern void a29k_disable_sup( void ); extern void a29k_enable_sup( void ); extern void a29k_disable_all( void ); @@ -655,6 +657,9 @@ extern void _CPU_Context_save( (_the_context)->local_count = 1-1; \ (_the_context)->PC1 = _entry_point; \ (_the_context)->PC0 = (unsigned32)((char *)_entry_point + 4); \ + if (_isr) { (_the_context)->OPS |= (TD | DI); } \ + else \ + { (_the_context)->OPS &= ~(TD | DI); } \ }while(0) /* diff --git a/c/src/exec/score/cpu/a29k/cpu_asm.s b/c/src/exec/score/cpu/a29k/cpu_asm.s index e915dd2ecf..78a3300627 100644 --- a/c/src/exec/score/cpu/a29k/cpu_asm.s +++ b/c/src/exec/score/cpu/a29k/cpu_asm.s @@ -391,6 +391,18 @@ __CPU_Context_save: ; jmpi lr0 ; nop + .global _a29k_getops +_a29k_getops: + asneq 113, gr96, gr96 + jmpi lr0 + nop + + .global _a29k_getops_sup +_a29k_getops_sup: + mfsr gr96, ops ; caller wants ops + iret + nop + .global _a29k_disable _a29k_disable: asneq 110, gr96, gr96 @@ -400,6 +412,7 @@ _a29k_disable: .global _a29k_disable_sup _a29k_disable_sup: mfsr kt0, ops + add gr96, kt0, 0 ; return ops to caller const kt1, (DI | TD) consth kt1, (DI | TD) or kt1, kt0, kt1 @@ -416,8 +429,8 @@ _a29k_disable_all: .global _a29k_disable_all_sup _a29k_disable_all_sup: mfsr kt0, ops - const kt1, DA - consth kt1, DA + const kt1, (DI | TD) + consth kt1, (DI | TD) or kt1, kt0, kt1 mtsr ops, kt1 iret @@ -432,8 +445,8 @@ _a29k_enable_all: .global _a29k_enable_all_sup _a29k_enable_all_sup: mfsr kt0, ops - const kt1, DA - consth kt1, DA + const kt1, (DI | TD) + consth kt1, (DI | TD) andn kt1, kt0, kt1 mtsr ops, kt1 iret @@ -450,7 +463,9 @@ _a29k_enable_sup: mfsr kt0, ops const kt1, (DI | TD) consth kt1, (DI | TD) - andn kt1, kt0, kt1 + and kt3, lr2, kt1 + andn kt0, kt0, kt1 + or kt1, kt0, kt3 mtsr ops, kt1 iret nop diff --git a/cpukit/score/cpu/a29k/cpu.c b/cpukit/score/cpu/a29k/cpu.c index 4312e85035..d091b6074f 100644 --- a/cpukit/score/cpu/a29k/cpu.c +++ b/cpukit/score/cpu/a29k/cpu.c @@ -29,7 +29,7 @@ * $Id$ */ #ifndef lint -static char _sccsid[] = "@(#)cpu.c 21 Aug 1996 1.6\n"; +static char _sccsid[] = "@(#)cpu.c 10/21/96 1.8\n"; #endif #include @@ -94,10 +94,16 @@ void _CPU_Initialize( unsigned32 _CPU_ISR_Get_level( void ) { + unsigned32 cps; + /* * This routine returns the current interrupt level. */ - return 0; + cps = a29k_getops(); + if (cps & (TD|DI)) + return 1; + else + return 0; } /*PAGE @@ -106,8 +112,8 @@ unsigned32 _CPU_ISR_Get_level( void ) */ extern void intr14( void ); -extern void intr3( void ); -extern void intr2( void ); +extern void intr18( void ); +extern void intr19( void ); void _CPU_ISR_install_raw_handler( unsigned32 vector, @@ -124,12 +130,13 @@ void _CPU_ISR_install_raw_handler( case 14: _settrap( vector, intr14 ); break; - case 3: - _settrap( vector, intr3 ); + case 18: + _settrap( vector, intr18 ); break; - case 2: - _settrap( vector, intr2 ); + case 19: + _settrap( vector, intr19 ); break; + default: break; } -- cgit v1.2.3