Put the function type into a proper enum

This commit is contained in:
Maschell 2020-06-13 14:06:09 +02:00
parent 4464f5b5af
commit b962869a34

View File

@ -75,8 +75,10 @@ typedef enum function_replacement_library_type_t {
#define MAXIMUM_FUNCTION_NAME_LENGTH 100 #define MAXIMUM_FUNCTION_NAME_LENGTH 100
#define FUNCTION_PATCHER_METHOD_STORE_SIZE 40 #define FUNCTION_PATCHER_METHOD_STORE_SIZE 40
#define STATIC_FUNCTION 0 typedef enum FunctionPatcherFunctionType {
#define DYNAMIC_FUNCTION 1 FUNCTION_PATCHER_STATIC_FUNCTION = 0,
FUNCTION_PATCHER_DYNAMIC_FUNCTION = 1
} FunctionPatcherFunctionType;
typedef struct function_replacement_data_t { typedef struct function_replacement_data_t {
uint32_t physicalAddr; /* [needs to be filled] */ uint32_t physicalAddr; /* [needs to be filled] */
@ -88,7 +90,7 @@ typedef struct function_replacement_data_t {
uint32_t realAddr; /* [will be filled] Address of the real function we want to replace. */ uint32_t realAddr; /* [will be filled] Address of the real function we want to replace. */
volatile uint32_t replace_data [FUNCTION_PATCHER_METHOD_STORE_SIZE]; /* [will be filled] Space for us to store some jump instructions */ volatile uint32_t replace_data [FUNCTION_PATCHER_METHOD_STORE_SIZE]; /* [will be filled] Space for us to store some jump instructions */
uint32_t restoreInstruction; /* [will be filled] Copy of the instruction we replaced to jump to our code. */ uint32_t restoreInstruction; /* [will be filled] Copy of the instruction we replaced to jump to our code. */
uint8_t functionType; /* [will be filled] */ FunctionPatcherFunctionType functionType; /* [will be filled] */
uint8_t alreadyPatched; /* [will be filled] */ uint8_t alreadyPatched; /* [will be filled] */
} function_replacement_data_t; } function_replacement_data_t;
@ -103,7 +105,7 @@ typedef struct function_replacement_data_t {
0, \ 0, \
{}, \ {}, \
0, \ 0, \
STATIC_FUNCTION, \ FUNCTION_PATCHER_STATIC_FUNCTION, \
0 \ 0 \
} }
@ -118,7 +120,7 @@ typedef struct function_replacement_data_t {
0, \ 0, \
{}, \ {}, \
0, \ 0, \
STATIC_FUNCTION, \ FUNCTION_PATCHER_STATIC_FUNCTION, \
0 \ 0 \
} }