cpu_data.S 1.07 KB
Newer Older
1
2
3
/*
 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 */

#include <asm_macros.S>
#include <cpu_data.h>

	.globl	_cpu_data
	.globl	_cpu_data_by_index

/* -----------------------------------------------------------------
 * cpu_data_t *_cpu_data(void)
 *
 * Return the cpu_data structure for the current CPU.
 * -----------------------------------------------------------------
 */
func _cpu_data
20
21
	/* r12 is pushed to meet the 8 byte stack alignment requirement */
	push	{r12, lr}
22
	bl	plat_my_core_pos
23
	pop	{r12, lr}
24
25
26
27
28
29
30
31
32
33
34
35
36
	b	_cpu_data_by_index
endfunc _cpu_data

/* -----------------------------------------------------------------
 * cpu_data_t *_cpu_data_by_index(uint32_t cpu_index)
 *
 * Return the cpu_data structure for the CPU with given linear index
 *
 * This can be called without a valid stack.
 * clobbers: r0, r1
 * -----------------------------------------------------------------
 */
func _cpu_data_by_index
37
38
	mov_imm	r1, CPU_DATA_SIZE
	mul	r0, r0, r1
39
	ldr	r1, =percpu_data
40
	add	r0, r0, r1
41
42
	bx	lr
endfunc _cpu_data_by_index