details More...
details
This module provides architecture-independent access to architecture details.
Files | |
| file | architecture.h |
| Platform-independent access to architecture details. | |
Macros | |
| #define | ARCHITECTURE_BREAKPOINT(value) |
| Set a breakpoint. | |
| #define | ARCHITECTURE_WORD_BITS <NUM> |
| Size of a word in bits. | |
| #define | ARCHITECTURE_WORD_BYTES <ARCHITECTURE_WORD_BITS / 8> |
| Size of a word in bytes. | |
| #define | SWORD_MAX <2^(ARCHITECTURE_WORD_BITS - 1) - 1> |
| Highest number an sword_t can hold. | |
| #define | SWORD_MIN <-2^(ARCHITECTURE_WORD_BITS - 1)> |
| Smallest number an sword_t can hold. | |
| #define | UWORD_MAX <2^ARCHITECTURE_WORD_BITS - 1> |
| Highest number an uword_t can hold. | |
| #define | UWORD_MIN (0U) |
| Smallest number an uword_t can hold. | |
| #define | PRIxTXTPTR PRIxPTR |
| Format string macro for text section pointer. | |
| #define | PRI_SIZE_T_MODIFIER /* implementation defined */ |
| Architecture specific modifier used for printing sizes. | |
| #define | PRIdSIZE PRI_SIZE_T_MODIFIER "d" |
Macro holding the format specifier to print an ssize_t variable in decimal representation. | |
| #define | PRIiSIZE PRI_SIZE_T_MODIFIER "i" |
Macro holding the format specifier to print an ssize_t variable. | |
| #define | PRIoSIZE PRI_SIZE_T_MODIFIER "o" |
Macro holding the format specifier to print an ssize_t variable in octal representation. | |
| #define | PRIuSIZE PRI_SIZE_T_MODIFIER "u" |
Macro holding the format specifier to print an size_t variable in decimal representation. | |
| #define | PRIxSIZE PRI_SIZE_T_MODIFIER "x" |
Macro holding the format specifier to print an size_t variable in hexadecimal representation. | |
| #define | PRIXSIZE PRI_SIZE_T_MODIFIER "X" |
Macro holding the format specifier to print an size_t variable in hexadecimal representation. | |
| #define | WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES))) |
| Type qualifier to use to align data on word boundaries. | |
| #define | HAS_ALIGNMENT_OF(addr, alignment) |
Check if addr is alignment to alignment. | |
| #define | IS_WORD_ALIGNED(addr) |
Check if addr is word-aligned. | |
Typedefs | |
| typedef uint< NUM > _t | uword_t |
| Word sized unsigned integer. | |
| typedef int< NUM > _t | sword_t |
| Word sized signed integer. | |
| typedef uintptr_t | uinttxtptr_t |
| Pointer type to point anywhere in the .text section. | |
| #define ARCHITECTURE_BREAKPOINT | ( | value | ) |
Set a breakpoint.
| [in] | value | Context value for debugger, usually ignored. |
Definition at line 43 of file architecture.h.
| #define ARCHITECTURE_WORD_BITS <NUM> |
Size of a word in bits.
Depending on architecture, this can have a value of 8, 16, 32, or 64
Definition at line 53 of file architecture.h.
| #define ARCHITECTURE_WORD_BYTES <ARCHITECTURE_WORD_BITS / 8> |
Size of a word in bytes.
Depending on architecture, this can have a value or 1, 2, 4, or 8.
Definition at line 59 of file architecture.h.
| #define HAS_ALIGNMENT_OF | ( | addr, | |
| alignment ) |
Check if addr is alignment to alignment.
| [in] | addr | Address to check for being aligned |
| [in] | alignment | Alignment to check for |
alignment is a power of two. (But this is naturally fulfilled, as all possible alignment requirements in C are powers of two.) | 1 | addr is aligned to alignment |
| 0 | addr is unaligned |
Definition at line 234 of file architecture.h.
| #define IS_WORD_ALIGNED | ( | addr | ) |
Check if addr is word-aligned.
| [in] | addr | Address to check for word alignment |
| 1 | addr is word-aligned |
| 0 | addr is unaligned |
Definition at line 242 of file architecture.h.
| #define PRI_SIZE_T_MODIFIER /* implementation defined */ |
Architecture specific modifier used for printing sizes.
Definition at line 164 of file architecture.h.
| #define PRIdSIZE PRI_SIZE_T_MODIFIER "d" |
Macro holding the format specifier to print an ssize_t variable in decimal representation.
Definition at line 177 of file architecture.h.
| #define PRIiSIZE PRI_SIZE_T_MODIFIER "i" |
Macro holding the format specifier to print an ssize_t variable.
Same as PRIdSIZE for output. When used for input (e.g. in scanf()), PRIiSIZE will also accept hexadecimal and octal numbers if prefixed by 0x or 0, respectively.
Definition at line 185 of file architecture.h.
| #define PRIoSIZE PRI_SIZE_T_MODIFIER "o" |
Macro holding the format specifier to print an ssize_t variable in octal representation.
Definition at line 190 of file architecture.h.
| #define PRIuSIZE PRI_SIZE_T_MODIFIER "u" |
Macro holding the format specifier to print an size_t variable in decimal representation.
Definition at line 195 of file architecture.h.
| #define PRIXSIZE PRI_SIZE_T_MODIFIER "X" |
Macro holding the format specifier to print an size_t variable in hexadecimal representation.
Same as PRIxSIZE for input, but uses uppercase letters for output (e.g. 2A for 42).
Definition at line 211 of file architecture.h.
| #define PRIxSIZE PRI_SIZE_T_MODIFIER "x" |
Macro holding the format specifier to print an size_t variable in hexadecimal representation.
Same as PRIXSIZE for input, but uses lowercase letters for output (e.g. 2a for 42).
Definition at line 203 of file architecture.h.
| #define PRIxTXTPTR PRIxPTR |
Format string macro for text section pointer.
Definition at line 157 of file architecture.h.
| #define SWORD_MAX <2^(ARCHITECTURE_WORD_BITS - 1) - 1> |
Highest number an sword_t can hold.
Definition at line 80 of file architecture.h.
| #define SWORD_MIN <-2^(ARCHITECTURE_WORD_BITS - 1)> |
Smallest number an sword_t can hold.
Definition at line 84 of file architecture.h.
| #define UWORD_MAX <2^ARCHITECTURE_WORD_BITS - 1> |
Highest number an uword_t can hold.
Definition at line 88 of file architecture.h.
| #define UWORD_MIN (0U) |
Smallest number an uword_t can hold.
Definition at line 146 of file architecture.h.
| #define WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES))) |
Type qualifier to use to align data on word boundaries.
Use like this:
Definition at line 222 of file architecture.h.
| typedef int<NUM> _t sword_t |
Word sized signed integer.
Synonym to int8_t, int16_t, int32_t, or int64_t depending on architecture
Definition at line 76 of file architecture.h.
| typedef uintptr_t uinttxtptr_t |
Pointer type to point anywhere in the .text section.
Definition at line 152 of file architecture.h.
| typedef uint<NUM> _t uword_t |
Word sized unsigned integer.
Synonym to uint8_t, uint16_t, uint32_t, or uint64_t depending on architecture
Definition at line 66 of file architecture.h.