[arch][or1k] get working after SMP changes

This commit is contained in:
M1cha
2015-07-02 07:55:20 +02:00
committed by Travis Geiselbrecht
parent caec70a21b
commit 8e0afb2b5e
7 changed files with 128 additions and 12 deletions

View File

@@ -27,6 +27,13 @@
#include <platform/pic.h>
#include <arch/or1k.h>
static spin_lock_t gicd_lock;
#if WITH_LIB_SM
#define GICD_LOCK_FLAGS SPIN_LOCK_FLAG_IRQ_FIQ
#else
#define GICD_LOCK_FLAGS SPIN_LOCK_FLAG_INTERRUPTS
#endif
struct int_handler_struct {
int_handler handler;
void *arg;
@@ -36,15 +43,17 @@ static struct int_handler_struct int_handler_table[MAX_INT];
void register_int_handler(unsigned int vector, int_handler handler, void *arg)
{
spin_lock_saved_state_t state;
if (vector >= MAX_INT)
panic("%s: vector out of range %d\n", __FUNCTION__, vector);
enter_critical_section();
spin_lock_save(&gicd_lock, &state, GICD_LOCK_FLAGS);
int_handler_table[vector].handler = handler;
int_handler_table[vector].arg = arg;
exit_critical_section();
spin_unlock_restore(&gicd_lock, state, GICD_LOCK_FLAGS);
}
status_t mask_interrupt(unsigned int vector)