From d60239f6c85fd7b0c1eb6ff54fcfb0b3b87040c6 Mon Sep 17 00:00:00 2001 From: Till Straumann Date: Wed, 16 Jul 2008 21:57:55 +0000 Subject: 2008-07-16 Till Straumann * new-exceptions/cpu.c: use ppc_interrupt_get_disable_mask() to determine which bits to set/clear from _CPU_Context_Initialize(). --- c/src/lib/libcpu/powerpc/ChangeLog | 5 +++++ c/src/lib/libcpu/powerpc/new-exceptions/cpu.c | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'c/src') diff --git a/c/src/lib/libcpu/powerpc/ChangeLog b/c/src/lib/libcpu/powerpc/ChangeLog index 4967927206..d003d89059 100644 --- a/c/src/lib/libcpu/powerpc/ChangeLog +++ b/c/src/lib/libcpu/powerpc/ChangeLog @@ -1,3 +1,8 @@ +2008-07-16 Till Straumann + + * new-exceptions/cpu.c: use ppc_interrupt_get_disable_mask() + to determine which bits to set/clear from _CPU_Context_Initialize(). + 2008-07-16 Till Straumann * new-exceptions/bspsupport/ppc_exc_asm_macros.h: Added diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c index 405aa812d3..c80e1fe1d0 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c @@ -55,6 +55,7 @@ void _CPU_Initialize( * _CPU_Context_Initialize */ + void _CPU_Context_Initialize( Context_Control *the_context, uint32_t *stack_base, @@ -76,11 +77,24 @@ void _CPU_Context_Initialize( _CPU_MSR_GET( msr_value ); + /* + * Setting the interrupt mask here is not strictly necessary + * since the IRQ level will be established from _Thread_Handler() + * again, as soon as the task starts execution. + * Because we have to establish a defined state anyways we + * can as well leave this code here. + * I.e., simply (and unconditionally) saying + * + * msr_value &= ~ppc_interrupt_get_disable_mask(); + * + * would be an alternative. + */ + if (!(new_level & CPU_MODES_INTERRUPT_MASK)) { - msr_value |= MSR_EE; + msr_value |= ppc_interrupt_get_disable_mask(); } else { - msr_value &= ~MSR_EE; + msr_value &= ~ppc_interrupt_get_disable_mask(); } the_context->msr = msr_value; -- cgit v1.2.3