/* * The following calls CPU specific code in a position independent * manner. See arch/arm/mm/proc-*.S for details. r10 = base of * xxx_proc_info structure selected by __lookup_processor_type * above. * * The processor init function will be called with: * r1 - machine type * r2 - boot data (atags/dt) pointer * r4 - translation table base (low word) * r5 - translation table base (high word, if LPAE) * r8 - translation table base 1 (pfn if LPAE) * r9 - cpuid * r13 - virtual address for __enable_mmu -> __turn_mmu_on * * On return, the CPU will be ready for the MMU to be turned on, * r0 will hold the CPU control register value, r1, r2, r4, and * r9 will be preserved. r5 will also be preserved if LPAE. */ ldr r13, =__mmap_switched @ address to jump to after @ mmu has been enabled badr lr, 1f @ return (PIC) address #ifdef CONFIG_ARM_LPAE mov r5, #0 @ high TTBR0 mov r8, r4, lsr #12 @ TTBR1 is swapper_pg_dir pfn #else mov r8, r4 @ set TTBR1 to swapper_pg_dir #endif ldr r12, [r10, #PROCINFO_INITFUNC] add r12, r12, r10 ret r12 1: b __enable_mmu ENDPROC(stext) .ltorg
/* * Poison the vectors page with an undefined instruction. This * instruction is chosen to be undefined for both ARM and Thumb * ISAs. The Thumb version is an undefined instruction with a * branch back to the undefined instruction. */ for (i = 0; i < PAGE_SIZE / sizeof(u32); i++) ((u32 *)vectors_base)[i] = 0xe7fddef1;
/* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream. */ copy_from_lma(vectors_base, __vectors_start, __vectors_end); copy_from_lma(vectors_base + 0x1000, __stubs_start, __stubs_end);
.macro irq_handler, from_user:req movr1, sp ldr_this_cpu r2, irq_stack_ptr, r2, r3 .if \from_user == 0 @ @ If we took the interrupt while running in the kernel, we may already @ be using the IRQ stack, so revert to the original value in that case. @ subsr3, r2, r1@ SP above bottom of IRQ stack? rsbscs r3, r3, #THREAD_SIZE@ ... and below the top? #ifdef CONFIG_VMAP_STACK ldr_va r3, high_memory, cc @ End of the linear region cmpccr3, r1@ Stack pointer was below it? #endif bcc0f @ If not, switch to the IRQ stack movr0, r1 bl generic_handle_arch_irq <----------------调用的函数 b1f