SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions
elf_helpers.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <types.h>
#include <elf.h>
Include dependency graph for elf_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ELF_GEN_FIELD_GET_SET(__s, __field, __type)
 
#define ELF_STRUCT_SIZE(__s)
 

Functions

static u8 fw_elf_get_class (u32 elf_fw_addr)
 
static void elf_hdr_init_ident (struct elf32_hdr *hdr, u8 class)
 

Macro Definition Documentation

◆ ELF_GEN_FIELD_GET_SET

#define ELF_GEN_FIELD_GET_SET (   __s,
  __field,
  __type 
)
Value:
static inline __type elf_##__s##_get_##__field(u8 class, const void *arg) { \
if (class == ELFCLASS32) \
return (__type) ((const struct elf32_##__s *) arg)->__field; \
else \
return (__type) ((const struct elf64_##__s *) arg)->__field; \
} \
static inline void elf_##__s##_set_##__field(u8 class, void *arg, __type value) { \
if (class == ELFCLASS32) \
((struct elf32_##__s *) arg)->__field = (__type) value; \
else \
((struct elf64_##__s *) arg)->__field = (__type) value; \
}
#define ELFCLASS32
Definition elf.h:349
static uint8_t value
Definition io.h:144
unsigned char u8
Definition types.h:33

◆ ELF_STRUCT_SIZE

#define ELF_STRUCT_SIZE (   __s)
Value:
static inline unsigned long elf_size_of_##__s(u8 class) { \
if (class == ELFCLASS32) \
return sizeof(struct elf32_##__s); \
else \
return sizeof(struct elf64_##__s); \
}

Function Documentation

◆ elf_hdr_init_ident()

static void elf_hdr_init_ident ( struct elf32_hdr hdr,
u8  class 
)
inlinestatic

◆ fw_elf_get_class()

static u8 fw_elf_get_class ( u32  elf_fw_addr)
inlinestatic