Codegen experimentation.
This commit is contained in:
parent
c18e94c5be
commit
ea5154af0f
|
@ -17,7 +17,6 @@
|
|||
|
||||
typedef struct {
|
||||
xechar_t path[2048];
|
||||
xechar_t name[256];
|
||||
} xe_module_options_t;
|
||||
|
||||
struct xe_module;
|
||||
|
@ -53,6 +52,8 @@ xe_module_ref xe_module_load(xe_memory_ref memory,
|
|||
xe_module_ref xe_module_retain(xe_module_ref module);
|
||||
void xe_module_release(xe_module_ref module);
|
||||
|
||||
const xechar_t *xe_module_get_path(xe_module_ref module);
|
||||
const xechar_t *xe_module_get_name(xe_module_ref module);
|
||||
uint32_t xe_module_get_handle(xe_module_ref module);
|
||||
xe_xex2_ref xe_module_get_xex(xe_module_ref module);
|
||||
const xe_xex2_header_t *xe_module_get_xex_header(xe_module_ref module);
|
||||
|
|
|
@ -94,8 +94,8 @@ typedef char xechar_t;
|
|||
#define xestrcat xestrcata
|
||||
#define xesnprintf xesnprintfa
|
||||
#define xevsnprintf xevsnprintfa
|
||||
#define xestrnarrow(dest, destLength, source) xestrCpy(dest, destLength, source)
|
||||
#define xestrwiden(dest, destLength, source) xestrCpy(dest, destLength, source)
|
||||
#define xestrnarrow(dest, destLength, source) xestrcpy(dest, destLength, source)
|
||||
#define xestrwiden(dest, destLength, source) xestrcpy(dest, destLength, source)
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <llvm/Linker.h>
|
||||
#include <llvm/PassManager.h>
|
||||
#include <llvm/DebugInfo.h>
|
||||
#include <llvm/Analysis/Verifier.h>
|
||||
#include <llvm/IR/Attributes.h>
|
||||
#include <llvm/IR/DataLayout.h>
|
||||
|
@ -24,40 +25,25 @@
|
|||
using namespace llvm;
|
||||
|
||||
|
||||
// TODO(benvanik):
|
||||
typedef struct {
|
||||
xe_codegen_options_t options;
|
||||
xe_memory_ref memory;
|
||||
xe_kernel_export_resolver_ref export_resolver;
|
||||
|
||||
xe_module_ref module;
|
||||
xe_sdb_ref sdb;
|
||||
|
||||
LLVMContext *context;
|
||||
Module *shared_module;
|
||||
Module *gen_module;
|
||||
} xe_cpu_codegen_ctx_t;
|
||||
|
||||
|
||||
void xe_cpu_codegen_add_imports(xe_codegen_ctx_t *ctx);
|
||||
void xe_cpu_codegen_add_missing_import(
|
||||
void xe_codegen_add_imports(xe_codegen_ctx_t *ctx);
|
||||
void xe_codegen_add_missing_import(
|
||||
xe_codegen_ctx_t *ctx, const xe_xex2_import_library_t *library,
|
||||
const xe_xex2_import_info_t* info, xe_kernel_export_t *kernel_export);
|
||||
void xe_cpu_codegen_add_import(
|
||||
void xe_codegen_add_import(
|
||||
xe_codegen_ctx_t *ctx, const xe_xex2_import_library_t *library,
|
||||
const xe_xex2_import_info_t* info, xe_kernel_export_t *kernel_export);
|
||||
void xe_cpu_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn);
|
||||
void xe_cpu_codegen_optimize(Module *m, Function *fn);
|
||||
void xe_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn);
|
||||
void xe_codegen_optimize(Module *m, Function *fn);
|
||||
|
||||
|
||||
llvm::Module *xe_cpu_codegen(xe_codegen_ctx_t *ctx,
|
||||
llvm::Module *xe_codegen(xe_codegen_ctx_t *ctx,
|
||||
xe_codegen_options_t options) {
|
||||
LLVMContext& context = *ctx->context;
|
||||
std::string error_message;
|
||||
|
||||
// Initialize the module.
|
||||
Module *m = new Module("generated.xex", context);
|
||||
ctx->m = m;
|
||||
Module *m = new Module(xe_module_get_name(ctx->module), context);
|
||||
ctx->gen_module = m;
|
||||
// TODO(benavnik): addModuleFlag?
|
||||
|
||||
// Link shared module into generated module.
|
||||
|
@ -65,29 +51,51 @@ llvm::Module *xe_cpu_codegen(xe_codegen_ctx_t *ctx,
|
|||
// for foreward declarations.
|
||||
Linker::LinkModules(m, ctx->shared_module, 0, &error_message);
|
||||
|
||||
// Setup a debug info builder.
|
||||
// This is used when creating any debug info. We may want to go more
|
||||
// fine grained than this, but for now it's something.
|
||||
xechar_t dir[2048];
|
||||
xestrcpy(dir, XECOUNT(dir), xe_module_get_path(ctx->module));
|
||||
xechar_t *slash = xestrrchr(dir, '/');
|
||||
if (slash) {
|
||||
*(slash + 1) = 0;
|
||||
}
|
||||
ctx->di_builder = new DIBuilder(*m);
|
||||
ctx->di_builder->createCompileUnit(
|
||||
0,
|
||||
StringRef(xe_module_get_name(ctx->module)),
|
||||
StringRef(dir),
|
||||
StringRef("xenia"),
|
||||
true,
|
||||
StringRef(""),
|
||||
0);
|
||||
ctx->cu = (MDNode*)ctx->di_builder->getCU();
|
||||
|
||||
// Add import thunks/etc.
|
||||
xe_cpu_codegen_add_imports(ctx);
|
||||
xe_codegen_add_imports(ctx);
|
||||
|
||||
// Add export wrappers.
|
||||
//
|
||||
|
||||
// Add all functions/
|
||||
// Add all functions.
|
||||
xe_sdb_function_t **functions;
|
||||
size_t function_count;
|
||||
if (!xe_sdb_get_functions(ctx->sdb, &functions, &function_count)) {
|
||||
for (size_t n = 0; n < function_count; n++) {
|
||||
// kernel functions will be handled by the add imports handlers.
|
||||
if (functions[n]->type == kXESDBFunctionUser) {
|
||||
xe_cpu_codegen_add_function(ctx, functions[n]);
|
||||
xe_codegen_add_function(ctx, functions[n]);
|
||||
}
|
||||
}
|
||||
xe_free(functions);
|
||||
}
|
||||
|
||||
ctx->di_builder->finalize();
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
void xe_cpu_codegen_add_imports(xe_codegen_ctx_t *ctx) {
|
||||
void xe_codegen_add_imports(xe_codegen_ctx_t *ctx) {
|
||||
xe_xex2_ref xex = xe_module_get_xex(ctx->module);
|
||||
const xe_xex2_header_t *header = xe_xex2_get_header(xex);
|
||||
|
||||
|
@ -106,10 +114,10 @@ void xe_cpu_codegen_add_imports(xe_codegen_ctx_t *ctx) {
|
|||
ctx->export_resolver, library->name, info->ordinal);
|
||||
if (!kernel_export || !xe_kernel_export_is_implemented(kernel_export)) {
|
||||
// Not implemented or known.
|
||||
xe_cpu_codegen_add_missing_import(ctx, library, info, kernel_export);
|
||||
xe_codegen_add_missing_import(ctx, library, info, kernel_export);
|
||||
} else {
|
||||
// Implemented.
|
||||
xe_cpu_codegen_add_import(ctx, library, info, kernel_export);
|
||||
xe_codegen_add_import(ctx, library, info, kernel_export);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,10 +127,10 @@ void xe_cpu_codegen_add_imports(xe_codegen_ctx_t *ctx) {
|
|||
xe_xex2_release(xex);
|
||||
}
|
||||
|
||||
void xe_cpu_codegen_add_missing_import(
|
||||
void xe_codegen_add_missing_import(
|
||||
xe_codegen_ctx_t *ctx, const xe_xex2_import_library_t *library,
|
||||
const xe_xex2_import_info_t* info, xe_kernel_export_t *kernel_export) {
|
||||
Module *m = ctx->m;
|
||||
Module *m = ctx->gen_module;
|
||||
LLVMContext& context = m->getContext();
|
||||
|
||||
char name[128];
|
||||
|
@ -156,7 +164,7 @@ void xe_cpu_codegen_add_missing_import(
|
|||
Value *tmp = builder.getInt32(0);
|
||||
builder.CreateRet(tmp);
|
||||
|
||||
xe_cpu_codegen_optimize(m, f);
|
||||
xe_codegen_optimize(m, f);
|
||||
|
||||
//GlobalAlias *alias = new GlobalAlias(f->getType(), GlobalValue::InternalLinkage, name, f, m);
|
||||
// printf(" F %.8X %.8X %.3X (%3d) %s %s\n",
|
||||
|
@ -169,17 +177,17 @@ void xe_cpu_codegen_add_missing_import(
|
|||
}
|
||||
}
|
||||
|
||||
void xe_cpu_codegen_add_import(
|
||||
void xe_codegen_add_import(
|
||||
xe_codegen_ctx_t *ctx, const xe_xex2_import_library_t *library,
|
||||
const xe_xex2_import_info_t* info, xe_kernel_export_t *kernel_export) {
|
||||
// Module *m = ctx->m;
|
||||
// Module *m = ctx->gen_module;
|
||||
// LLVMContext& context = m->getContext();
|
||||
|
||||
// TODO(benvanik): add import thunk code.
|
||||
}
|
||||
|
||||
void xe_cpu_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn) {
|
||||
Module *m = ctx->m;
|
||||
void xe_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn) {
|
||||
Module *m = ctx->gen_module;
|
||||
LLVMContext& context = m->getContext();
|
||||
|
||||
AttributeWithIndex awi[] = {
|
||||
|
@ -210,6 +218,7 @@ void xe_cpu_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn) {
|
|||
// TODO(benvanik): generate code!
|
||||
BasicBlock* block = BasicBlock::Create(context, "entry", f);
|
||||
IRBuilder<> builder(block);
|
||||
//builder.SetCurrentDebugLocation(DebugLoc::get(fn->start_address >> 8, fn->start_address & 0xFF, ctx->cu));
|
||||
Value *tmp = builder.getInt32(0);
|
||||
builder.CreateRet(tmp);
|
||||
|
||||
|
@ -232,10 +241,10 @@ void xe_cpu_codegen_add_function(xe_codegen_ctx_t *ctx, xe_sdb_function_t *fn) {
|
|||
// Run the optimizer on the function.
|
||||
// Doing this here keeps the size of the IR small and speeds up the later
|
||||
// passes.
|
||||
xe_cpu_codegen_optimize(m, f);
|
||||
xe_codegen_optimize(m, f);
|
||||
}
|
||||
|
||||
void xe_cpu_codegen_optimize(Module *m, Function *fn) {
|
||||
void xe_codegen_optimize(Module *m, Function *fn) {
|
||||
FunctionPassManager pm(m);
|
||||
PassManagerBuilder pmb;
|
||||
pmb.OptLevel = 3;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <xenia/core/memory.h>
|
||||
#include <xenia/kernel/module.h>
|
||||
|
||||
#include <llvm/DIBuilder.h>
|
||||
#include <llvm/IR/LLVMContext.h>
|
||||
#include <llvm/IR/Module.h>
|
||||
|
||||
|
@ -30,11 +31,13 @@ typedef struct {
|
|||
|
||||
llvm::LLVMContext *context;
|
||||
llvm::Module *shared_module;
|
||||
llvm::Module *m;
|
||||
llvm::Module *gen_module;
|
||||
llvm::DIBuilder *di_builder;
|
||||
llvm::MDNode *cu;
|
||||
} xe_codegen_ctx_t;
|
||||
|
||||
|
||||
llvm::Module *xe_cpu_codegen(xe_codegen_ctx_t *ctx,
|
||||
llvm::Module *xe_codegen(xe_codegen_ctx_t *ctx,
|
||||
xe_codegen_options_t options);
|
||||
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ int xe_cpu_prepare_module(xe_cpu_ref cpu, xe_module_ref module,
|
|||
codegen_ctx.sdb = sdb;
|
||||
codegen_ctx.context = context;
|
||||
codegen_ctx.shared_module = shared_module;
|
||||
gen_module = xe_cpu_codegen(&codegen_ctx, codegen_options);
|
||||
gen_module = xe_codegen(&codegen_ctx, codegen_options);
|
||||
|
||||
// Write to cache.
|
||||
outs = new raw_fd_ostream(cache_path, error_message,
|
||||
|
|
|
@ -44,280 +44,280 @@ static xe_ppc_instr_type_t *xe_ppc_instr_table_prep(
|
|||
// Opcode = 4, index = bits 5-0 (6)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_4_unprep[] = {
|
||||
// TODO: all of the vector ops
|
||||
INSTRUCTION(VPERM, 0x1000002B, VA , General , 0),
|
||||
INSTRUCTION(vperm, 0x1000002B, VA , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_4 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_4_unprep, XECOUNT(xe_ppc_instr_table_4_unprep), 0, 5);
|
||||
|
||||
// Opcode = 19, index = bits 10-1 (10)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_19_unprep[] = {
|
||||
INSTRUCTION(MCRF, 0x4C000000, XL , General , 0),
|
||||
INSTRUCTION(BCLRx, 0x4C000020, XL , BranchCond , 0),
|
||||
INSTRUCTION(CRNOR, 0x4C000042, XL , General , 0),
|
||||
INSTRUCTION(CRANDC, 0x4C000102, XL , General , 0),
|
||||
INSTRUCTION(ISYNC, 0x4C00012C, XL , General , 0),
|
||||
INSTRUCTION(CRXOR, 0x4C000182, XL , General , 0),
|
||||
INSTRUCTION(CRNAND, 0x4C0001C2, XL , General , 0),
|
||||
INSTRUCTION(CRAND, 0x4C000202, XL , General , 0),
|
||||
INSTRUCTION(CREQV, 0x4C000242, XL , General , 0),
|
||||
INSTRUCTION(CRORC, 0x4C000342, XL , General , 0),
|
||||
INSTRUCTION(CROR, 0x4C000382, XL , General , 0),
|
||||
INSTRUCTION(BCCTRx, 0x4C000420, XL , BranchCond , 0),
|
||||
INSTRUCTION(mcrf, 0x4C000000, XL , General , 0),
|
||||
INSTRUCTION(bclrx, 0x4C000020, XL , BranchCond , 0),
|
||||
INSTRUCTION(crnor, 0x4C000042, XL , General , 0),
|
||||
INSTRUCTION(crandc, 0x4C000102, XL , General , 0),
|
||||
INSTRUCTION(isync, 0x4C00012C, XL , General , 0),
|
||||
INSTRUCTION(crxor, 0x4C000182, XL , General , 0),
|
||||
INSTRUCTION(crnand, 0x4C0001C2, XL , General , 0),
|
||||
INSTRUCTION(crand, 0x4C000202, XL , General , 0),
|
||||
INSTRUCTION(creqv, 0x4C000242, XL , General , 0),
|
||||
INSTRUCTION(crorc, 0x4C000342, XL , General , 0),
|
||||
INSTRUCTION(cror, 0x4C000382, XL , General , 0),
|
||||
INSTRUCTION(bcctrx, 0x4C000420, XL , BranchCond , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_19 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_19_unprep, XECOUNT(xe_ppc_instr_table_19_unprep), 1, 10);
|
||||
|
||||
// Opcode = 30, index = bits 5-1 (5)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_30_unprep[] = {
|
||||
INSTRUCTION(RLDICLx, 0x78000000, MD , General , 0),
|
||||
INSTRUCTION(RLDICRx, 0x78000004, MD , General , 0),
|
||||
INSTRUCTION(RLDICx, 0x78000008, MD , General , 0),
|
||||
INSTRUCTION(RLDIMIx, 0x7800000C, MD , General , 0),
|
||||
INSTRUCTION(RLDCLx, 0x78000010, MDS, General , 0),
|
||||
INSTRUCTION(RLDCRx, 0x78000012, MDS, General , 0),
|
||||
INSTRUCTION(rldiclx, 0x78000000, MD , General , 0),
|
||||
INSTRUCTION(rldicrx, 0x78000004, MD , General , 0),
|
||||
INSTRUCTION(rldicx, 0x78000008, MD , General , 0),
|
||||
INSTRUCTION(rldimix, 0x7800000C, MD , General , 0),
|
||||
INSTRUCTION(rldclx, 0x78000010, MDS, General , 0),
|
||||
INSTRUCTION(rldcrx, 0x78000012, MDS, General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_30 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_30_unprep, XECOUNT(xe_ppc_instr_table_30_unprep), 1, 5);
|
||||
|
||||
// Opcode = 31, index = bits 10-1 (10)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_31_unprep[] = {
|
||||
INSTRUCTION(CMP, 0x7C000000, X , General , 0),
|
||||
INSTRUCTION(TW, 0x7C000008, X , General , 0),
|
||||
INSTRUCTION(LVSL, 0x7C00000C, X , General , 0),
|
||||
INSTRUCTION(LVEBX, 0x7C00000E, X , General , 0),
|
||||
INSTRUCTION(SUBFCx, 0x7C000010, XO , General , 0),
|
||||
INSTRUCTION(MULHDUx, 0x7C000012, XO , General , 0),
|
||||
INSTRUCTION(ADDCx, 0X7C000014, XO , General , 0),
|
||||
INSTRUCTION(MULHWUx, 0x7C000016, XO , General , 0),
|
||||
INSTRUCTION(MFCR, 0x7C000026, X , General , 0),
|
||||
INSTRUCTION(LWARx, 0x7C000028, X , General , 0),
|
||||
INSTRUCTION(LDx, 0x7C00002A, X , General , 0),
|
||||
INSTRUCTION(LWZx, 0x7C00002E, X , General , 0),
|
||||
INSTRUCTION(SLWx, 0x7C000030, X , General , 0),
|
||||
INSTRUCTION(CNTLZWx, 0x7C000034, X , General , 0),
|
||||
INSTRUCTION(SLDx, 0x7C000036, X , General , 0),
|
||||
INSTRUCTION(ANDx, 0x7C000038, X , General , 0),
|
||||
INSTRUCTION(CMPL, 0x7C000040, X , General , 0),
|
||||
INSTRUCTION(LVSR, 0x7C00004C, X , General , 0),
|
||||
INSTRUCTION(LVEHX, 0x7C00004E, X , General , 0),
|
||||
INSTRUCTION(SUBFx, 0x7C000050, XO , General , 0),
|
||||
INSTRUCTION(LDUx, 0x7C00006A, X , General , 0),
|
||||
INSTRUCTION(DCBST, 0x7C00006C, X , General , 0),
|
||||
INSTRUCTION(LWZUx, 0x7C00006E, X , General , 0),
|
||||
INSTRUCTION(CNTLZDx, 0x7C000074, X , General , 0),
|
||||
INSTRUCTION(ANDCx, 0x7C000078, X , General , 0),
|
||||
INSTRUCTION(TD, 0x7C000088, X , General , 0),
|
||||
INSTRUCTION(LVEWX, 0x7C00008E, X , General , 0),
|
||||
INSTRUCTION(MULHDx, 0x7C000092, XO , General , 0),
|
||||
INSTRUCTION(MULHWx, 0x7C000096, XO , General , 0),
|
||||
INSTRUCTION(LDARx, 0x7C0000A8, X , General , 0),
|
||||
INSTRUCTION(DCBF, 0x7C0000AC, X , General , 0),
|
||||
INSTRUCTION(LBZx, 0x7C0000AE, X , General , 0),
|
||||
INSTRUCTION(LVX, 0x7C0000CE, X , General , 0),
|
||||
INSTRUCTION(NEGx, 0x7C0000D0, XO , General , 0),
|
||||
INSTRUCTION(LBZUx, 0x7C0000EE, X , General , 0),
|
||||
INSTRUCTION(NORx, 0x7C0000F8, X , General , 0),
|
||||
INSTRUCTION(STVEBX, 0x7C00010E, X , General , 0),
|
||||
INSTRUCTION(SUBFEx, 0x7C000110, XO , General , 0),
|
||||
INSTRUCTION(ADDEx, 0x7C000114, XO , General , 0),
|
||||
INSTRUCTION(MTCRF, 0x7C000120, XFX, General , 0),
|
||||
INSTRUCTION(STDx, 0x7C00012A, X , General , 0),
|
||||
INSTRUCTION(STWCx, 0x7C00012D, X , General , 0),
|
||||
INSTRUCTION(STWx, 0x7C00012E, X , General , 0),
|
||||
INSTRUCTION(STVEHX, 0x7C00014E, X , General , 0),
|
||||
INSTRUCTION(STDUx, 0x7C00016A, X , General , 0),
|
||||
INSTRUCTION(STWUx, 0x7C00016E, X , General , 0),
|
||||
INSTRUCTION(STVEWX, 0x7C00018E, X , General , 0),
|
||||
INSTRUCTION(SUBFZEx, 0x7C000190, XO , General , 0),
|
||||
INSTRUCTION(ADDZEx, 0x7C000194, XO , General , 0),
|
||||
INSTRUCTION(STDCx, 0x7C0001AD, X , General , 0),
|
||||
INSTRUCTION(STBx, 0x7C0001AE, X , General , 0),
|
||||
INSTRUCTION(STVX, 0x7C0001CE, X , General , 0),
|
||||
INSTRUCTION(SUBFMEx, 0x7C0001D0, XO , General , 0),
|
||||
INSTRUCTION(MULLDx, 0x7C0001D2, XO , General , 0),
|
||||
INSTRUCTION(ADDMEx, 0x7C0001D4, XO , General , 0),
|
||||
INSTRUCTION(MULLWx, 0x7C0001D6, XO , General , 0),
|
||||
INSTRUCTION(DCBTST, 0x7C0001EC, X , General , 0),
|
||||
INSTRUCTION(STBUx, 0x7C0001EE, X , General , 0),
|
||||
INSTRUCTION(ADDx, 0x7C000214, XO , General , 0),
|
||||
INSTRUCTION(DCBT, 0x7C00022C, X , General , 0),
|
||||
INSTRUCTION(LHZx, 0x7C00022E, X , General , 0),
|
||||
INSTRUCTION(EQVx, 0x7C000238, X , General , 0),
|
||||
INSTRUCTION(ECIWx, 0x7C00026C, X , General , 0),
|
||||
INSTRUCTION(LHZUx, 0x7C00026E, X , General , 0),
|
||||
INSTRUCTION(XORx, 0x7C000278, X , General , 0),
|
||||
INSTRUCTION(MFSPR, 0x7C0002A6, XFX, General , 0),
|
||||
INSTRUCTION(LWAx, 0x7C0002AA, X , General , 0),
|
||||
INSTRUCTION(LHAx, 0x7C0002AE, X , General , 0),
|
||||
INSTRUCTION(LVXL, 0x7C0002CE, X , General , 0),
|
||||
INSTRUCTION(MFTB, 0x7C0002E6, XFX, General , 0),
|
||||
INSTRUCTION(LWAUx, 0x7C0002EA, X , General , 0),
|
||||
INSTRUCTION(LHAUx, 0x7C0002EE, X , General , 0),
|
||||
INSTRUCTION(STHx, 0x7C00032E, X , General , 0),
|
||||
INSTRUCTION(ORCx, 0x7C000338, X , General , 0),
|
||||
INSTRUCTION(ECOWx, 0x7C00036C, X , General , 0),
|
||||
INSTRUCTION(STHUx, 0x7C00036E, X , General , 0),
|
||||
INSTRUCTION(ORx, 0x7C000378, X , General , 0),
|
||||
INSTRUCTION(DIVDUx, 0x7C000392, XO , General , 0),
|
||||
INSTRUCTION(DIVWUx, 0x7C000396, XO , General , 0),
|
||||
INSTRUCTION(MTSPR, 0x7C0003A6, XFX, General , 0),
|
||||
INSTRUCTION(NANDx, 0x7C0003B8, X , General , 0),
|
||||
INSTRUCTION(STVXL, 0x7C0003CE, X , General , 0),
|
||||
INSTRUCTION(DIVDx, 0x7C0003D2, XO , General , 0),
|
||||
INSTRUCTION(DIVWx, 0x7C0003D6, XO , General , 0),
|
||||
INSTRUCTION(LVLX, 0x7C00040E, X , General , 0),
|
||||
INSTRUCTION(LDBRx, 0x7C000428, X , General , 0),
|
||||
INSTRUCTION(LSWx, 0x7C00042A, X , General , 0),
|
||||
INSTRUCTION(LWBRx, 0x7C00042C, X , General , 0),
|
||||
INSTRUCTION(LFSx, 0x7C00042E, X , General , 0),
|
||||
INSTRUCTION(SRWx, 0x7C000430, X , General , 0),
|
||||
INSTRUCTION(SRDx, 0x7C000436, X , General , 0),
|
||||
INSTRUCTION(LFSUx, 0x7C00046E, X , General , 0),
|
||||
INSTRUCTION(LSWI, 0x7C0004AA, X , General , 0),
|
||||
INSTRUCTION(SYNC, 0x7C0004AC, X , General , 0),
|
||||
INSTRUCTION(LFDx, 0x7C0004AE, X , General , 0),
|
||||
INSTRUCTION(LFDUx, 0x7C0004EE, X , General , 0),
|
||||
INSTRUCTION(STDBRx, 0x7C000528, X , General , 0),
|
||||
INSTRUCTION(STSWx, 0x7C00052A, X , General , 0),
|
||||
INSTRUCTION(STWBRx, 0x7C00052C, X , General , 0),
|
||||
INSTRUCTION(STFSx, 0x7C00052E, X , General , 0),
|
||||
INSTRUCTION(STFSUx, 0x7C00056E, X , General , 0),
|
||||
INSTRUCTION(STSWI, 0x7C0005AA, X , General , 0),
|
||||
INSTRUCTION(STFDx, 0x7C0005AE, X , General , 0),
|
||||
INSTRUCTION(STFDUx, 0x7C0005EE, X , General , 0),
|
||||
INSTRUCTION(LHBRx, 0x7C00062C, X , General , 0),
|
||||
INSTRUCTION(SRAWx, 0x7C000630, X , General , 0),
|
||||
INSTRUCTION(SRADx, 0x7C000634, X , General , 0),
|
||||
INSTRUCTION(SRAWIx, 0x7C000670, X , General , 0),
|
||||
INSTRUCTION(SRADIx, 0x7C000674, XS , General , 0), // TODO
|
||||
INSTRUCTION(EIEIO, 0x7C0006AC, X , General , 0),
|
||||
INSTRUCTION(STHBRx, 0x7C00072C, X , General , 0),
|
||||
INSTRUCTION(EXTSHx, 0x7C000734, X , General , 0),
|
||||
INSTRUCTION(EXTSBx, 0x7C000774, X , General , 0),
|
||||
INSTRUCTION(ICBI, 0x7C0007AC, X , General , 0),
|
||||
INSTRUCTION(STFIWx, 0x7C0007AE, X , General , 0),
|
||||
INSTRUCTION(EXTSWx, 0x7C0007B4, X , General , 0),
|
||||
INSTRUCTION(DCBZ, 0x7C0007EC, X , General , 0), // 0x7C2007EC = DCBZ128
|
||||
INSTRUCTION(cmp, 0x7C000000, X , General , 0),
|
||||
INSTRUCTION(tw, 0x7C000008, X , General , 0),
|
||||
INSTRUCTION(lvsl, 0x7C00000C, X , General , 0),
|
||||
INSTRUCTION(lvebx, 0x7C00000E, X , General , 0),
|
||||
INSTRUCTION(subfcx, 0x7C000010, XO , General , 0),
|
||||
INSTRUCTION(mulhdux, 0x7C000012, XO , General , 0),
|
||||
INSTRUCTION(addcx, 0X7C000014, XO , General , 0),
|
||||
INSTRUCTION(mulhwux, 0x7C000016, XO , General , 0),
|
||||
INSTRUCTION(mfcr, 0x7C000026, X , General , 0),
|
||||
INSTRUCTION(lwarx, 0x7C000028, X , General , 0),
|
||||
INSTRUCTION(ldx, 0x7C00002A, X , General , 0),
|
||||
INSTRUCTION(lwzx, 0x7C00002E, X , General , 0),
|
||||
INSTRUCTION(slwx, 0x7C000030, X , General , 0),
|
||||
INSTRUCTION(cntlzwx, 0x7C000034, X , General , 0),
|
||||
INSTRUCTION(sldx, 0x7C000036, X , General , 0),
|
||||
INSTRUCTION(andx, 0x7C000038, X , General , 0),
|
||||
INSTRUCTION(cmpl, 0x7C000040, X , General , 0),
|
||||
INSTRUCTION(lvsr, 0x7C00004C, X , General , 0),
|
||||
INSTRUCTION(lvehx, 0x7C00004E, X , General , 0),
|
||||
INSTRUCTION(subfx, 0x7C000050, XO , General , 0),
|
||||
INSTRUCTION(ldux, 0x7C00006A, X , General , 0),
|
||||
INSTRUCTION(dcbst, 0x7C00006C, X , General , 0),
|
||||
INSTRUCTION(lwzux, 0x7C00006E, X , General , 0),
|
||||
INSTRUCTION(cntlzdx, 0x7C000074, X , General , 0),
|
||||
INSTRUCTION(andcx, 0x7C000078, X , General , 0),
|
||||
INSTRUCTION(td, 0x7C000088, X , General , 0),
|
||||
INSTRUCTION(lvewx, 0x7C00008E, X , General , 0),
|
||||
INSTRUCTION(mulhdx, 0x7C000092, XO , General , 0),
|
||||
INSTRUCTION(mulhwx, 0x7C000096, XO , General , 0),
|
||||
INSTRUCTION(ldarx, 0x7C0000A8, X , General , 0),
|
||||
INSTRUCTION(dcbf, 0x7C0000AC, X , General , 0),
|
||||
INSTRUCTION(lbzx, 0x7C0000AE, X , General , 0),
|
||||
INSTRUCTION(lvx, 0x7C0000CE, X , General , 0),
|
||||
INSTRUCTION(negx, 0x7C0000D0, XO , General , 0),
|
||||
INSTRUCTION(lbzux, 0x7C0000EE, X , General , 0),
|
||||
INSTRUCTION(norx, 0x7C0000F8, X , General , 0),
|
||||
INSTRUCTION(stvebx, 0x7C00010E, X , General , 0),
|
||||
INSTRUCTION(subfex, 0x7C000110, XO , General , 0),
|
||||
INSTRUCTION(addex, 0x7C000114, XO , General , 0),
|
||||
INSTRUCTION(mtcrf, 0x7C000120, XFX, General , 0),
|
||||
INSTRUCTION(stdx, 0x7C00012A, X , General , 0),
|
||||
INSTRUCTION(stwcx, 0x7C00012D, X , General , 0),
|
||||
INSTRUCTION(stwx, 0x7C00012E, X , General , 0),
|
||||
INSTRUCTION(stvehx, 0x7C00014E, X , General , 0),
|
||||
INSTRUCTION(stdux, 0x7C00016A, X , General , 0),
|
||||
INSTRUCTION(stwux, 0x7C00016E, X , General , 0),
|
||||
INSTRUCTION(stvewx, 0x7C00018E, X , General , 0),
|
||||
INSTRUCTION(subfzex, 0x7C000190, XO , General , 0),
|
||||
INSTRUCTION(addzex, 0x7C000194, XO , General , 0),
|
||||
INSTRUCTION(stdcx, 0x7C0001AD, X , General , 0),
|
||||
INSTRUCTION(stbx, 0x7C0001AE, X , General , 0),
|
||||
INSTRUCTION(stvx, 0x7C0001CE, X , General , 0),
|
||||
INSTRUCTION(subfmex, 0x7C0001D0, XO , General , 0),
|
||||
INSTRUCTION(mulldx, 0x7C0001D2, XO , General , 0),
|
||||
INSTRUCTION(addmex, 0x7C0001D4, XO , General , 0),
|
||||
INSTRUCTION(mullwx, 0x7C0001D6, XO , General , 0),
|
||||
INSTRUCTION(dcbtst, 0x7C0001EC, X , General , 0),
|
||||
INSTRUCTION(stbux, 0x7C0001EE, X , General , 0),
|
||||
INSTRUCTION(addx, 0x7C000214, XO , General , 0),
|
||||
INSTRUCTION(dcbt, 0x7C00022C, X , General , 0),
|
||||
INSTRUCTION(lhzx, 0x7C00022E, X , General , 0),
|
||||
INSTRUCTION(eqvx, 0x7C000238, X , General , 0),
|
||||
INSTRUCTION(eciwx, 0x7C00026C, X , General , 0),
|
||||
INSTRUCTION(lhzux, 0x7C00026E, X , General , 0),
|
||||
INSTRUCTION(xorx, 0x7C000278, X , General , 0),
|
||||
INSTRUCTION(mfspr, 0x7C0002A6, XFX, General , 0),
|
||||
INSTRUCTION(lwax, 0x7C0002AA, X , General , 0),
|
||||
INSTRUCTION(lhax, 0x7C0002AE, X , General , 0),
|
||||
INSTRUCTION(lvxl, 0x7C0002CE, X , General , 0),
|
||||
INSTRUCTION(mftb, 0x7C0002E6, XFX, General , 0),
|
||||
INSTRUCTION(lwaux, 0x7C0002EA, X , General , 0),
|
||||
INSTRUCTION(lhaux, 0x7C0002EE, X , General , 0),
|
||||
INSTRUCTION(sthx, 0x7C00032E, X , General , 0),
|
||||
INSTRUCTION(orcx, 0x7C000338, X , General , 0),
|
||||
INSTRUCTION(ecowx, 0x7C00036C, X , General , 0),
|
||||
INSTRUCTION(sthux, 0x7C00036E, X , General , 0),
|
||||
INSTRUCTION(orx, 0x7C000378, X , General , 0),
|
||||
INSTRUCTION(divdux, 0x7C000392, XO , General , 0),
|
||||
INSTRUCTION(divwux, 0x7C000396, XO , General , 0),
|
||||
INSTRUCTION(mtspr, 0x7C0003A6, XFX, General , 0),
|
||||
INSTRUCTION(nandx, 0x7C0003B8, X , General , 0),
|
||||
INSTRUCTION(stvxl, 0x7C0003CE, X , General , 0),
|
||||
INSTRUCTION(divdx, 0x7C0003D2, XO , General , 0),
|
||||
INSTRUCTION(divwx, 0x7C0003D6, XO , General , 0),
|
||||
INSTRUCTION(lvlx, 0x7C00040E, X , General , 0),
|
||||
INSTRUCTION(ldbrx, 0x7C000428, X , General , 0),
|
||||
INSTRUCTION(lswx, 0x7C00042A, X , General , 0),
|
||||
INSTRUCTION(lwbrx, 0x7C00042C, X , General , 0),
|
||||
INSTRUCTION(lfsx, 0x7C00042E, X , General , 0),
|
||||
INSTRUCTION(srwx, 0x7C000430, X , General , 0),
|
||||
INSTRUCTION(srdx, 0x7C000436, X , General , 0),
|
||||
INSTRUCTION(lfsux, 0x7C00046E, X , General , 0),
|
||||
INSTRUCTION(lswi, 0x7C0004AA, X , General , 0),
|
||||
INSTRUCTION(sync, 0x7C0004AC, X , General , 0),
|
||||
INSTRUCTION(lfdx, 0x7C0004AE, X , General , 0),
|
||||
INSTRUCTION(lfdux, 0x7C0004EE, X , General , 0),
|
||||
INSTRUCTION(stdbrx, 0x7C000528, X , General , 0),
|
||||
INSTRUCTION(stswx, 0x7C00052A, X , General , 0),
|
||||
INSTRUCTION(stwbrx, 0x7C00052C, X , General , 0),
|
||||
INSTRUCTION(stfsx, 0x7C00052E, X , General , 0),
|
||||
INSTRUCTION(stfsux, 0x7C00056E, X , General , 0),
|
||||
INSTRUCTION(stswi, 0x7C0005AA, X , General , 0),
|
||||
INSTRUCTION(stfdx, 0x7C0005AE, X , General , 0),
|
||||
INSTRUCTION(stfdux, 0x7C0005EE, X , General , 0),
|
||||
INSTRUCTION(lhbrx, 0x7C00062C, X , General , 0),
|
||||
INSTRUCTION(srawx, 0x7C000630, X , General , 0),
|
||||
INSTRUCTION(sradx, 0x7C000634, X , General , 0),
|
||||
INSTRUCTION(srawix, 0x7C000670, X , General , 0),
|
||||
INSTRUCTION(sradix, 0x7C000674, XS , General , 0), // TODO
|
||||
INSTRUCTION(eieio, 0x7C0006AC, X , General , 0),
|
||||
INSTRUCTION(sthbrx, 0x7C00072C, X , General , 0),
|
||||
INSTRUCTION(extshx, 0x7C000734, X , General , 0),
|
||||
INSTRUCTION(extsbx, 0x7C000774, X , General , 0),
|
||||
INSTRUCTION(icbi, 0x7C0007AC, X , General , 0),
|
||||
INSTRUCTION(stfiwx, 0x7C0007AE, X , General , 0),
|
||||
INSTRUCTION(extswx, 0x7C0007B4, X , General , 0),
|
||||
INSTRUCTION(dcbz, 0x7C0007EC, X , General , 0), // 0x7C2007EC = DCBZ128
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_31 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_31_unprep, XECOUNT(xe_ppc_instr_table_31_unprep), 1, 10);
|
||||
|
||||
// Opcode = 58, index = bits 1-0 (2)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_58_unprep[] = {
|
||||
INSTRUCTION(LD, 0xE8000000, DS , General , 0),
|
||||
INSTRUCTION(LDU, 0xE8000001, DS , General , 0),
|
||||
INSTRUCTION(LWA, 0xE8000002, DS , General , 0),
|
||||
INSTRUCTION(ld, 0xE8000000, DS , General , 0),
|
||||
INSTRUCTION(ldu, 0xE8000001, DS , General , 0),
|
||||
INSTRUCTION(lwa, 0xE8000002, DS , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_58 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_58_unprep, XECOUNT(xe_ppc_instr_table_58_unprep), 0, 1);
|
||||
|
||||
// Opcode = 59, index = bits 5-1 (5)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_59_unprep[] = {
|
||||
INSTRUCTION(FDIVSx, 0xEC000024, A , General , 0),
|
||||
INSTRUCTION(FSUBSx, 0xEC000028, A , General , 0),
|
||||
INSTRUCTION(FADDSx, 0xEC00002A, A , General , 0),
|
||||
INSTRUCTION(FSQRTSx, 0xEC00002C, A , General , 0),
|
||||
INSTRUCTION(FRESx, 0xEC000030, A , General , 0),
|
||||
INSTRUCTION(FMULSx, 0xEC000032, A , General , 0),
|
||||
INSTRUCTION(FMSUBSx, 0xEC000038, A , General , 0),
|
||||
INSTRUCTION(FMADDSx, 0xEC00003A, A , General , 0),
|
||||
INSTRUCTION(FNMSUBSx, 0xEC00003C, A , General , 0),
|
||||
INSTRUCTION(FNMADDSx, 0xEC00003E, A , General , 0),
|
||||
INSTRUCTION(fdivsx, 0xEC000024, A , General , 0),
|
||||
INSTRUCTION(fsubsx, 0xEC000028, A , General , 0),
|
||||
INSTRUCTION(faddsx, 0xEC00002A, A , General , 0),
|
||||
INSTRUCTION(fsqrtsx, 0xEC00002C, A , General , 0),
|
||||
INSTRUCTION(fresx, 0xEC000030, A , General , 0),
|
||||
INSTRUCTION(fmulsx, 0xEC000032, A , General , 0),
|
||||
INSTRUCTION(fmsubsx, 0xEC000038, A , General , 0),
|
||||
INSTRUCTION(fmaddsx, 0xEC00003A, A , General , 0),
|
||||
INSTRUCTION(fnmsubsx, 0xEC00003C, A , General , 0),
|
||||
INSTRUCTION(fnmaddsx, 0xEC00003E, A , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_59 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_59_unprep, XECOUNT(xe_ppc_instr_table_59_unprep), 1, 5);
|
||||
|
||||
// Opcode = 62, index = bits 1-0 (2)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_62_unprep[] = {
|
||||
INSTRUCTION(STD, 0xF8000000, DS , General , 0),
|
||||
INSTRUCTION(STDU, 0xF8000001, DS , General , 0),
|
||||
INSTRUCTION(std, 0xF8000000, DS , General , 0),
|
||||
INSTRUCTION(stdu, 0xF8000001, DS , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_62 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_62_unprep, XECOUNT(xe_ppc_instr_table_62_unprep), 0, 1);
|
||||
|
||||
// Opcode = 63, index = bits 10-1 (10)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_63_unprep[] = {
|
||||
INSTRUCTION(FCMPU, 0xFC000000, X , General , 0),
|
||||
INSTRUCTION(FRSPx, 0xFC000018, X , General , 0),
|
||||
INSTRUCTION(FCTIWx, 0xFC00001C, X , General , 0),
|
||||
INSTRUCTION(FCTIWZx, 0xFC00001E, X , General , 0),
|
||||
INSTRUCTION(FDIVx, 0xFC000024, A , General , 0),
|
||||
INSTRUCTION(FSUBx, 0xFC000028, A , General , 0),
|
||||
INSTRUCTION(FADDx, 0xFC00002A, A , General , 0),
|
||||
INSTRUCTION(FSQRTx, 0xFC00002C, A , General , 0),
|
||||
INSTRUCTION(FSELx, 0xFC00002E, A , General , 0),
|
||||
INSTRUCTION(FMULx, 0xFC000032, A , General , 0),
|
||||
INSTRUCTION(FRSQRTEx, 0xFC000034, A , General , 0),
|
||||
INSTRUCTION(FMSUBx, 0xFC000038, A , General , 0),
|
||||
INSTRUCTION(FMADDx, 0xFC00003A, A , General , 0),
|
||||
INSTRUCTION(FNMSUBx, 0xFC00003C, A , General , 0),
|
||||
INSTRUCTION(FNMADDx, 0xFC00003E, A , General , 0),
|
||||
INSTRUCTION(FCMPO, 0xFC000040, X , General , 0),
|
||||
INSTRUCTION(MTFSB1x, 0xFC00004C, X , General , 0),
|
||||
INSTRUCTION(FNEGx, 0xFC000050, X , General , 0),
|
||||
INSTRUCTION(MCRFS, 0xFC000080, X , General , 0),
|
||||
INSTRUCTION(MTFSB0x, 0xFC00008C, X , General , 0),
|
||||
INSTRUCTION(FMRx, 0xFC000090, X , General , 0),
|
||||
INSTRUCTION(MTFSFIx, 0xFC00010C, X , General , 0),
|
||||
INSTRUCTION(FNABSx, 0xFC000110, X , General , 0),
|
||||
INSTRUCTION(FABSx, 0xFC000210, X , General , 0),
|
||||
INSTRUCTION(MFFSx, 0xFC00048E, X , General , 0),
|
||||
INSTRUCTION(MTFSFx, 0xFC00058E, XFL, General , 0),
|
||||
INSTRUCTION(FCTIDx, 0xFC00065C, X , General , 0),
|
||||
INSTRUCTION(FCTIDZx, 0xFC00065E, X , General , 0),
|
||||
INSTRUCTION(FCFIDx, 0xFC00069C, X , General , 0),
|
||||
INSTRUCTION(fcmpu, 0xFC000000, X , General , 0),
|
||||
INSTRUCTION(frspx, 0xFC000018, X , General , 0),
|
||||
INSTRUCTION(fctiwx, 0xFC00001C, X , General , 0),
|
||||
INSTRUCTION(fctiwzx, 0xFC00001E, X , General , 0),
|
||||
INSTRUCTION(fdivx, 0xFC000024, A , General , 0),
|
||||
INSTRUCTION(fsubx, 0xFC000028, A , General , 0),
|
||||
INSTRUCTION(faddx, 0xFC00002A, A , General , 0),
|
||||
INSTRUCTION(fsqrtx, 0xFC00002C, A , General , 0),
|
||||
INSTRUCTION(fselx, 0xFC00002E, A , General , 0),
|
||||
INSTRUCTION(fmulx, 0xFC000032, A , General , 0),
|
||||
INSTRUCTION(frsqrtex, 0xFC000034, A , General , 0),
|
||||
INSTRUCTION(fmsubx, 0xFC000038, A , General , 0),
|
||||
INSTRUCTION(fmaddx, 0xFC00003A, A , General , 0),
|
||||
INSTRUCTION(fnmsubx, 0xFC00003C, A , General , 0),
|
||||
INSTRUCTION(fnmaddx, 0xFC00003E, A , General , 0),
|
||||
INSTRUCTION(fcmpo, 0xFC000040, X , General , 0),
|
||||
INSTRUCTION(mtfsb1x, 0xFC00004C, X , General , 0),
|
||||
INSTRUCTION(fnegx, 0xFC000050, X , General , 0),
|
||||
INSTRUCTION(mcrfs, 0xFC000080, X , General , 0),
|
||||
INSTRUCTION(mtfsb0x, 0xFC00008C, X , General , 0),
|
||||
INSTRUCTION(fmrx, 0xFC000090, X , General , 0),
|
||||
INSTRUCTION(mtfsfix, 0xFC00010C, X , General , 0),
|
||||
INSTRUCTION(fnabsx, 0xFC000110, X , General , 0),
|
||||
INSTRUCTION(fabsx, 0xFC000210, X , General , 0),
|
||||
INSTRUCTION(mffsx, 0xFC00048E, X , General , 0),
|
||||
INSTRUCTION(mtfsfx, 0xFC00058E, XFL, General , 0),
|
||||
INSTRUCTION(fctidx, 0xFC00065C, X , General , 0),
|
||||
INSTRUCTION(fctidzx, 0xFC00065E, X , General , 0),
|
||||
INSTRUCTION(fcfidx, 0xFC00069C, X , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table_63 = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_63_unprep, XECOUNT(xe_ppc_instr_table_63_unprep), 1, 10);
|
||||
|
||||
// Main table, index = bits 31-26 (6) : (code >> 26)
|
||||
static xe_ppc_instr_type_t xe_ppc_instr_table_unprep[64] = {
|
||||
INSTRUCTION(TDI, 0x08000000, D , General , 0),
|
||||
INSTRUCTION(TWI, 0x0C000000, D , General , 0),
|
||||
INSTRUCTION(MULLI, 0x1C000000, D , General , 0),
|
||||
INSTRUCTION(SUBFICx, 0x20000000, D , General , 0),
|
||||
INSTRUCTION(CMPLI, 0x28000000, D , General , 0),
|
||||
INSTRUCTION(CMPI, 0x2C000000, D , General , 0),
|
||||
INSTRUCTION(ADDIC, 0x30000000, D , General , 0),
|
||||
INSTRUCTION(ADDICx, 0x34000000, D , General , 0),
|
||||
INSTRUCTION(ADDI, 0x38000000, D , General , 0),
|
||||
INSTRUCTION(ADDIS, 0x3C000000, D , General , 0),
|
||||
INSTRUCTION(BCx, 0x40000000, B , BranchCond , 0),
|
||||
INSTRUCTION(SC, 0x44000002, SC , Syscall , 0),
|
||||
INSTRUCTION(Bx, 0x48000000, I , BranchAlways , 0),
|
||||
INSTRUCTION(RLWIMIx, 0x50000000, M , General , 0),
|
||||
INSTRUCTION(RLWINMx, 0x54000000, M , General , 0),
|
||||
INSTRUCTION(RLWNMx, 0x5C000000, M , General , 0),
|
||||
INSTRUCTION(ORI, 0x60000000, D , General , 0),
|
||||
INSTRUCTION(ORIS, 0x64000000, D , General , 0),
|
||||
INSTRUCTION(XORI, 0x68000000, D , General , 0),
|
||||
INSTRUCTION(XORIS, 0x6C000000, D , General , 0),
|
||||
INSTRUCTION(ANDIx, 0x70000000, D , General , 0),
|
||||
INSTRUCTION(ANDISx, 0x74000000, D , General , 0),
|
||||
INSTRUCTION(LWZ, 0x80000000, D , General , 0),
|
||||
INSTRUCTION(LWZU, 0x84000000, D , General , 0),
|
||||
INSTRUCTION(LBZ, 0x88000000, D , General , 0),
|
||||
INSTRUCTION(LBZU, 0x8C000000, D , General , 0),
|
||||
INSTRUCTION(STW, 0x90000000, D , General , 0),
|
||||
INSTRUCTION(STWU, 0x94000000, D , General , 0),
|
||||
INSTRUCTION(STB, 0x98000000, D , General , 0),
|
||||
INSTRUCTION(STBU, 0x9C000000, D , General , 0),
|
||||
INSTRUCTION(LHZ, 0xA0000000, D , General , 0),
|
||||
INSTRUCTION(LHZU, 0xA4000000, D , General , 0),
|
||||
INSTRUCTION(LHA, 0xA8000000, D , General , 0),
|
||||
INSTRUCTION(LHAU, 0xAC000000, D , General , 0),
|
||||
INSTRUCTION(STH, 0xB0000000, D , General , 0),
|
||||
INSTRUCTION(STHU, 0xB4000000, D , General , 0),
|
||||
INSTRUCTION(LMW, 0xB8000000, D , General , 0),
|
||||
INSTRUCTION(STMW, 0xBC000000, D , General , 0),
|
||||
INSTRUCTION(LFS, 0xC0000000, D , General , 0),
|
||||
INSTRUCTION(LFSU, 0xC4000000, D , General , 0),
|
||||
INSTRUCTION(LFD, 0xC8000000, D , General , 0),
|
||||
INSTRUCTION(LFDU, 0xCC000000, D , General , 0),
|
||||
INSTRUCTION(STFS, 0xD0000000, D , General , 0),
|
||||
INSTRUCTION(STFSU, 0xD4000000, D , General , 0),
|
||||
INSTRUCTION(STFD, 0xD8000000, D , General , 0),
|
||||
INSTRUCTION(STFDU, 0xDC000000, D , General , 0),
|
||||
INSTRUCTION(tdi, 0x08000000, D , General , 0),
|
||||
INSTRUCTION(twi, 0x0C000000, D , General , 0),
|
||||
INSTRUCTION(mulli, 0x1C000000, D , General , 0),
|
||||
INSTRUCTION(subficx, 0x20000000, D , General , 0),
|
||||
INSTRUCTION(cmpli, 0x28000000, D , General , 0),
|
||||
INSTRUCTION(cmpi, 0x2C000000, D , General , 0),
|
||||
INSTRUCTION(addic, 0x30000000, D , General , 0),
|
||||
INSTRUCTION(addicx, 0x34000000, D , General , 0),
|
||||
INSTRUCTION(addi, 0x38000000, D , General , 0),
|
||||
INSTRUCTION(addis, 0x3C000000, D , General , 0),
|
||||
INSTRUCTION(bcx, 0x40000000, B , BranchCond , 0),
|
||||
INSTRUCTION(sc, 0x44000002, SC , Syscall , 0),
|
||||
INSTRUCTION(bx, 0x48000000, I , BranchAlways , 0),
|
||||
INSTRUCTION(rlwimix, 0x50000000, M , General , 0),
|
||||
INSTRUCTION(rlwinmx, 0x54000000, M , General , 0),
|
||||
INSTRUCTION(rlwnmx, 0x5C000000, M , General , 0),
|
||||
INSTRUCTION(ori, 0x60000000, D , General , 0),
|
||||
INSTRUCTION(oris, 0x64000000, D , General , 0),
|
||||
INSTRUCTION(xori, 0x68000000, D , General , 0),
|
||||
INSTRUCTION(xoris, 0x6C000000, D , General , 0),
|
||||
INSTRUCTION(andix, 0x70000000, D , General , 0),
|
||||
INSTRUCTION(andisx, 0x74000000, D , General , 0),
|
||||
INSTRUCTION(lwz, 0x80000000, D , General , 0),
|
||||
INSTRUCTION(lwzu, 0x84000000, D , General , 0),
|
||||
INSTRUCTION(lbz, 0x88000000, D , General , 0),
|
||||
INSTRUCTION(lbzu, 0x8C000000, D , General , 0),
|
||||
INSTRUCTION(stw, 0x90000000, D , General , 0),
|
||||
INSTRUCTION(stwu, 0x94000000, D , General , 0),
|
||||
INSTRUCTION(stb, 0x98000000, D , General , 0),
|
||||
INSTRUCTION(stbu, 0x9C000000, D , General , 0),
|
||||
INSTRUCTION(lhz, 0xA0000000, D , General , 0),
|
||||
INSTRUCTION(lhzu, 0xA4000000, D , General , 0),
|
||||
INSTRUCTION(lha, 0xA8000000, D , General , 0),
|
||||
INSTRUCTION(lhau, 0xAC000000, D , General , 0),
|
||||
INSTRUCTION(sth, 0xB0000000, D , General , 0),
|
||||
INSTRUCTION(sthu, 0xB4000000, D , General , 0),
|
||||
INSTRUCTION(lmw, 0xB8000000, D , General , 0),
|
||||
INSTRUCTION(stmw, 0xBC000000, D , General , 0),
|
||||
INSTRUCTION(lfs, 0xC0000000, D , General , 0),
|
||||
INSTRUCTION(lfsu, 0xC4000000, D , General , 0),
|
||||
INSTRUCTION(lfd, 0xC8000000, D , General , 0),
|
||||
INSTRUCTION(lfdu, 0xCC000000, D , General , 0),
|
||||
INSTRUCTION(stfs, 0xD0000000, D , General , 0),
|
||||
INSTRUCTION(stfsu, 0xD4000000, D , General , 0),
|
||||
INSTRUCTION(stfd, 0xD8000000, D , General , 0),
|
||||
INSTRUCTION(stfdu, 0xDC000000, D , General , 0),
|
||||
};
|
||||
static xe_ppc_instr_type_t *xe_ppc_instr_table = xe_ppc_instr_table_prep(
|
||||
xe_ppc_instr_table_unprep, XECOUNT(xe_ppc_instr_table_unprep), 26, 31);
|
||||
|
|
|
@ -18,6 +18,7 @@ typedef struct xe_module {
|
|||
xe_ref_t ref;
|
||||
|
||||
xe_module_options_t options;
|
||||
xechar_t name[256];
|
||||
|
||||
xe_memory_ref memory;
|
||||
xe_kernel_export_resolver_ref export_resolver;
|
||||
|
@ -41,6 +42,10 @@ xe_module_ref xe_module_load(xe_memory_ref memory,
|
|||
xe_ref_init((xe_ref)module);
|
||||
|
||||
xe_copy_struct(&module->options, &options, sizeof(xe_module_options_t));
|
||||
xechar_t *slash = xestrrchr(options.path, '/');
|
||||
if (slash) {
|
||||
xestrcpy(module->name, XECOUNT(module->name), slash + 1);
|
||||
}
|
||||
|
||||
module->memory = xe_memory_retain(memory);
|
||||
module->export_resolver = xe_kernel_export_resolver_retain(export_resolver);
|
||||
|
@ -72,6 +77,14 @@ void xe_module_release(xe_module_ref module) {
|
|||
xe_ref_release((xe_ref)module, (xe_ref_dealloc_t)xe_module_dealloc);
|
||||
}
|
||||
|
||||
const xechar_t *xe_module_get_path(xe_module_ref module) {
|
||||
return module->options.path;
|
||||
}
|
||||
|
||||
const xechar_t *xe_module_get_name(xe_module_ref module) {
|
||||
return module->name;
|
||||
}
|
||||
|
||||
uint32_t xe_module_get_handle(xe_module_ref module) {
|
||||
return module->handle;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue