static int nommu_v7_vectors_init(void) { void *vectors; u32 cr; if (cpu_architecture() < CPU_ARCH_ARMv7) return 0; /* * High vectors cannot be re-mapped, so we have to use normal * vectors */ cr = get_cr(); cr &= ~CR_V; set_cr(cr); arm_fixup_vectors(); vectors = xmemalign(PAGE_SIZE, PAGE_SIZE); memset(vectors, 0, PAGE_SIZE); memcpy(vectors, __exceptions_start, __exceptions_size); set_vbar((unsigned int)vectors); return 0; }
void Hal_Init() { unsigned long reset_vect; unsigned long vec_start = (unsigned long)&_start; unsigned long vec_end = (unsigned long)&_vector_end; reset_vect = set_vbar(); reset_vect = read_vbar(); /*init the interrupt lib*/ Hal_Int_Lib_Init(); }
void exception_init(void) { uint32_t sctlr = read_sctlr(); /* Handle exceptions in ARM mode. */ sctlr &= ~SCTLR_TE; /* Set V=0 in SCTLR so VBAR points to the exception vector table. */ sctlr &= ~SCTLR_V; write_sctlr(sctlr); extern uint32_t exception_table[]; set_vbar((uintptr_t)exception_table); exception_stack_end = exception_stack + ARRAY_SIZE(exception_stack); exception_state_ptr = &exception_state; }