This source file includes following definitions.
- mca_patcher_base_addr_text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef OPAL_PATCHER_BASE_H
24 #define OPAL_PATCHER_BASE_H
25
26 #include "opal_config.h"
27 #include "opal/mca/base/mca_base_framework.h"
28 #include "opal/mca/patcher/patcher.h"
29
30
31 BEGIN_C_DECLS
32
33 #define MCA_BASE_PATCHER_MAX_PATCH 32
34
35 struct mca_patcher_base_patch_t;
36
37 typedef void (*mca_patcher_base_restore_fn_t) (struct mca_patcher_base_patch_t *);
38
39 struct mca_patcher_base_patch_t {
40
41 opal_list_item_t super;
42
43 char *patch_symbol;
44
45 uintptr_t patch_value;
46
47 uintptr_t patch_orig;
48
49 unsigned char patch_data[MCA_BASE_PATCHER_MAX_PATCH];
50
51 unsigned char patch_orig_data[MCA_BASE_PATCHER_MAX_PATCH];
52
53 unsigned patch_data_size;
54
55 mca_patcher_base_restore_fn_t patch_restore;
56 };
57
58 typedef struct mca_patcher_base_patch_t mca_patcher_base_patch_t;
59
60 OBJ_CLASS_DECLARATION(mca_patcher_base_patch_t);
61
62
63
64
65 OPAL_DECLSPEC extern mca_base_framework_t opal_patcher_base_framework;
66 OPAL_DECLSPEC int opal_patcher_base_select (void);
67 OPAL_DECLSPEC int mca_patcher_base_patch_hook (mca_patcher_base_module_t *module, uintptr_t hook);
68 OPAL_DECLSPEC void mca_base_patcher_patch_apply_binary (mca_patcher_base_patch_t *patch);
69
70 static inline uintptr_t mca_patcher_base_addr_text (uintptr_t addr) {
71 #if (OPAL_ASSEMBLY_ARCH == OPAL_POWERPC64) && (!defined (_CALL_ELF) || (_CALL_ELF != 2))
72 struct odp_t {
73 uintptr_t text;
74 uintptr_t toc;
75 } *odp = (struct odp_t *) addr;
76 return (odp)?odp->text:0;
77 #else
78 return addr;
79 #endif
80 }
81
82 END_C_DECLS
83 #endif