(Experimental) ELF module support

This commit is contained in:
Dr. Chat
2015-08-16 02:52:47 -05:00
parent f06ddd3869
commit 6cd08384e7
5 changed files with 302 additions and 34 deletions

View File

@@ -0,0 +1,55 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_CPU_ELF_MODULE_H_
#define XENIA_CPU_ELF_MODULE_H_
#include <vector>
#include "xenia/cpu/module.h"
namespace xe {
namespace kernel {
class KernelState;
} // namespace kernel
namespace cpu {
// ELF module: Used to load libxenon executables.
class ElfModule : public xe::cpu::Module {
public:
ElfModule(Processor* processor, kernel::KernelState* kernel_state);
virtual ~ElfModule();
bool loaded() const { return loaded_; }
uint32_t entry_point() const { return entry_point_; }
const std::string& name() const { return name_; }
const std::string& path() const { return path_; }
bool Load(const std::string& name, const std::string& path,
const void* elf_addr, size_t elf_length);
bool Unload();
protected:
std::unique_ptr<Function> CreateFunction(uint32_t address) override;
private:
std::string name_;
std::string path_;
kernel::KernelState* kernel_state_;
bool loaded_;
std::vector<uint8_t> elf_header_mem_; // Holds the ELF header
uint32_t entry_point_;
};
} // namespace cpu
} // namespace xe
#endif // XENIA_CPU_ELF_MODULE_H_