summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2015-03-05 05:53:08 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2015-03-05 05:53:08 +0000
commitcd06a4774fd211fe42415621393407b4a8d26cbb (patch)
tree52b067b82098994e334de129bfd31bedec0cdd1c
parent80210b69e0654f1a39d17d24489e2721b9253c5b (diff)
downloadFreeBSD-src-cd06a4774fd211fe42415621393407b4a8d26cbb.zip
FreeBSD-src-cd06a4774fd211fe42415621393407b4a8d26cbb.tar.gz
Move IVOR setup from assembler to C, decreasing required assumptions about
address formats for trap handlers.
-rw-r--r--sys/powerpc/booke/locore.S36
-rw-r--r--sys/powerpc/booke/machdep.c45
2 files changed, 45 insertions, 36 deletions
diff --git a/sys/powerpc/booke/locore.S b/sys/powerpc/booke/locore.S
index 0fcca91..9d00327 100644
--- a/sys/powerpc/booke/locore.S
+++ b/sys/powerpc/booke/locore.S
@@ -536,42 +536,6 @@ __boot_page_padding:
/* locore subroutines */
/************************************************************************/
-ivor_setup:
- /* Set base address of interrupt handler routines */
- lis %r3, interrupt_vector_base@h
- mtspr SPR_IVPR, %r3
-
- /* Assign interrupt handler routines offsets */
- li %r3, int_critical_input@l
- mtspr SPR_IVOR0, %r3
- li %r3, int_machine_check@l
- mtspr SPR_IVOR1, %r3
- li %r3, int_data_storage@l
- mtspr SPR_IVOR2, %r3
- li %r3, int_instr_storage@l
- mtspr SPR_IVOR3, %r3
- li %r3, int_external_input@l
- mtspr SPR_IVOR4, %r3
- li %r3, int_alignment@l
- mtspr SPR_IVOR5, %r3
- li %r3, int_program@l
- mtspr SPR_IVOR6, %r3
- li %r3, int_syscall@l
- mtspr SPR_IVOR8, %r3
- li %r3, int_decrementer@l
- mtspr SPR_IVOR10, %r3
- li %r3, int_fixed_interval_timer@l
- mtspr SPR_IVOR11, %r3
- li %r3, int_watchdog@l
- mtspr SPR_IVOR12, %r3
- li %r3, int_data_tlb_error@l
- mtspr SPR_IVOR13, %r3
- li %r3, int_inst_tlb_error@l
- mtspr SPR_IVOR14, %r3
- li %r3, int_debug@l
- mtspr SPR_IVOR15, %r3
- blr
-
/*
* void tid_flush(tlbtid_t tid);
*
diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c
index 42a4f04..40f3724 100644
--- a/sys/powerpc/booke/machdep.c
+++ b/sys/powerpc/booke/machdep.c
@@ -187,6 +187,51 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_booke_startup, NULL);
void print_kernel_section_addr(void);
void print_kenv(void);
u_int booke_init(uint32_t, uint32_t);
+void ivor_setup(void);
+
+extern void *interrupt_vector_base;
+extern void *int_critical_input;
+extern void *int_machine_check;
+extern void *int_data_storage;
+extern void *int_instr_storage;
+extern void *int_external_input;
+extern void *int_alignment;
+extern void *int_program;
+extern void *int_syscall;
+extern void *int_decrementer;
+extern void *int_fixed_interval_timer;
+extern void *int_watchdog;
+extern void *int_data_tlb_error;
+extern void *int_inst_tlb_error;
+extern void *int_debug;
+
+#define SET_TRAP(ivor, handler) \
+ KASSERT(((uintptr_t)(&handler) & ~0xffffUL) == \
+ ((uintptr_t)(&interrupt_vector_base) & ~0xffffUL), \
+ ("Handler " #handler " too far from interrupt vector base")); \
+ mtspr(ivor, (uintptr_t)(&handler) & 0xffffUL);
+
+void
+ivor_setup(void)
+{
+
+ mtspr(SPR_IVPR, ((uintptr_t)&interrupt_vector_base) & 0xffff0000);
+
+ SET_TRAP(SPR_IVOR0, int_critical_input);
+ SET_TRAP(SPR_IVOR1, int_machine_check);
+ SET_TRAP(SPR_IVOR2, int_data_storage);
+ SET_TRAP(SPR_IVOR3, int_instr_storage);
+ SET_TRAP(SPR_IVOR4, int_external_input);
+ SET_TRAP(SPR_IVOR5, int_alignment);
+ SET_TRAP(SPR_IVOR6, int_program);
+ SET_TRAP(SPR_IVOR8, int_syscall);
+ SET_TRAP(SPR_IVOR10, int_decrementer);
+ SET_TRAP(SPR_IVOR11, int_fixed_interval_timer);
+ SET_TRAP(SPR_IVOR12, int_watchdog);
+ SET_TRAP(SPR_IVOR13, int_data_tlb_error);
+ SET_TRAP(SPR_IVOR14, int_inst_tlb_error);
+ SET_TRAP(SPR_IVOR15, int_debug);
+}
static void
cpu_booke_startup(void *dummy)
OpenPOWER on IntegriCloud