Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions include/wums/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ typedef enum wums_hook_type_t {
WUMS_HOOK_ALL_APPLICATION_STARTS_DONE,
WUMS_HOOK_ALL_APPLICATION_ENDS_DONE,
WUMS_HOOK_ALL_APPLICATION_REQUESTS_EXIT_DONE,
// Introduced in 0.3.4
WUMS_HOOK_GET_CUSTOM_RPL_ALLOCATOR, // for internal usage only
WUMS_HOOK_CLEAR_ALLOCATED_RPL_MEMORY // for internal usage only
} wums_hook_type_t;

typedef uint32_t (*WUMSRPLAllocatorAllocFn)(int32_t size, int32_t align, void **outAddr);
typedef void (*WUMSRPLAllocatorFreeFn)(void *addr);

typedef struct wums_internal_custom_rpl_allocator_t {
WUMSRPLAllocatorAllocFn allocFn;
WUMSRPLAllocatorFreeFn freeFn;
} wums_internal_custom_rpl_allocator_t;

typedef struct wums_hook_t {
wums_hook_type_t type; /* Defines the type of the hook */
const void *target; /* Address of our own, new function */
Expand Down Expand Up @@ -124,6 +135,16 @@ typedef struct wums_relocs_done_args_t {
WUMS_HOOK_EX(WUMS_HOOK_ALL_APPLICATION_ENDS_DONE, __wums_all_ends_done); \
void __wums_all_ends_done()

#define WUMS_INTERNAL_GET_CUSTOM_RPL_ALLOCATOR() \
wums_internal_custom_rpl_allocator_t __wums_get_custom_rpl_allocator(void); \
WUMS_HOOK_EX(WUMS_HOOK_GET_CUSTOM_RPL_ALLOCATOR, __wums_get_custom_rpl_allocator); \
wums_internal_custom_rpl_allocator_t __wums_get_custom_rpl_allocator()

#define WUMS_INTERNAL_HOOK_CLEAR_ALLOCATED_RPL_MEMORY() \
void __wums_clear_allocated_rpl_memory(void); \
WUMS_HOOK_EX(WUMS_HOOK_CLEAR_ALLOCATED_RPL_MEMORY, __wums_clear_allocated_rpl_memory); \
void __wums_clear_allocated_rpl_memory()

#ifdef __cplusplus
#define __EXTERN_C_MACRO extern "C"
#else
Expand Down
2 changes: 1 addition & 1 deletion include/wums/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
extern "C" {
#endif

#define WUMS_VERSION "0.3.3"
#define WUMS_VERSION "0.3.4"

#define WUMS_MODULE_EXPORT_NAME(__module_name) \
WUMS_META(export_name, __module_name); \
Expand Down
Loading