1 #ifndef ST_OS_CALLBACK_H
2 #define ST_OS_CALLBACK_H
4 #include <magic_analysis.h>
6 /* Callback type definitions and call registration helpers. */
8 #define CALLBACK_PREFIX st
9 #define CALLBACK_FAMILY os
10 #include <st/cb_template.h>
12 DEFINE_DECL_CALLBACK(void, panic
, (const char *fmt
, ...));
13 DEFINE_DECL_CALLBACK(int, old_state_table_lookup
, (void *state_info_opaque
, void *vars
));
14 DEFINE_DECL_CALLBACK(int, copy_state_region
, (void *state_info_opaque
, uint32_t address
, size_t size
, uint32_t dst_address
));
15 DEFINE_DECL_CALLBACK(void *, alloc_contig
, (size_t len
, int flags
, uint32_t *phys
));
16 DEFINE_DECL_CALLBACK(int, free_contig
, (void *ptr
, size_t length
));
17 DEFINE_DECL_CALLBACK(const char *, debug_header
, (void));
19 /* Default callback values. */
20 #define ST_CB_OS_PANIC_EMPTY NULL
21 #define ST_CB_OS_OLD_STATE_TABLE_LOOKUP_EMPTY NULL
22 #define ST_CB_OS_COPY_STATE_REGION_EMPTY NULL
23 #define ST_CB_OS_ALLOC_CONTIG_EMPTY NULL
24 #define ST_CB_OS_FREE_CONTIG_EMPTY NULL
25 #define ST_CB_OS_DEBUG_HEADER_EMPTY NULL
28 CALLBACK_TYPENAME(panic
) panic
;
29 CALLBACK_TYPENAME(old_state_table_lookup
) old_state_table_lookup
;
30 CALLBACK_TYPENAME(copy_state_region
) copy_state_region
;
31 CALLBACK_TYPENAME(alloc_contig
) alloc_contig
;
32 CALLBACK_TYPENAME(free_contig
) free_contig
;
33 CALLBACK_TYPENAME(debug_header
) debug_header
;
36 /* General callback registration helper. */
37 PUBLIC
void st_setcb_os_all(struct st_cbs_os_t
*cbs
);
39 #endif /* ST_OS_CALLBACK_H */