Kernel calls and variables now working and tracing better.

This commit is contained in:
Ben Vanik
2013-01-28 12:36:39 -08:00
parent 5c2060af72
commit 6c4af5aa70
19 changed files with 462 additions and 51 deletions

View File

@@ -23,6 +23,7 @@
namespace llvm {
class DIBuilder;
class ExecutionEngine;
class Function;
class FunctionType;
class LLVMContext;
@@ -42,7 +43,8 @@ public:
xe_memory_ref memory, kernel::ExportResolver* export_resolver,
const char* module_name, const char* module_path,
sdb::SymbolDatabase* sdb,
llvm::LLVMContext* context, llvm::Module* gen_module);
llvm::LLVMContext* context, llvm::Module* gen_module,
llvm::ExecutionEngine* engine);
~ModuleGenerator();
int Generate();
@@ -76,6 +78,7 @@ private:
llvm::LLVMContext* context_;
llvm::Module* gen_module_;
llvm::ExecutionEngine* engine_;
llvm::DIBuilder* di_builder_;
llvm::MDNode* cu_;

View File

@@ -143,6 +143,7 @@ typedef struct XECACHEALIGN64 xe_ppc_state {
// Runtime-specific data pointer. Used on callbacks to get access to the
// current runtime and its data.
uint8_t* membase;
void* processor;
void* thread_state;
void* runtime;

View File

@@ -33,6 +33,7 @@ public:
private:
uint32_t stack_address_;
uint32_t stack_size_;
xe_memory_ref memory_;
xe_ppc_state_t ppc_state_;
};

View File

@@ -23,7 +23,7 @@ namespace kernel {
typedef void (*xe_kernel_export_impl_fn)();
typedef void (*xe_kernel_export_shim_fn)(xe_ppc_state_t* state);
typedef void (*xe_kernel_export_shim_fn)(xe_ppc_state_t*, void*);
class KernelExport {
public:
@@ -47,6 +47,9 @@ public:
uint32_t variable_ptr;
struct {
// Second argument passed to the shim function.
void* shim_data;
// Shimmed implementation.
// This is called directly from generated code.
// It should parse args, do fixups, and call the impl.
@@ -83,7 +86,7 @@ public:
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,
void* shim_data, xe_kernel_export_shim_fn shim,
xe_kernel_export_impl_fn impl);
private: