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