source: rtems/cpukit/score/cpu/aarch64/include/rtems/asm.h @ 5f652cb2

Last change on this file since 5f652cb2 was 5f652cb2, checked in by Kinsey Moore <kinsey.moore@…>, on 07/26/21 at 20:43:00

cpukit: Add AArch64 SMP Support

This adds SMP support for AArch64 in cpukit and for the ZynqMP BSPs.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @brief AArch64 Assembler Support API
7 *
8 * This include file attempts to address the problems
9 * caused by incompatible flavors of assemblers and
10 * toolsets.  It primarily addresses variations in the
11 * use of leading underscores on symbols and the requirement
12 * that register names be preceded by a %.
13 *
14 *
15 * NOTE: The spacing in the use of these macros
16 *       is critical to them working as advertised.
17 */
18
19/*
20 * Copyright (C) 2020 On-Line Applications Research Corporation (OAR)
21 * Written by Kinsey Moore <kinsey.moore@oarcorp.com>
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 *    notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 *    notice, this list of conditions and the following disclaimer in the
30 *    documentation and/or other materials provided with the distribution.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE.
43 */
44
45#ifndef _RTEMS_ASM_H
46#define _RTEMS_ASM_H
47
48/*
49 *  Indicate we are in an assembly file and get the basic CPU definitions.
50 */
51
52#ifndef ASM
53#define ASM
54#endif
55#include <rtems/score/percpu.h>
56
57/**
58 * @defgroup RTEMSScoreCPUAArch64ASM AArch64 Assembler Support
59 *
60 * @ingroup RTEMSScoreCPUAArch64
61 *
62 * @brief AArch64 Assembler Support
63 */
64/**@{**/
65
66/*
67 *  Following must be tailor for a particular flavor of the C compiler.
68 *  They may need to put underscores in front of the symbols.
69 */
70
71#define FUNCTION_ENTRY(name) \
72  .align 8; \
73  .globl name; \
74  .type name, %function; \
75  name:
76
77#define FUNCTION_END(name) \
78  .size name, . - name
79
80#define DEFINE_FUNCTION_AARCH64(name) \
81  .align 8 ; .globl name ; name: ; .globl name ## _aarch64 ; name ## _aarch64:
82
83.macro GET_SELF_CPU_CONTROL REG
84#ifdef RTEMS_SMP
85        /* Use Thread ID Register (TPIDR_EL1) */
86        mrs     \REG, TPIDR_EL1
87#else
88        ldr     \REG, =_Per_CPU_Information
89#endif
90.endm
91
92/** @} */
93
94#endif /* _RTEMS_ASM_H */
Note: See TracBrowser for help on using the repository browser.