/* SPDX-License-Identifier: GPL-2.0-only */ /* * linux/arch/arm/mm/proc-v7m.S * * Copyright (C) 2008 ARM Ltd. * Copyright (C) 2001 Deep Blue Solutions Ltd. * * This is the "shell" of the ARMv7-M processor support.
*/
#include <linux/linkage.h>
#include <linux/cfi_types.h>
#include <asm/assembler.h>
#include <asm/page.h>
#include <asm/v7m.h>
#include "proc-macros.S"
SYM_TYPED_FUNC_START(cpu_v7m_proc_init)
ret lr
SYM_FUNC_END(cpu_v7m_proc_init)
SYM_TYPED_FUNC_START(cpu_v7m_proc_fin)
ret lr
SYM_FUNC_END(cpu_v7m_proc_fin)
/* * cpu_v7m_reset(loc) * * Perform a soft reset of the system. Put the CPU into the * same state as it would be if it had been reset, and branch * to what would be the reset vector. * * - loc - location to jump to for soft reset
*/
.align 5
SYM_TYPED_FUNC_START(cpu_v7m_reset)
ret r0
SYM_FUNC_END(cpu_v7m_reset)
/* * cpu_v7m_do_idle() * * Idle the processor (eg, wait for interrupt). * * IRQs are already disabled.
*/
SYM_TYPED_FUNC_START(cpu_v7m_do_idle)
wfi
ret lr
SYM_FUNC_END(cpu_v7m_do_idle)
SYM_TYPED_FUNC_START(cpu_v7m_dcache_clean_area)
ret lr
SYM_FUNC_END(cpu_v7m_dcache_clean_area)
/* * There is no MMU, so here is nothing to do.
*/
SYM_TYPED_FUNC_START(cpu_v7m_switch_mm)
ret lr
SYM_FUNC_END(cpu_v7m_switch_mm)
__v7m_cm7_setup:
mov r8, #(V7M_SCB_CCR_DC | V7M_SCB_CCR_IC| V7M_SCB_CCR_BP)
b __v7m_setup_cont /* * __v7m_setup * * This should be able to cover all ARMv7-M cores.
*/
__v7m_setup:
mov r8, 0
__v7m_setup_cont:
@ Configure the vector table base address
ldr r0, =BASEADDR_V7M_SCB
ldr r12, =vector_table
str r12, [r0, V7M_SCB_VTOR]
@ Lower the priority of the SVC and PendSV exceptions
mov r5, #0x80000000
str r5, [r0, V7M_SCB_SHPR2] @ set SVC priority
mov r5, #0x00800000
str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority
@ SVC to switch to handler mode. Notice that this requires sp to
@ point to writeable memory because the processor saves
@ some registers to the stack.
badr r1, 1f
ldr r5, [r12, #11 * 4] @ read the SVC vector entry
str r1, [r12, #11 * 4] @ write the temporary SVC vector entry
dsb
mov r6, lr @ save LR
ldr sp, =init_thread_union + THREAD_START_SP
cpsie i
svc #0
1: cpsid i /* Calculate exc_ret */
orr r10, lr, #EXC_RET_THREADMODE_PROCESSSTACK
ldmia sp, {r0-r3, r12}
str r5, [r12, #11 * 4] @ restore the original SVC vector entry
mov lr, r6 @ restore LR
@ Special-purpose control register
mov r1, #1
msr control, r1 @ Thread mode has unpriviledged access
@ Configure the System Control Register to ensure 8-byte stack alignment
@ Note the STKALIGN bit is either RW or RAO.
ldr r0, [r0, V7M_SCB_CCR] @ system control register
orr r0, #V7M_SCB_CCR_STKALIGN
orr r0, r0, r8
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.