1 /* 2 * Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Full C support initialization 10 */ 11 12 #include <kernel_internal.h> 13 #include <zephyr/irq.h> 14 interrupt_init(void)15static void interrupt_init(void) 16 { 17 extern char __isr_vec[]; 18 extern uint32_t mips_cp0_status_int_mask; 19 unsigned long ebase; 20 21 irq_lock(); 22 23 mips_cp0_status_int_mask = 0; 24 25 ebase = 0x80000000; 26 27 memcpy((void *)(ebase + 0x180), __isr_vec, 0x80); 28 29 /* 30 * Disable boot exception vector in BOOTROM, 31 * use exception vector in RAM. 32 */ 33 write_c0_status(read_c0_status() & ~(ST0_BEV)); 34 } 35 36 /** 37 * 38 * @brief Prepare to and run C code 39 * 40 * This routine prepares for the execution of and runs C code. 41 * 42 * @return N/A 43 */ 44 _PrepC(void)45void _PrepC(void) 46 { 47 z_bss_zero(); 48 49 interrupt_init(); 50 51 z_cstart(); 52 CODE_UNREACHABLE; 53 } 54