-
Notifications
You must be signed in to change notification settings - Fork 8.2k
arch: arm: move stack switching back to ASM code #16099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
| _ASM_FILE_PROLOGUE | ||
|
|
||
| GTEXT(__reset) | ||
| GTEXT(memset) | ||
| GDATA(_interrupt_stack) | ||
| #if defined(CONFIG_PLATFORM_SPECIFIC_INIT) | ||
| GTEXT(_PlatformInit) | ||
| #endif | ||
|
|
@@ -61,12 +63,46 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start) | |
| #endif | ||
|
|
||
| /* lock interrupts: will get unlocked when switch to main task */ | ||
| bl lock_interrupts | ||
| #if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) | ||
| cpsid i | ||
| #elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) | ||
| movs.n r0, #_EXC_IRQ_DEFAULT_PRIO | ||
| msr BASEPRI, r0 | ||
| #else | ||
| #error Unknown ARM architecture | ||
| #endif | ||
|
|
||
| #ifdef CONFIG_WDOG_INIT | ||
| /* board-specific watchdog initialization is necessary */ | ||
| bl _WdogInit | ||
| #endif | ||
|
|
||
| #ifdef CONFIG_INIT_STACKS | ||
|
||
| ldr r0, =_interrupt_stack | ||
| ldr r1, =0xaa | ||
| ldr r2, =CONFIG_ISR_STACK_SIZE | ||
ioannisg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| bl memset | ||
| #endif | ||
|
|
||
| /* | ||
| * Set PSP and use it to boot without using MSP, so that it | ||
| * gets set to _interrupt_stack during initialization. | ||
| */ | ||
| ldr r0, =_interrupt_stack | ||
| ldr r1, =CONFIG_ISR_STACK_SIZE | ||
ioannisg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| adds r0, r0, r1 | ||
| msr PSP, r0 | ||
| mrs r0, CONTROL | ||
| movs r1, #2 | ||
|
||
| orrs r0, r1 /* CONTROL_SPSEL_Msk */ | ||
| msr CONTROL, r0 | ||
| /* | ||
| * When changing the stack pointer, software must use an ISB instruction | ||
| * immediately after the MSR instruction. This ensures that instructions | ||
| * after the ISB instruction execute using the new stack pointer. | ||
| */ | ||
| isb | ||
|
|
||
| /* | ||
| * 'bl' jumps the furthest of the branch instructions that are | ||
| * supported on all platforms. So it is used when jumping to _PrepC | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.