Implement WUMS 0.2

This commit is contained in:
Maschell
2021-09-17 16:17:54 +02:00
parent f461fc4539
commit c5af736523
13 changed files with 170 additions and 113 deletions

View File

@@ -17,6 +17,7 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -39,13 +40,13 @@ typedef struct _dyn_linking_function_t {
typedef struct _dyn_linking_import_t {
char importName[DYN_LINK_IMPORT_NAME_LENGTH + 1];
bool isData = false;
bool isData;
} dyn_linking_import_t;
typedef struct _dyn_linking_relocation_entry_t {
dyn_linking_function_t *functionEntry = NULL;
dyn_linking_import_t *importEntry = NULL;
void *destination = NULL;
dyn_linking_function_t *functionEntry;
dyn_linking_import_t *importEntry;
void *destination;
char type;
size_t offset;
int32_t addend;

View File

@@ -6,5 +6,5 @@
typedef struct export_data_t {
uint32_t type;
char name[EXPORT_MAXIMUM_NAME_LENGTH];
uint32_t address = 0;
uint32_t address;
} export_data_t;

View File

@@ -32,15 +32,15 @@ extern "C" {
#define DYN_LINK_RELOCATION_LIST_LENGTH 500
#define EXPORT_ENTRY_LIST_LENGTH 100
#define HOOK_ENTRY_LIST_LENGTH 10
#define HOOK_ENTRY_LIST_LENGTH 20
typedef struct hook_data_t {
uint32_t type;
uint32_t target = 0;
uint32_t target;
} hook_data_t;
struct module_information_single_t {
char path[MAXIMUM_MODULE_PATH_NAME_LENGTH] = ""; // Path where the module is stored
typedef struct module_information_single_t {
char path[MAXIMUM_MODULE_PATH_NAME_LENGTH]; // Path where the module is stored
dyn_linking_relocation_entry_t linking_entries[DYN_LINK_RELOCATION_LIST_LENGTH];
char module_export_name[MAXIMUM_EXPORT_MODULE_NAME_LENGTH];
export_data_t export_entries[EXPORT_ENTRY_LIST_LENGTH];
@@ -55,19 +55,18 @@ struct module_information_single_t {
uint32_t endAddress;
uint8_t skipEntrypoint;
uint8_t initBeforeRelocationDoneHook;
uint8_t skipWUTInit;
};
} module_information_single_t;
#define MAXIMUM_MODULES 8
#define MODULE_INFORMATION_VERSION 0x00000003
#define MODULE_INFORMATION_VERSION 0x00000004
struct module_information_t {
uint32_t version = MODULE_INFORMATION_VERSION;
int32_t number_used_modules = 0; // Number of used function. Maximum is MAXIMUM_MODULES
typedef struct module_information_t {
uint32_t version;
int32_t number_used_modules; // Number of used function. Maximum is MAXIMUM_MODULES
dyn_linking_relocation_data_t linking_data;
relocation_trampolin_entry_t trampolines[DYN_LINK_TRAMPOLIN_LIST_LENGTH];
module_information_single_t module_data[MAXIMUM_MODULES];
};
} module_information_t;
#ifdef __cplusplus
}

View File

@@ -16,5 +16,5 @@ typedef enum RelocationType{
typedef struct relocation_trampolin_entry_t {
uint32_t id;
uint32_t trampolin[4];
RelocationTrampolinStatus status = RELOC_TRAMP_FREE;
RelocationTrampolinStatus status;
} relocation_trampolin_entry_t;