Debian Codegraph @

src/soc/nvidia/tegra210/stack.S

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 /* Macro to initialize stack, perform seeding if required and finally call the
4 * function provided
5 * @stack_top : First address above the stack
6 * @stack_bottom : Lowest address on the stack
7 * @seed : Stack seeding required (1=yes/otherwise=no)
8 * @func : Function to call after initializing stack
9 */
10 .macro stack_init stack_top, stack_bottom, seed, func
11 /* Check if stack seeding is required */
12 mov r0, #\seed
13 cmp r0, #1
14 bne call_func
15 /* Stack seeding */
16 ldr r0, =\stack_bottom
17 ldr r1, =\stack_top
18 ldr r2, =0xdeadbeef
19 init_stack_loop:
20 str r2, [r0]
21 add r0, #4
22 cmp r0, r1
23 bne init_stack_loop
24
25 call_func:
26 ldr sp, =\stack_top /* Set up stack pointer */
27 bl \func
28 .endm