diff options
Diffstat (limited to 'core/init.c')
-rw-r--r-- | core/init.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/init.c b/core/init.c index 8acc44c..1ed7501 100644 --- a/core/init.c +++ b/core/init.c @@ -501,6 +501,17 @@ static void dt_init_misc(void) dt_fixups(); } +static void branch_null(void) +{ + assert_fail("Branch to NULL !"); +} + +static void setup_branch_null_catcher(void) +{ + void (*bn)(void) = branch_null; + memcpy(0, bn, 16); +} + /* Called from head.S, thus no prototype. */ void __noreturn main_cpu_entry(const void *fdt, u32 master_cpu); @@ -527,6 +538,11 @@ void __noreturn main_cpu_entry(const void *fdt, u32 master_cpu) */ clear_console(); + /* Put at 0 an OPD to a warning function in case we branch through + * a NULL function pointer + */ + setup_branch_null_catcher(); + printf("SkiBoot %s starting...\n", version); printf("initial console log level: memory %d, driver %d\n", (debug_descriptor.console_log_levels >> 4), |