Now running up to the first required kernel call.

If memory address validation is turned off it runs a lot further.
This commit is contained in:
Ben Vanik
2013-01-28 03:03:37 -08:00
parent 46d5a0b51d
commit 5c2060af72
20 changed files with 342 additions and 91 deletions

View File

@@ -85,7 +85,7 @@ public:
void update_gpr_value(uint32_t n, llvm::Value* value);
llvm::Value* GetMembase();
llvm::Value* memory_addr(uint32_t addr);
llvm::Value* GetMemoryAddress(llvm::Value* addr);
llvm::Value* ReadMemory(llvm::Value* addr, uint32_t size, bool extend);
void WriteMemory(llvm::Value* addr, uint32_t size, llvm::Value* value);

View File

@@ -128,6 +128,8 @@ public:
uint32_t address;
char* name;
kernel::KernelExport* kernel_export;
};
class ExceptionEntrySymbol : public Symbol {
@@ -154,6 +156,7 @@ public:
VariableSymbol* GetVariable(uint32_t address);
Symbol* GetSymbol(uint32_t address);
int GetAllVariables(std::vector<VariableSymbol*>& variables);
int GetAllFunctions(std::vector<FunctionSymbol*>& functions);
void Write(const char* file_name);

View File

@@ -15,11 +15,15 @@
#include <vector>
typedef struct xe_ppc_state xe_ppc_state_t;
namespace xe {
namespace kernel {
typedef void (*xe_kernel_export_fn)();
typedef void (*xe_kernel_export_impl_fn)();
typedef void (*xe_kernel_export_shim_fn)(xe_ppc_state_t* state);
class KernelExport {
public:
@@ -34,21 +38,24 @@ public:
char signature[16];
char name[96];
bool is_implemented;
union {
// Variable data. Only valid when kXEKernelExportFlagVariable is set.
void *variable_data;
// This is an address in the client memory space that the variable can
// be found at.
uint32_t variable_ptr;
struct {
// Real function implementation (if present).
xe_kernel_export_fn impl;
// Shimmed implementation.
// This is called directly from generated code.
// It should parse args, do fixups, and call the impl.
xe_kernel_export_shim_fn shim;
// Shimmed implementation (call if param structs are big endian).
// This may be NULL if no shim is needed or present.
xe_kernel_export_fn shim;
// Real function implementation.
xe_kernel_export_impl_fn impl;
} function_data;
};
bool IsImplemented();
};
#define XE_DECLARE_EXPORT(module, ordinal, name, signature, type, flags) \
@@ -73,6 +80,12 @@ public:
const uint32_t ordinal);
KernelExport* GetExportByName(const char* library_name, const char* name);
void SetVariableMapping(const char* library_name, const uint32_t ordinal,
uint32_t value);
void SetFunctionMapping(const char* library_name, const uint32_t ordinal,
xe_kernel_export_shim_fn shim,
xe_kernel_export_impl_fn impl);
private:
class ExportTable {
public: