blob: 9e7c8a24da093a91a0f089488ff32ab9318ad679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
.. SPDX-License-Identifier: GPL-2.0+
Global data
===========
Globally required fields are held in the global data structure. A pointer to the
structure is available as symbol gd. The symbol is made available by the macro
%DECLARE_GLOBAL_DATA_PTR.
Register pointing to global data
--------------------------------
On most architectures the global data pointer is stored in a register.
+------------+----------+
| ARC | r25 |
+------------+----------+
| ARM 32bit | r9 |
+------------+----------+
| ARM 64bit | x18 |
+------------+----------+
| M68000 | d7 |
+------------+----------+
| MicroBlaze | r31 |
+------------+----------+
| NDS32 | r10 |
+------------+----------+
| Nios II | gp |
+------------+----------+
| PowerPC | r2 |
+------------+----------+
| RISC-V | gp (x3) |
+------------+----------+
| SuperH | r13 |
+------------+----------+
The sandbox, x86, and Xtensa are notable exceptions.
Clang for ARM does not support assigning a global register. When using Clang
gd is defined as an inline function using assembly code. This adds a few bytes
to the code size.
Binaries called by U-Boot are not aware of the register usage and will not
conserve gd. UEFI binaries call the API provided by U-Boot and may return to
U-Boot. The value of gd has to be saved every time U-Boot is left and restored
whenever U-Boot is reentered. This is also relevant for the implementation of
function tracing. For setting the value of gd function set_gd() can be used.
Global data structure
---------------------
.. kernel-doc:: include/asm-generic/global_data.h
:internal:
|