Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
RISCV-Specific constants for ELF binaries. More...
Go to the source code of this file.
Macros | |
#define | R_RISCV_IMM8_GET_BIT(imm8, bit) (((imm8) & BIT(bit)) >> (bit)) |
Relocation names for RISCV-specific relocations. | |
#define | R_RISCV_BTYPE_IMM8_MASK(imm8) |
Generate mask for immediate in B-type RISC-V instruction. | |
#define | R_RISCV_JTYPE_IMM8_MASK(imm8) |
Generate mask for immediate in J-type RISC-V instruction. | |
#define | R_RISCV_STYPE_IMM8_MASK(imm8) |
Generate mask for immediate in S-type RISC-V instruction. | |
#define | R_RISCV_CJTYPE_IMM8_MASK(imm8) |
Generate mask for immediate in compressed J-type RISC-V instruction. | |
#define | R_RISCV_CBTYPE_IMM8_MASK(imm8) |
Generate mask for immediate in compressed B-type RISC-V instruction. | |
#define | R_RISCV_CLEAR_BTYPE_IMM8(operand) ((operand) & ~R_RISCV_BTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in B-type instruction. | |
#define | R_RISCV_SET_BTYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_BTYPE_IMM8(operand)) | R_RISCV_BTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in B-type instruction. | |
#define | R_RISCV_CLEAR_JTYPE_IMM8(operand) ((operand) & ~R_RISCV_JTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in J-type instruction. | |
#define | R_RISCV_SET_JTYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_JTYPE_IMM8(operand)) | R_RISCV_JTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in J-type instruction. | |
#define | R_RISCV_CLEAR_STYPE_IMM8(operand) ((operand) & ~R_RISCV_STYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in S-type instruction. | |
#define | R_RISCV_SET_STYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_STYPE_IMM8(operand)) | R_RISCV_STYPE_IMM8_MASK(imm8)) |
Overwrite immediate in S-type instruction. | |
#define | R_RISCV_CLEAR_CJTYPE_IMM8(operand) ((operand) & ~R_RISCV_CJTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in compressed J-type instruction. | |
#define | R_RISCV_SET_CJTYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_CJTYPE_IMM8(operand)) | R_RISCV_CJTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in compressed J-type instruction. | |
#define | R_RISCV_CLEAR_CBTYPE_IMM8(operand) ((operand) & ~R_RISCV_CBTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in compressed B-type instruction. | |
#define | R_RISCV_SET_CBTYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_CBTYPE_IMM8(operand)) | R_RISCV_CBTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in compressed B-type instruction. | |
#define | R_RISCV_CLEAR_UTYPE_IMM8(operand) ((operand) & ~(0xFFFFF000)) |
Clear immediate bits in U-type instruction. | |
#define | R_RISCV_SET_UTYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_UTYPE_IMM8(operand)) | ((imm8) & 0xFFFFF000)) |
Overwrite immediate in U-type instruction. | |
#define | R_RISCV_CLEAR_ITYPE_IMM8(operand) ((operand) & ~(0xFFF00000)) |
Clear immediate bits in I-type instruction. | |
#define | R_RISCV_SET_ITYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_ITYPE_IMM8(operand)) | ((imm8) << 20)) |
Overwrite immediate in I-type instruction. | |
RISCV-Specific constants for ELF binaries.
References can be found here: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
#define R_RISCV_BTYPE_IMM8_MASK | ( | imm8 | ) |
Generate mask for immediate in B-type RISC-V instruction.
imm8 | immediate value, lower 12 bits used; due to alignment requirements, imm8[0] is implicitly 0 |
#define R_RISCV_CBTYPE_IMM8_MASK | ( | imm8 | ) |
Generate mask for immediate in compressed B-type RISC-V instruction.
imm8 | immediate value, lower 9 bits used; due to alignment requirements, imm8[0] is implicitly 0 |
#define R_RISCV_CJTYPE_IMM8_MASK | ( | imm8 | ) |
Generate mask for immediate in compressed J-type RISC-V instruction.
imm8 | immediate value, lower 12 bits used; due to alignment requirements, imm8[0] is implicitly 0 |
#define R_RISCV_CLEAR_BTYPE_IMM8 | ( | operand | ) | ((operand) & ~R_RISCV_BTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in B-type instruction.
operand | Address of RISC-V instruction, B-type |
#define R_RISCV_CLEAR_CBTYPE_IMM8 | ( | operand | ) | ((operand) & ~R_RISCV_CBTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in compressed B-type instruction.
operand | Address of RISC-V instruction, compressed-B-type |
#define R_RISCV_CLEAR_CJTYPE_IMM8 | ( | operand | ) | ((operand) & ~R_RISCV_CJTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in compressed J-type instruction.
operand | Address of RISC-V instruction, compressed-J-type |
#define R_RISCV_CLEAR_ITYPE_IMM8 | ( | operand | ) | ((operand) & ~(0xFFF00000)) |
Clear immediate bits in I-type instruction.
operand | Address of RISC-V instruction, I-type |
#define R_RISCV_CLEAR_JTYPE_IMM8 | ( | operand | ) | ((operand) & ~R_RISCV_JTYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in J-type instruction.
operand | Address of RISC-V instruction, J-type |
#define R_RISCV_CLEAR_STYPE_IMM8 | ( | operand | ) | ((operand) & ~R_RISCV_STYPE_IMM8_MASK((uint32_t) -1)) |
Clear immediate bits in S-type instruction.
operand | Address of RISC-V instruction, S-type |
#define R_RISCV_CLEAR_UTYPE_IMM8 | ( | operand | ) | ((operand) & ~(0xFFFFF000)) |
Clear immediate bits in U-type instruction.
operand | Address of RISC-V instruction, U-type |
#define R_RISCV_IMM8_GET_BIT | ( | imm8, | |
bit | |||
) | (((imm8) & BIT(bit)) >> (bit)) |
Relocation names for RISCV-specific relocations.
"wordclass" from RISC-V specification
Extract bit from immediate
imm8 | immediate value (usually upper 20 or lower 12 bit) |
bit | which bit to extract |
#define R_RISCV_JTYPE_IMM8_MASK | ( | imm8 | ) |
Generate mask for immediate in J-type RISC-V instruction.
imm8 | immediate value, lower 21 bits used; due to alignment requirements, imm8[0] is implicitly 0 |
#define R_RISCV_SET_BTYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_BTYPE_IMM8(operand)) | R_RISCV_BTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in B-type instruction.
operand | Address of RISC-V instruction, B-type |
imm8 | New immediate |
#define R_RISCV_SET_CBTYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_CBTYPE_IMM8(operand)) | R_RISCV_CBTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in compressed B-type instruction.
operand | Address of RISC-V instruction, compressed-B-type |
imm8 | New immediate |
#define R_RISCV_SET_CJTYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_CJTYPE_IMM8(operand)) | R_RISCV_CJTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in compressed J-type instruction.
operand | Address of RISC-V instruction, compressed-J-type |
imm8 | New immediate |
#define R_RISCV_SET_ITYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_ITYPE_IMM8(operand)) | ((imm8) << 20)) |
Overwrite immediate in I-type instruction.
operand | Address of RISC-V instruction, I-type |
imm8 | New immediate |
#define R_RISCV_SET_JTYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_JTYPE_IMM8(operand)) | R_RISCV_JTYPE_IMM8_MASK(imm8)) |
Overwrite immediate in J-type instruction.
operand | Address of RISC-V instruction, J-type |
imm8 | New immediate |
#define R_RISCV_SET_STYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_STYPE_IMM8(operand)) | R_RISCV_STYPE_IMM8_MASK(imm8)) |
Overwrite immediate in S-type instruction.
operand | Address of RISC-V instruction, S-type |
imm8 | New immediate |
#define R_RISCV_SET_UTYPE_IMM8 | ( | operand, | |
imm8 | |||
) | ((R_RISCV_CLEAR_UTYPE_IMM8(operand)) | ((imm8) & 0xFFFFF000)) |
Overwrite immediate in U-type instruction.
operand | Address of RISC-V instruction, U-type |
imm8 | New immediate |
#define R_RISCV_STYPE_IMM8_MASK | ( | imm8 | ) |
Generate mask for immediate in S-type RISC-V instruction.
imm8 | immediate value, lower 12 bits used |