Files
2026-04-17 20:09:41 +03:00

50 lines
1.3 KiB
C++

#pragma once
/**
* ReXGlue runtime - AC6 Recompilation project
* Copyright (c) 2026 Tom Clay. All rights reserved.
*/
#include <string>
#include <vector>
#include <rex/system/module.h>
namespace rex::system {
class KernelState;
} // namespace rex::system
namespace rex::runtime {
// ELF module: Used to load libxenon executables.
class ElfModule : public Module {
public:
ElfModule(FunctionDispatcher* function_dispatcher, rex::system::KernelState* kernel_state);
virtual ~ElfModule();
bool loaded() const { return loaded_; }
const std::string& name() const override { return name_; }
bool is_executable() const override;
const std::string& path() const { return path_; }
// Binary introspection overrides
uint32_t base_address() const override { return base_address_; }
uint32_t image_size() const override { return image_size_; }
uint32_t entry_point() const override { return entry_point_; }
bool Load(const std::string_view name, const std::string_view path, const void* elf_addr,
size_t elf_length);
bool Unload();
private:
std::string name_;
std::string path_;
bool loaded_ = false;
std::vector<uint8_t> elf_header_mem_; // Holds the ELF header
uint32_t entry_point_ = 0;
uint32_t base_address_ = 0;
uint32_t image_size_ = 0;
};
} // namespace rex::runtime