VirtualBox

source: vbox/trunk/include/iprt/asmdefs-arm.h@ 100275

最後變更 在這個檔案從100275是 100275,由 vboxsync 提交於 21 月 前

VBoxDef2LazyLoad,iprt/asmdefs-arm.h: Added a NAME() macro to asdefs-arm.h and got rid of the RTLDRFMT stuff added in r157968. bugref:10457

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.4 KB
 
1/** @file
2 * IPRT - ARM Specific Assembly Macros.
3 */
4
5/*
6 * Copyright (C) 2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.alldomusa.eu.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_asmdefs_arm_h
37#define IPRT_INCLUDED_asmdefs_arm_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#if !defined(RT_ARCH_ARM64) && !defined(RT_ARCH_ARM32)
43# error "Not on ARM64 or ARM32"
44#endif
45
46/** @defgroup grp_rt_asmdefs_arm ARM Specific ASM (Clang and gcc) Macros
47 * @ingroup grp_rt_asm
48 * @{
49 */
50
51/** @todo Should the selection be done by object format (ELF, MachO, ...) maybe?. */
52
53/** Marks the beginning of a code section. */
54#if defined(__clang__)
55# define BEGINCODE .section __TEXT,__text,regular,pure_instructions
56#elif defined(__GNUC__)
57# define BEGINCODE .section .text
58#else
59# error "Port me!"
60#endif
61
62/** Marks the end of a code section. */
63#if defined(__clang__)
64# define ENDCODE
65#elif defined(__GNUC__)
66# define ENDCODE
67#else
68# error "Port me!"
69#endif
70
71
72/** Marks the beginning of a data section. */
73#if defined(__clang__)
74# define BEGINDATA .section __DATA,__data
75#elif defined(__GNUC__)
76# define BEGINDATA .section .data
77#else
78# error "Port me!"
79#endif
80
81/** Marks the end of a data section. */
82#if defined(__clang__)
83# define ENDDATA
84#elif defined(__GNUC__)
85# define ENDDATA
86#else
87# error "Port me!"
88#endif
89
90
91/** Marks the beginning of a readonly data section. */
92#if defined(__clang__)
93# define BEGINCONST .section __RODATA,__rodata
94#elif defined(__GNUC__)
95# define BEGINCONST .section .rodata
96#else
97# error "Port me!"
98#endif
99
100/** Marks the end of a readonly data section. */
101#if defined(__clang__)
102# define ENDCONST
103#elif defined(__GNUC__)
104# define ENDCONST
105#else
106# error "Port me!"
107#endif
108
109
110/** Marks the beginning of a readonly C strings section. */
111#if defined(__clang__)
112# define BEGINCONSTSTRINGS .section __TEXT,__cstring,cstring_literals
113#elif defined(__GNUC__)
114# define BEGINCONSTSTRINGS .section .rodata
115#else
116# error "Port me!"
117#endif
118
119/** Marks the end of a readonly C strings section. */
120#if defined(__clang__)
121# define ENDCONSTSTRINGS
122#elif defined(__GNUC__)
123# define ENDCONSTSTRINGS
124#else
125# error "Port me!"
126#endif
127
128
129/**
130 * Mangles the name so it can be referenced using DECLASM() in the C/C++ world.
131 *
132 * @returns a_SymbolC with the necessary prefix/postfix.
133 * @param a_SymbolC A C symbol name to mangle as needed.
134 */
135#if defined(RT_OS_DARWIN)
136# define NAME(a_SymbolC) _ ## a_SymbolC
137#else
138# define NAME(a_SymbolC) a_SymbolC
139#endif
140
141/**
142 * Returns the page address of the given symbol (used with the adrp instruction primarily).
143 *
144 * @returns Page aligned address of the given symbol
145 * @param a_Symbol The symbol to get the page address from.
146 */
147#if defined(__clang__)
148# define PAGE(a_Symbol) a_Symbol ## @PAGE
149#elif defined(__GNUC__)
150# define PAGE(a_Symbol) a_Symbol
151#else
152# error "Port me!"
153#endif
154
155/**
156 * Returns the offset inside the page of the given symbol.
157 *
158 * @returns Page offset of the given symbol inside a page.
159 * @param a_Symbol The symbol to get the page offset from.
160 */
161#if defined(__clang__)
162# define PAGEOFF(a_Symbol) a_Symbol ## @PAGEOFF
163#elif defined(__GNUC__)
164# define PAGEOFF(a_Symbol) :lo12: ## a_Symbol
165#else
166# error "Port me!"
167#endif
168
169
170/** @} */
171
172#endif /* !IPRT_INCLUDED_asmdefs_arm_h */
173
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette