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) do {} while (1) |
Set a breakpoint. More... | |
#define | ARCHITECTURE_WORD_BITS <NUM> |
Size of a word in bits. More... | |
#define | ARCHITECTURE_WORD_BYTES <NUM> |
Size of a word in bytes. More... | |
#define | PRIxTXTPTR PRIxPTR |
Format string macro for text section pointer. More... | |
#define | WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES))) |
Type qualifier to use to align data on word boundaries. More... | |
#define | HAS_ALIGNMENT_OF(addr, alignment) (((uintptr_t)(addr) & ((alignment) - 1)) == 0) |
Check if addr is alignment to alignment . More... | |
#define | IS_WORD_ALIGNED(addr) HAS_ALIGNMENT_OF(addr, ARCHITECTURE_WORD_BYTES) |
Check if addr is word-aligned. More... | |
#define | UWORD_MIN 0 |
Smallest number an uword_t can hold. More... | |
#define | UWORD_MAX ((1ULL << ARCHITECTURE_WORD_BITS) - 1) |
Highest number an uword_t can hold. More... | |
#define | SWORD_MIN (-(1LL << (ARCHITECTURE_WORD_BITS - 1))) |
Smallest number an sword_t can hold. More... | |
#define | SWORD_MAX ((1LL << (ARCHITECTURE_WORD_BITS - 1)) - 1) |
Highest number an sword_t can hold. More... | |
Typedefs | |
typedef uint< num > _t | uword_t |
Word sized unsigned integer. More... | |
typedef int< num > _t | sword_t |
Word sized signed integer. More... | |
typedef uintptr_t | uinttxtptr_t |
Pointer type to point anywhere in the .text section. More... | |
#define ARCHITECTURE_BREAKPOINT | ( | value | ) | do {} while (1) |
Set a breakpoint.
[in] | value | Context value for debugger, usually ignored. |
Definition at line 46 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, or 32
Definition at line 56 of file architecture.h.
#define ARCHITECTURE_WORD_BYTES <NUM> |
Size of a word in bytes.
Depending on architecture, this can have a value or 1, 2, or 4.
Definition at line 62 of file architecture.h.
#define HAS_ALIGNMENT_OF | ( | addr, | |
alignment | |||
) | (((uintptr_t)(addr) & ((alignment) - 1)) == 0) |
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 129 of file architecture.h.
#define IS_WORD_ALIGNED | ( | addr | ) | HAS_ALIGNMENT_OF(addr, ARCHITECTURE_WORD_BYTES) |
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 137 of file architecture.h.
#define PRIxTXTPTR PRIxPTR |
Format string macro for text section pointer.
Definition at line 105 of file architecture.h.
#define SWORD_MAX ((1LL << (ARCHITECTURE_WORD_BITS - 1)) - 1) |
Highest number an sword_t can hold.
Definition at line 157 of file architecture.h.
#define SWORD_MIN (-(1LL << (ARCHITECTURE_WORD_BITS - 1))) |
Smallest number an sword_t can hold.
Definition at line 152 of file architecture.h.
#define UWORD_MAX ((1ULL << ARCHITECTURE_WORD_BITS) - 1) |
Highest number an uword_t can hold.
Definition at line 147 of file architecture.h.
#define UWORD_MIN 0 |
Smallest number an uword_t can hold.
Definition at line 142 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 117 of file architecture.h.
typedef int<num> _t sword_t |
Word sized signed integer.
Synonym to int8_t
, int16_t
or int32_t
depending on architecture
Definition at line 79 of file architecture.h.
typedef uintptr_t uinttxtptr_t |
Pointer type to point anywhere in the .text section.
Definition at line 100 of file architecture.h.
typedef uint<num> _t uword_t |
Word sized unsigned integer.
Synonym to uint8_t
, uint16_t
or uint32_t
depending on architecture
Definition at line 69 of file architecture.h.