aboutsummaryrefslogtreecommitdiff
path: root/core/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/init.c')
-rw-r--r--core/init.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/core/init.c b/core/init.c
index cd333dc..7dc0611 100644
--- a/core/init.c
+++ b/core/init.c
@@ -618,6 +618,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
/* Disable machine checks on all */
cpu_disable_ME_RI_all();
+ patch_traps(false);
+
debug_descriptor.state_flags |= OPAL_BOOT_COMPLETE;
cpu_give_self_os();
@@ -758,7 +760,7 @@ static void __nomcount do_ctors(void)
#ifndef PPC64_ELF_ABI_v2
static void branch_null(void)
{
- assert_fail("Branch to NULL !");
+ assert(0);
}
@@ -821,6 +823,28 @@ void copy_exception_vectors(void)
sync_icache();
}
+/*
+ * When skiboot owns the exception vectors, patch in 'trap' for assert fails.
+ * Otherwise use assert_fail()
+ */
+void patch_traps(bool enable)
+{
+ struct trap_table_entry *tte;
+
+ for (tte = __trap_table_start; tte < __trap_table_end; tte++) {
+ uint32_t *insn;
+
+ insn = (uint32_t *)tte->address;
+ if (enable) {
+ *insn = PPC_INST_TRAP;
+ } else {
+ *insn = PPC_INST_NOP;
+ }
+ }
+
+ sync_icache();
+}
+
static void per_thread_sanity_checks(void)
{
struct cpu_thread *cpu = this_cpu();
@@ -950,6 +974,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
/* Copy all vectors down to 0 */
copy_exception_vectors();
+ /* Enable trap based asserts */
+ patch_traps(true);
+
/*
* Enable MSR[ME] bit so we can take MCEs. We don't currently
* recover, but we print some useful information.