avmpack.c
Include dependency graph for avmpack.c:
Defines
-
AVMPACK_SIZE 24
Functions
-
static inline int pad(int size)
-
int avmpack_is_valid(const void *avmpack_binary, uint32_t size)
Returns 1 if the pointed binary is a valid AVM Pack.
Returns if the pointed binary is a valid AVM Pack binary or not.
- Parameters:
avmpack_binary – a pointer to an AVM Pack binary.
size – the size of AVM Pack binary.
- Returns:
1 if it is a valid AVM Pack binary, 0 otherwise.
-
int avmpack_find_section_by_flag(const void *avmpack_binary, uint32_t flags_mask, const void **ptr, uint32_t *size, const char **name)
Finds an AVM Pack section that has certain flags set.
Finds an AVM Pack section that has certain flags set and returns a pointer to it, its size and its name.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
flags_mask – that will be matched against file sections.
ptr – will point to the found file section.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
name – the section name, as defined in the module header.
- Returns:
1 if the file section has been found, 0 otherwise.
-
int avmpack_find_section_by_name(const void *avmpack_binary, const char *name, const void **ptr, uint32_t *size)
Finds an AVM Pack section that has certain name.
Finds an AVM Pack section with a certain name and returns a pointer to it and its size.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
name – the file section name that will be searched.
ptr – will point to the found file section, if the section has not been found it will not be updated.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
- Returns:
1 if the file section has been found, 0 otherwise.
-
void *avmpack_fold(void *accum, const void *avmpack_binary, avmpack_fold_fun fold_fun)
Fold over all the sections in an AVM Pack.
This function will call the callback on each section of the AVM Pack, passing in the current section of each module in the AVM binary to the supplied fold function.
- Parameters:
accum – The accumulator supplied by the application.
avmpack_binary – a pointer to an AVM Pack binary.
fold_fun – function that will be called for each AVM section.
-
static void in_memory_avm_pack_destructor(struct AVMPackData *obj, GlobalContext *global)
-
static void const_avm_pack_destructor(struct AVMPackData *obj, GlobalContext *global)
Variables
-
const struct AVMPackInfo in_memory_avm_pack_info = {.destructor = in_memory_avm_pack_destructor}
-
const struct AVMPackInfo const_avm_pack_info = {.destructor = const_avm_pack_destructor}