coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
registers.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __ARCH_REGISTERS_H
4 #define __ARCH_REGISTERS_H
5 
6 #if !defined(__ASSEMBLER__)
7 #include <stdint.h>
8 
9 #define LONG_DOWNTO8(A) \
10  union { \
11  struct { \
12  union { \
13  struct { \
14  uint8_t A##l; \
15  uint8_t A##h; \
16  } __packed; \
17  uint16_t A##x; \
18  } __packed; \
19  uint16_t h##A##x; \
20  } __packed; \
21  uint32_t e##A##x; \
22  } __packed;
23 
24 #define LONG_DOWNTO16(A) \
25  union { \
26  struct { \
27  uint16_t A; \
28  uint16_t h##A; \
29  } __packed; \
30  uint32_t e##A; \
31  } __packed;
32 
33 #define QUAD_DOWNTO8(A) \
34  union { \
35  LONG_DOWNTO8(A) \
36  uint64_t r##A##x; \
37  } __packed
38 
39 #define QUAD_DOWNTO16(A) \
40  union {\
41  LONG_DOWNTO16(A) \
42  uint64_t r##A; \
43  } __packed
44 
45 #if ENV_X86_64
46 struct eregs {
47  QUAD_DOWNTO8(a);
48  QUAD_DOWNTO8(c);
49  QUAD_DOWNTO8(d);
50  QUAD_DOWNTO8(b);
51  QUAD_DOWNTO16(bp);
52  QUAD_DOWNTO16(si);
53  QUAD_DOWNTO16(di);
54  uint64_t r8;
55  uint64_t r9;
56  uint64_t r10;
57  uint64_t r11;
58  uint64_t r12;
59  uint64_t r13;
60  uint64_t r14;
61  uint64_t r15;
64  uint64_t rip;
65  uint64_t cs;
66  uint64_t rflags;
67  QUAD_DOWNTO16(sp);
68  uint64_t ss;
69 };
70 #else
71 struct eregs {
85 };
86 #endif
87 #endif // !ASSEMBLER
88 
89 #if CONFIG(COMPILER_LLVM_CLANG)
90 #define ADDR32(opcode) opcode
91 #else
92 #define ADDR32(opcode) addr32 opcode
93 #endif
94 
95 #endif
#define QUAD_DOWNTO8(A)
Definition: registers.h:33
#define QUAD_DOWNTO16(A)
Definition: registers.h:39
unsigned int uint32_t
Definition: stdint.h:14
unsigned long long uint64_t
Definition: stdint.h:17
uint32_t eflags
Definition: registers.h:84
uint32_t eip
Definition: registers.h:82
LONG_DOWNTO8(a)
uint32_t vector
Definition: registers.h:80
uint32_t cs
Definition: registers.h:83
LONG_DOWNTO16(sp)
LONG_DOWNTO16(si)
uint32_t error_code
Definition: registers.h:81
LONG_DOWNTO8(b)
LONG_DOWNTO8(c)
LONG_DOWNTO16(di)
LONG_DOWNTO8(d)
LONG_DOWNTO16(bp)
#define c(value, pmcreg, dst_bits)