Code cleanup: moving poly/ into xenia/base/
This commit is contained in:
@@ -9,13 +9,13 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_assembler.h"
|
||||
|
||||
#include "xenia/base/reset_scope.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "poly/reset_scope.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace BE {
|
||||
@@ -65,7 +65,7 @@ int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
// Reset when we leave.
|
||||
poly::make_reset_scope(this);
|
||||
xe::make_reset_scope(this);
|
||||
|
||||
// Lower HIR -> x64.
|
||||
void* machine_code = 0;
|
||||
@@ -95,7 +95,7 @@ int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
}
|
||||
|
||||
void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||
size_t code_size, poly::StringBuffer* str) {
|
||||
size_t code_size, StringBuffer* str) {
|
||||
BE::DISASM disasm = {0};
|
||||
disasm.Archi = 64;
|
||||
disasm.Options = BE::Tabulation + BE::MasmSyntax + BE::PrefixedNumeral;
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/backend/assembler.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -39,14 +39,14 @@ class X64Assembler : public Assembler {
|
||||
|
||||
private:
|
||||
void DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||
size_t code_size, poly::StringBuffer* str);
|
||||
size_t code_size, StringBuffer* str);
|
||||
|
||||
private:
|
||||
X64Backend* x64_backend_;
|
||||
std::unique_ptr<X64Emitter> emitter_;
|
||||
std::unique_ptr<XbyakAllocator> allocator_;
|
||||
|
||||
poly::StringBuffer string_buffer_;
|
||||
StringBuffer string_buffer_;
|
||||
};
|
||||
|
||||
} // namespace x64
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -51,7 +51,7 @@ void* X64CodeCache::PlaceCode(void* machine_code, size_t code_size,
|
||||
size_t stack_size) {
|
||||
// Always move the code to land on 16b alignment. We do this by rounding up
|
||||
// to 16b so that all offsets are aligned.
|
||||
code_size = poly::round_up(code_size, 16);
|
||||
code_size = xe::round_up(code_size, 16);
|
||||
|
||||
lock_.lock();
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_code_cache.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -64,11 +64,11 @@ void* X64CodeCache::PlaceCode(void* machine_code, size_t code_size,
|
||||
size_t alloc_size = code_size;
|
||||
|
||||
// Add unwind info into the allocation size. Keep things 16b aligned.
|
||||
alloc_size += poly::round_up(X64CodeChunk::UNWIND_INFO_SIZE, 16);
|
||||
alloc_size += xe::round_up(X64CodeChunk::UNWIND_INFO_SIZE, 16);
|
||||
|
||||
// Always move the code to land on 16b alignment. We do this by rounding up
|
||||
// to 16b so that all offsets are aligned.
|
||||
alloc_size = poly::round_up(alloc_size, 16);
|
||||
alloc_size = xe::round_up(alloc_size, 16);
|
||||
|
||||
lock_.lock();
|
||||
|
||||
@@ -108,7 +108,7 @@ X64CodeChunk::X64CodeChunk(size_t chunk_size)
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
|
||||
fn_table_capacity =
|
||||
static_cast<uint32_t>(poly::round_up(capacity / ESTIMATED_FN_SIZE, 16));
|
||||
static_cast<uint32_t>(xe::round_up(capacity / ESTIMATED_FN_SIZE, 16));
|
||||
size_t table_size = fn_table_capacity * sizeof(RUNTIME_FUNCTION);
|
||||
fn_table = (RUNTIME_FUNCTION*)malloc(table_size);
|
||||
fn_table_count = 0;
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/vec128.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/backend/x64/x64_code_cache.h"
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
#include "xenia/cpu/backend/x64/x64_sequences.h"
|
||||
#include "xenia/cpu/backend/x64/x64_thunk_emitter.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/debug_info.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
#include "xdb/protocol.h"
|
||||
|
||||
@@ -36,10 +36,6 @@ namespace x64 {
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu;
|
||||
|
||||
using poly::vec128b;
|
||||
using poly::vec128f;
|
||||
using poly::vec128i;
|
||||
|
||||
using namespace Xbyak;
|
||||
using xe::cpu::hir::HIRBuilder;
|
||||
using xe::cpu::hir::Instr;
|
||||
@@ -132,13 +128,13 @@ int X64Emitter::Emit(HIRBuilder* builder, size_t& out_stack_size) {
|
||||
auto slot = *it;
|
||||
size_t type_size = GetTypeSize(slot->type);
|
||||
// Align to natural size.
|
||||
stack_offset = poly::align(stack_offset, type_size);
|
||||
stack_offset = xe::align(stack_offset, type_size);
|
||||
slot->set_constant((uint32_t)stack_offset);
|
||||
stack_offset += type_size;
|
||||
}
|
||||
// Ensure 16b alignment.
|
||||
stack_offset -= StackLayout::GUEST_STACK_SIZE;
|
||||
stack_offset = poly::align(stack_offset, static_cast<size_t>(16));
|
||||
stack_offset = xe::align(stack_offset, static_cast<size_t>(16));
|
||||
|
||||
// Function prolog.
|
||||
// Must be 16b aligned.
|
||||
@@ -536,8 +532,8 @@ uint64_t ResolveFunctionAddress(void* raw_context, uint32_t target_address) {
|
||||
Asm* table_slot = reinterpret_cast<Asm*>(table_start);
|
||||
bool wrote_ic = false;
|
||||
for (int i = 0; i < kICSlotCount; ++i) {
|
||||
if (poly::atomic_cas(kICSlotInvalidTargetAddress, addr,
|
||||
&table_slot->target_constant)) {
|
||||
if (xe::atomic_cas(kICSlotInvalidTargetAddress, addr,
|
||||
&table_slot->target_constant)) {
|
||||
// Got slot! Just write the compare and we're done.
|
||||
table_slot->address_constant = static_cast<uint32_t>(target_address);
|
||||
wrote_ic = true;
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
#ifndef XENIA_BACKEND_X64_X64_EMITTER_H_
|
||||
#define XENIA_BACKEND_X64_X64_EMITTER_H_
|
||||
|
||||
#include "xenia/cpu/hir/value.h"
|
||||
#include "poly/arena.h"
|
||||
#include "third_party/xbyak/xbyak/xbyak.h"
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/cpu/hir/value.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
class DebugInfo;
|
||||
@@ -32,8 +33,6 @@ namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
using vec128_t = poly::vec128_t;
|
||||
|
||||
class X64Backend;
|
||||
class X64CodeCache;
|
||||
|
||||
@@ -196,7 +195,7 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
hir::Instr* current_instr_;
|
||||
|
||||
size_t source_map_count_;
|
||||
poly::Arena source_map_arena_;
|
||||
Arena source_map_arena_;
|
||||
|
||||
size_t stack_size_;
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_sequences.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -43,8 +43,6 @@ using namespace Xbyak;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu;
|
||||
|
||||
using poly::vec128b;
|
||||
|
||||
typedef bool (*SequenceSelectFn)(X64Emitter&, const Instr*, const Instr**);
|
||||
std::unordered_multimap<uint32_t, SequenceSelectFn> sequence_table;
|
||||
|
||||
@@ -1022,7 +1020,7 @@ EMITTER(LOAD_VECTOR_SHL_I8, MATCH(I<OPCODE_LOAD_VECTOR_SHL, V128<>, I8<>>)) {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
if (i.src1.is_constant) {
|
||||
auto sh = i.src1.constant();
|
||||
assert_true(sh < poly::countof(lvsl_table));
|
||||
assert_true(sh < xe::countof(lvsl_table));
|
||||
e.mov(e.rax, (uintptr_t)&lvsl_table[sh]);
|
||||
e.vmovaps(i.dest, e.ptr[e.rax]);
|
||||
} else {
|
||||
@@ -1066,7 +1064,7 @@ EMITTER(LOAD_VECTOR_SHR_I8, MATCH(I<OPCODE_LOAD_VECTOR_SHR, V128<>, I8<>>)) {
|
||||
static void Emit(X64Emitter& e, const EmitArgType& i) {
|
||||
if (i.src1.is_constant) {
|
||||
auto sh = i.src1.constant();
|
||||
assert_true(sh < poly::countof(lvsr_table));
|
||||
assert_true(sh < xe::countof(lvsr_table));
|
||||
e.mov(e.rax, (uintptr_t)&lvsr_table[sh]);
|
||||
e.vmovaps(i.dest, e.ptr[e.rax]);
|
||||
} else {
|
||||
@@ -1095,7 +1093,7 @@ EMITTER(LOAD_CLOCK, MATCH(I<OPCODE_LOAD_CLOCK, I64<>>)) {
|
||||
e.mov(i.dest, e.rax);
|
||||
}
|
||||
static uint64_t LoadClock(void* raw_context) {
|
||||
return poly::threading::ticks();
|
||||
return xe::threading::ticks();
|
||||
}
|
||||
};
|
||||
EMITTER_OPCODE_TABLE(
|
||||
@@ -4697,7 +4695,7 @@ EMITTER(VECTOR_ROTATE_LEFT_V128, MATCH(I<OPCODE_VECTOR_ROTATE_LEFT, V128<>, V128
|
||||
_mm_store_si128(reinterpret_cast<__m128i*>(value), src1);
|
||||
_mm_store_si128(reinterpret_cast<__m128i*>(shamt), src2);
|
||||
for (size_t i = 0; i < 16; ++i) {
|
||||
value[i] = poly::rotate_left<uint8_t>(value[i], shamt[i] & 0x7);
|
||||
value[i] = xe::rotate_left<uint8_t>(value[i], shamt[i] & 0x7);
|
||||
}
|
||||
return _mm_load_si128(reinterpret_cast<__m128i*>(value));
|
||||
}
|
||||
@@ -4707,7 +4705,7 @@ EMITTER(VECTOR_ROTATE_LEFT_V128, MATCH(I<OPCODE_VECTOR_ROTATE_LEFT, V128<>, V128
|
||||
_mm_store_si128(reinterpret_cast<__m128i*>(value), src1);
|
||||
_mm_store_si128(reinterpret_cast<__m128i*>(shamt), src2);
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
value[i] = poly::rotate_left<uint16_t>(value[i], shamt[i] & 0xF);
|
||||
value[i] = xe::rotate_left<uint16_t>(value[i], shamt[i] & 0xF);
|
||||
}
|
||||
return _mm_load_si128(reinterpret_cast<__m128i*>(value));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/base/vec128.h"
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
@@ -71,23 +71,22 @@ void TraceContextLoadI64(void* raw_context, uint64_t offset, uint64_t value) {
|
||||
}
|
||||
void TraceContextLoadF32(void* raw_context, uint64_t offset, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("%e (%X) = ctx f32 +%llu\n", poly::m128_f32<0>(value),
|
||||
poly::m128_i32<0>(value), offset);
|
||||
DPRINT("%e (%X) = ctx f32 +%llu\n", xe::m128_f32<0>(value),
|
||||
xe::m128_i32<0>(value), offset);
|
||||
}
|
||||
void TraceContextLoadF64(void* raw_context, uint64_t offset,
|
||||
const double* value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
auto v = _mm_loadu_pd(value);
|
||||
DPRINT("%le (%llX) = ctx f64 +%llu\n", poly::m128_f64<0>(v),
|
||||
poly::m128_i64<0>(v), offset);
|
||||
DPRINT("%le (%llX) = ctx f64 +%llu\n", xe::m128_f64<0>(v), xe::m128_i64<0>(v),
|
||||
offset);
|
||||
}
|
||||
void TraceContextLoadV128(void* raw_context, uint64_t offset, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("[%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X] = ctx v128 +%llu\n",
|
||||
poly::m128_f32<0>(value), poly::m128_f32<1>(value),
|
||||
poly::m128_f32<2>(value), poly::m128_f32<3>(value),
|
||||
poly::m128_i32<0>(value), poly::m128_i32<1>(value),
|
||||
poly::m128_i32<2>(value), poly::m128_i32<3>(value), offset);
|
||||
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
||||
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
||||
xe::m128_i32<2>(value), xe::m128_i32<3>(value), offset);
|
||||
}
|
||||
|
||||
void TraceContextStoreI8(void* raw_context, uint64_t offset, uint8_t value) {
|
||||
@@ -108,23 +107,22 @@ void TraceContextStoreI64(void* raw_context, uint64_t offset, uint64_t value) {
|
||||
}
|
||||
void TraceContextStoreF32(void* raw_context, uint64_t offset, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("ctx f32 +%llu = %e (%X)\n", offset, poly::m128_f32<0>(value),
|
||||
poly::m128_i32<0>(value));
|
||||
DPRINT("ctx f32 +%llu = %e (%X)\n", offset, xe::m128_f32<0>(value),
|
||||
xe::m128_i32<0>(value));
|
||||
}
|
||||
void TraceContextStoreF64(void* raw_context, uint64_t offset,
|
||||
const double* value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
auto v = _mm_loadu_pd(value);
|
||||
DPRINT("ctx f64 +%llu = %le (%llX)\n", offset, poly::m128_f64<0>(v),
|
||||
poly::m128_i64<0>(v));
|
||||
DPRINT("ctx f64 +%llu = %le (%llX)\n", offset, xe::m128_f64<0>(v),
|
||||
xe::m128_i64<0>(v));
|
||||
}
|
||||
void TraceContextStoreV128(void* raw_context, uint64_t offset, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("ctx v128 +%llu = [%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X]\n", offset,
|
||||
poly::m128_f32<0>(value), poly::m128_f32<1>(value),
|
||||
poly::m128_f32<2>(value), poly::m128_f32<3>(value),
|
||||
poly::m128_i32<0>(value), poly::m128_i32<1>(value),
|
||||
poly::m128_i32<2>(value), poly::m128_i32<3>(value));
|
||||
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
||||
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
||||
xe::m128_i32<2>(value), xe::m128_i32<3>(value));
|
||||
}
|
||||
|
||||
void TraceMemoryLoadI8(void* raw_context, uint32_t address, uint8_t value) {
|
||||
@@ -145,21 +143,20 @@ void TraceMemoryLoadI64(void* raw_context, uint32_t address, uint64_t value) {
|
||||
}
|
||||
void TraceMemoryLoadF32(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("%e (%X) = load.f32 %.8X\n", poly::m128_f32<0>(value),
|
||||
poly::m128_i32<0>(value), address);
|
||||
DPRINT("%e (%X) = load.f32 %.8X\n", xe::m128_f32<0>(value),
|
||||
xe::m128_i32<0>(value), address);
|
||||
}
|
||||
void TraceMemoryLoadF64(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("%le (%llX) = load.f64 %.8X\n", poly::m128_f64<0>(value),
|
||||
poly::m128_i64<0>(value), address);
|
||||
DPRINT("%le (%llX) = load.f64 %.8X\n", xe::m128_f64<0>(value),
|
||||
xe::m128_i64<0>(value), address);
|
||||
}
|
||||
void TraceMemoryLoadV128(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("[%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X] = load.v128 %.8X\n",
|
||||
poly::m128_f32<0>(value), poly::m128_f32<1>(value),
|
||||
poly::m128_f32<2>(value), poly::m128_f32<3>(value),
|
||||
poly::m128_i32<0>(value), poly::m128_i32<1>(value),
|
||||
poly::m128_i32<2>(value), poly::m128_i32<3>(value), address);
|
||||
xe::m128_f32<0>(value), xe::m128_f32<1>(value), xe::m128_f32<2>(value),
|
||||
xe::m128_f32<3>(value), xe::m128_i32<0>(value), xe::m128_i32<1>(value),
|
||||
xe::m128_i32<2>(value), xe::m128_i32<3>(value), address);
|
||||
}
|
||||
|
||||
void TraceMemoryStoreI8(void* raw_context, uint32_t address, uint8_t value) {
|
||||
@@ -180,21 +177,21 @@ void TraceMemoryStoreI64(void* raw_context, uint32_t address, uint64_t value) {
|
||||
}
|
||||
void TraceMemoryStoreF32(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("store.f32 %.8X = %e (%X)\n", address, poly::m128_f32<0>(value),
|
||||
poly::m128_i32<0>(value));
|
||||
DPRINT("store.f32 %.8X = %e (%X)\n", address, xe::m128_f32<0>(value),
|
||||
xe::m128_i32<0>(value));
|
||||
}
|
||||
void TraceMemoryStoreF64(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("store.f64 %.8X = %le (%llX)\n", address, poly::m128_f64<0>(value),
|
||||
poly::m128_i64<0>(value));
|
||||
DPRINT("store.f64 %.8X = %le (%llX)\n", address, xe::m128_f64<0>(value),
|
||||
xe::m128_i64<0>(value));
|
||||
}
|
||||
void TraceMemoryStoreV128(void* raw_context, uint32_t address, __m128 value) {
|
||||
auto thread_state = *((ThreadState**)raw_context);
|
||||
DPRINT("store.v128 %.8X = [%e, %e, %e, %e] [%.8X, %.8X, %.8X, %.8X]\n",
|
||||
address, poly::m128_f32<0>(value), poly::m128_f32<1>(value),
|
||||
poly::m128_f32<2>(value), poly::m128_f32<3>(value),
|
||||
poly::m128_i32<0>(value), poly::m128_i32<1>(value),
|
||||
poly::m128_i32<2>(value), poly::m128_i32<3>(value));
|
||||
address, xe::m128_f32<0>(value), xe::m128_f32<1>(value),
|
||||
xe::m128_f32<2>(value), xe::m128_f32<3>(value), xe::m128_i32<0>(value),
|
||||
xe::m128_i32<1>(value), xe::m128_i32<2>(value),
|
||||
xe::m128_i32<3>(value));
|
||||
}
|
||||
|
||||
} // namespace x64
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "poly/arena.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -34,7 +34,7 @@ class Compiler {
|
||||
~Compiler();
|
||||
|
||||
Runtime* runtime() const { return runtime_; }
|
||||
poly::Arena* scratch_arena() { return &scratch_arena_; }
|
||||
Arena* scratch_arena() { return &scratch_arena_; }
|
||||
|
||||
void AddPass(std::unique_ptr<CompilerPass> pass);
|
||||
|
||||
@@ -44,7 +44,7 @@ class Compiler {
|
||||
|
||||
private:
|
||||
Runtime* runtime_;
|
||||
poly::Arena scratch_arena_;
|
||||
Arena scratch_arena_;
|
||||
|
||||
std::vector<std::unique_ptr<CompilerPass>> passes_;
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ int CompilerPass::Initialize(Compiler* compiler) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
poly::Arena* CompilerPass::scratch_arena() const {
|
||||
Arena* CompilerPass::scratch_arena() const {
|
||||
return compiler_->scratch_arena();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#ifndef XENIA_COMPILER_COMPILER_PASS_H_
|
||||
#define XENIA_COMPILER_COMPILER_PASS_H_
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "poly/arena.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -35,7 +35,7 @@ class CompilerPass {
|
||||
virtual int Run(hir::HIRBuilder* builder) = 0;
|
||||
|
||||
protected:
|
||||
poly::Arena* scratch_arena() const;
|
||||
Arena* scratch_arena() const;
|
||||
|
||||
protected:
|
||||
Runtime* runtime_;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/compiler/passes/constant_propagation_pass.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef XENIA_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
#define XENIA_COMPILER_PASSES_CONTEXT_PROMOTION_PASS_H_
|
||||
|
||||
#include "poly/platform.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/cpu/compiler/compiler_pass.h"
|
||||
|
||||
#if XE_COMPILER_MSVC
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/cpu/compiler/passes/data_flow_analysis_pass.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/platform.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/cpu/backend/backend.h"
|
||||
#include "xenia/cpu/compiler/compiler.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -61,7 +61,7 @@ RegisterAllocationPass::RegisterAllocationPass(const MachineInfo* machine_info)
|
||||
}
|
||||
|
||||
RegisterAllocationPass::~RegisterAllocationPass() {
|
||||
for (size_t n = 0; n < poly::countof(usage_sets_.all_sets); n++) {
|
||||
for (size_t n = 0; n < xe::countof(usage_sets_.all_sets); n++) {
|
||||
if (!usage_sets_.all_sets[n]) {
|
||||
break;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
|
||||
void RegisterAllocationPass::DumpUsage(const char* name) {
|
||||
#if 0
|
||||
fprintf(stdout, "\n%s:\n", name);
|
||||
for (size_t i = 0; i < poly::countof(usage_sets_.all_sets); ++i) {
|
||||
for (size_t i = 0; i < xe::countof(usage_sets_.all_sets); ++i) {
|
||||
auto usage_set = usage_sets_.all_sets[i];
|
||||
if (usage_set) {
|
||||
fprintf(stdout, "set %s:\n", usage_set->set->name);
|
||||
@@ -194,7 +194,7 @@ void RegisterAllocationPass::DumpUsage(const char* name) {
|
||||
}
|
||||
|
||||
void RegisterAllocationPass::PrepareBlockState() {
|
||||
for (size_t i = 0; i < poly::countof(usage_sets_.all_sets); ++i) {
|
||||
for (size_t i = 0; i < xe::countof(usage_sets_.all_sets); ++i) {
|
||||
auto usage_set = usage_sets_.all_sets[i];
|
||||
if (usage_set) {
|
||||
usage_set->availability.set();
|
||||
@@ -205,7 +205,7 @@ void RegisterAllocationPass::PrepareBlockState() {
|
||||
}
|
||||
|
||||
void RegisterAllocationPass::AdvanceUses(Instr* instr) {
|
||||
for (size_t i = 0; i < poly::countof(usage_sets_.all_sets); ++i) {
|
||||
for (size_t i = 0; i < xe::countof(usage_sets_.all_sets); ++i) {
|
||||
auto usage_set = usage_sets_.all_sets[i];
|
||||
if (!usage_set) {
|
||||
break;
|
||||
@@ -310,7 +310,7 @@ bool RegisterAllocationPass::TryAllocateRegister(Value* value) {
|
||||
// Find the first free register, if any.
|
||||
// We have to ensure it's a valid one (in our count).
|
||||
uint32_t first_unused = 0;
|
||||
bool none_used = poly::bit_scan_forward(
|
||||
bool none_used = xe::bit_scan_forward(
|
||||
static_cast<uint32_t>(usage_set->availability.to_ulong()), &first_unused);
|
||||
if (none_used && first_unused < usage_set->count) {
|
||||
// Available! Use it!
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/compiler/passes/validation_pass.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/backend/backend.h"
|
||||
#include "xenia/cpu/compiler/compiler.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/compiler/passes/value_reduction_pass.h"
|
||||
|
||||
#include "poly/platform.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/cpu/backend/backend.h"
|
||||
#include "xenia/cpu/compiler/compiler.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "poly/delegate.h"
|
||||
#include "xenia/base/delegate.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -104,7 +104,7 @@ class Debugger {
|
||||
void OnBreakpointHit(ThreadState* thread_state, Breakpoint* breakpoint);
|
||||
|
||||
public:
|
||||
poly::Delegate<BreakpointHitEvent> breakpoint_hit;
|
||||
Delegate<BreakpointHitEvent> breakpoint_hit;
|
||||
|
||||
private:
|
||||
Runtime* runtime_;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/entry_table.h"
|
||||
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -53,7 +53,7 @@ Entry::Status EntryTable::GetOrCreate(uint32_t address, Entry** out_entry) {
|
||||
do {
|
||||
lock_.unlock();
|
||||
// TODO(benvanik): sleep for less time?
|
||||
poly::threading::Sleep(std::chrono::microseconds(10));
|
||||
xe::threading::Sleep(std::chrono::microseconds(10));
|
||||
lock_.lock();
|
||||
} while (entry->status == Entry::STATUS_COMPILING);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/base/vec128.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -25,8 +25,6 @@ namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
using vec128_t = poly::vec128_t;
|
||||
|
||||
// Map:
|
||||
// 0-31: GPR
|
||||
// 32-63: FPR
|
||||
|
||||
@@ -9,63 +9,63 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_0(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s ???", i.type->name);
|
||||
}
|
||||
|
||||
void Disasm__(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm__(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s", i.type->name);
|
||||
}
|
||||
|
||||
void Disasm_X_FRT_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_A_FRT_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB, i.A.FRC);
|
||||
}
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s r%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s f%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_D_RT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
@@ -74,11 +74,11 @@ void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->Append("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
@@ -87,11 +87,11 @@ void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
}
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.DS.RA) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
@@ -100,29 +100,29 @@ void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
}
|
||||
}
|
||||
void Disasm_D_RA(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d", i.type->name, i.D.RA);
|
||||
}
|
||||
void Disasm_X_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s%s r%d, r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA,
|
||||
i.XO.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s%s r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA);
|
||||
}
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_D_RA_RT_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-7s. r%d, r%d, %.4Xh", i.type->name, i.D.RA, i.D.RT, i.D.DS);
|
||||
}
|
||||
void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT);
|
||||
}
|
||||
@@ -161,14 +161,14 @@ void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str) {
|
||||
(i.VX128_R.VA128l | (i.VX128_R.VA128h << 5) | (i.VX128_R.VA128H << 6))
|
||||
#define VX128_R_VB128 (i.VX128_R.VB128l | (i.VX128_R.VB128h << 5))
|
||||
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s v%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s v%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_1_VD128;
|
||||
if (i.VX128_1.RA) {
|
||||
str->Append("%-8s v%d, r%d, r%d", i.type->name, vd, i.VX128_1.RA,
|
||||
@@ -177,45 +177,45 @@ void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s v%d, 0, r%d", i.type->name, vd, i.VX128_1.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->Append("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
}
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t uimm = i.VX128_3.IMM;
|
||||
str->Append("%-8s v%d, v%d, %.2Xh", i.type->name, vd, va, uimm);
|
||||
}
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, v%d", i.type->name, i.VX.VD, i.VX.VA, i.VX.VB);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->Append("%-8s v%d, v%d, v%d", i.type->name, vd, va, vb);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vd, vb);
|
||||
}
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_2_VD128;
|
||||
const uint32_t va = VX128_2_VA128;
|
||||
const uint32_t vb = VX128_2_VB128;
|
||||
const uint32_t vc = i.VX128_2.VC;
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vb, vc);
|
||||
}
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, i.VXA.VD, i.VXA.VA,
|
||||
i.VXA.VB, i.VXA.VC);
|
||||
}
|
||||
|
||||
void Disasm_sync(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str) {
|
||||
const char* name;
|
||||
int L = i.X.RT & 3;
|
||||
switch (L) {
|
||||
@@ -234,7 +234,7 @@ void Disasm_sync(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %.2X", name, L);
|
||||
}
|
||||
|
||||
void Disasm_dcbf(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str) {
|
||||
const char* name;
|
||||
switch (i.X.RT & 3) {
|
||||
case 0:
|
||||
@@ -256,7 +256,7 @@ void Disasm_dcbf(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d", name, i.X.RA, i.X.RB);
|
||||
}
|
||||
|
||||
void Disasm_dcbz(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str) {
|
||||
// or dcbz128 0x7C2007EC
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
@@ -265,16 +265,16 @@ void Disasm_dcbz(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
}
|
||||
|
||||
void Disasm_fcmp(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, f%d, f%d", i.type->name, i.X.RT >> 2, i.X.RA, i.X.RB);
|
||||
}
|
||||
|
||||
void Disasm_mffsx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mffsx(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, FPSCR", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT);
|
||||
}
|
||||
|
||||
void Disasm_bx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str) {
|
||||
const char* name = i.I.LK ? "bl" : "b";
|
||||
uint32_t nia;
|
||||
if (i.I.AA) {
|
||||
@@ -285,7 +285,7 @@ void Disasm_bx(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %.8X", name, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str) {
|
||||
const char* s0 = i.B.LK ? "lr, " : "";
|
||||
const char* s1;
|
||||
if (!select_bits(i.B.BO, 2, 2)) {
|
||||
@@ -295,7 +295,7 @@ void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.B.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.B.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.B.BI >> 2);
|
||||
}
|
||||
uint32_t nia;
|
||||
if (i.B.AA) {
|
||||
@@ -306,17 +306,17 @@ void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %s%s%s%.8X", i.type->name, s0, s1, s2, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcctrx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str) {
|
||||
// TODO(benvanik): mnemonics
|
||||
const char* s0 = i.XL.LK ? "lr, " : "";
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
}
|
||||
str->Append("%-8s %s%sctr", i.type->name, s0, s2);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bclrx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str) {
|
||||
const char* name = "bclr";
|
||||
if (i.code == 0x4E800020) {
|
||||
name = "blr";
|
||||
@@ -329,12 +329,12 @@ void Disasm_bclrx(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
}
|
||||
str->Append("%-8s %s%s", name, s1, s2);
|
||||
}
|
||||
|
||||
void Disasm_mfcr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, cr", i.type->name, i.X.RT);
|
||||
}
|
||||
const char* Disasm_spr_name(uint32_t n) {
|
||||
@@ -352,40 +352,40 @@ const char* Disasm_spr_name(uint32_t n) {
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
void Disasm_mfspr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->Append("%-8s r%d, %s", i.type->name, i.XFX.RT, reg);
|
||||
}
|
||||
void Disasm_mtspr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->Append("%-8s %s, r%d", i.type->name, reg, i.XFX.RT);
|
||||
}
|
||||
void Disasm_mftb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, tb", i.type->name, i.XFX.RT);
|
||||
}
|
||||
void Disasm_mfmsr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d", i.type->name, i.X.RT);
|
||||
}
|
||||
void Disasm_mtmsr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, %d", i.type->name, i.X.RT, (i.X.RA & 16) ? 1 : 0);
|
||||
}
|
||||
|
||||
void Disasm_cmp(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, r%d", i.type->name, i.X.RT >> 2,
|
||||
i.X.RT & 1, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_cmpi(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, %d", i.type->name, i.D.RT >> 2, i.D.RT & 1,
|
||||
i.D.RA, XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_cmpli(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, %.2X", i.type->name, i.D.RT >> 2,
|
||||
i.D.RT & 1, i.D.RA, XEEXTS16(i.D.DS));
|
||||
}
|
||||
|
||||
void Disasm_rld(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str) {
|
||||
if (i.MD.idx == 0) {
|
||||
// XEDISASMR(rldiclx, 0x78000000, MD )
|
||||
str->Append("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, "rldicl",
|
||||
@@ -422,75 +422,75 @@ void Disasm_rld(InstrData& i, poly::StringBuffer* str) {
|
||||
assert_always();
|
||||
}
|
||||
}
|
||||
void Disasm_rlwim(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d, %d, %d", i.M.Rc ? -7 : -8, i.type->name,
|
||||
i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH, i.M.MB, i.M.ME);
|
||||
}
|
||||
void Disasm_rlwnmx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, r%d, %d, %d", i.M.Rc ? -7 : -8, i.type->name,
|
||||
i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH, i.M.MB, i.M.ME);
|
||||
}
|
||||
void Disasm_srawix(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_sradix(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d", i.XS.Rc ? -7 : -8, i.type->name,
|
||||
i.XS.Rc ? "." : "", i.XS.RA, i.XS.RT, (i.XS.SH5 << 5) | i.XS.SH);
|
||||
}
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = i.VX128_P.VD128l | (i.VX128_P.VD128h << 5);
|
||||
const uint32_t vb = i.VX128_P.VB128l | (i.VX128_P.VB128h << 5);
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, vd, vb,
|
||||
i.VX128_P.PERMl | (i.VX128_P.PERMh << 5));
|
||||
}
|
||||
void Disasm_vrfin128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->Append("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
}
|
||||
void Disasm_vrlimi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_4_VD128;
|
||||
const uint32_t vb = VX128_4_VB128;
|
||||
str->Append("%-8s v%d, v%d, %.2X, %.2X", i.type->name, vd, vb, i.VX128_4.IMM,
|
||||
i.VX128_4.z);
|
||||
}
|
||||
void Disasm_vsldoi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_5_VD128;
|
||||
const uint32_t va = VX128_5_VA128;
|
||||
const uint32_t vb = VX128_5_VB128;
|
||||
const uint32_t sh = i.VX128_5.SH;
|
||||
str->Append("%-8s v%d, v%d, v%d, %.2X", i.type->name, vd, va, vb, sh);
|
||||
}
|
||||
void Disasm_vspltb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0xF);
|
||||
}
|
||||
void Disasm_vsplth(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0x7);
|
||||
}
|
||||
void Disasm_vspltw(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB, i.VX.VA);
|
||||
}
|
||||
void Disasm_vspltisb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 8bit sign extend
|
||||
int8_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.2X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltish(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 16bit sign extend
|
||||
int16_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.4X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltisw(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 32bit sign extend
|
||||
int32_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFFFFFF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.8X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
|
||||
int DisasmPPC(InstrData& i, poly::StringBuffer* str) {
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str) {
|
||||
if (!i.type) {
|
||||
str->Append("???");
|
||||
} else {
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#ifndef XENIA_FRONTEND_PPC_DISASM_H_
|
||||
#define XENIA_FRONTEND_PPC_DISASM_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
int DisasmPPC(InstrData& i, poly::StringBuffer* str);
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str);
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace cpu
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
@@ -19,10 +19,6 @@ namespace frontend {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace xe::cpu::hir;
|
||||
using poly::vec128b;
|
||||
using poly::vec128f;
|
||||
using poly::vec128i;
|
||||
using poly::vec128s;
|
||||
|
||||
using xe::cpu::hir::Value;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "poly/type_pool.h"
|
||||
#include "xenia/base/type_pool.h"
|
||||
#include "xenia/cpu/frontend/context_info.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/memory.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -58,7 +58,7 @@ class PPCFrontend {
|
||||
Runtime* runtime_;
|
||||
std::unique_ptr<ContextInfo> context_info_;
|
||||
PPCBuiltins builtins_;
|
||||
poly::TypePool<PPCTranslator, PPCFrontend*> translator_pool_;
|
||||
TypePool<PPCTranslator, PPCFrontend*> translator_pool_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -82,7 +82,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
for (uint32_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
trace_info_.dest_count = 0;
|
||||
@@ -170,7 +170,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
|
||||
void PPCHIRBuilder::AnnotateLabel(uint32_t address, Label* label) {
|
||||
char name_buffer[13];
|
||||
snprintf(name_buffer, poly::countof(name_buffer), "loc_%.8X", address);
|
||||
snprintf(name_buffer, xe::countof(name_buffer), "loc_%.8X", address);
|
||||
label->name = (char*)arena_->Alloc(sizeof(name_buffer));
|
||||
memcpy(label->name, name_buffer, sizeof(name_buffer));
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#ifndef XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#define XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -91,7 +91,7 @@ class PPCHIRBuilder : public hir::HIRBuilder {
|
||||
PPCFrontend* frontend_;
|
||||
|
||||
// Reset whenever needed:
|
||||
poly::StringBuffer comment_buffer_;
|
||||
StringBuffer comment_buffer_;
|
||||
|
||||
// Reset each Emit:
|
||||
bool with_debug_info_;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr_tables.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -24,7 +24,7 @@ namespace frontend {
|
||||
std::vector<InstrType*> all_instrs_;
|
||||
|
||||
void DumpAllInstrCounts() {
|
||||
poly::StringBuffer sb;
|
||||
StringBuffer sb;
|
||||
sb.Append("Instruction translation counts:\n");
|
||||
for (auto instr_type : all_instrs_) {
|
||||
if (instr_type->translation_count) {
|
||||
@@ -42,7 +42,7 @@ void InstrOperand::Dump(std::string& out_str) {
|
||||
}
|
||||
|
||||
char buffer[32];
|
||||
const size_t max_count = poly::countof(buffer);
|
||||
const size_t max_count = xe::countof(buffer);
|
||||
switch (type) {
|
||||
case InstrOperand::kRegister:
|
||||
switch (reg.set) {
|
||||
@@ -380,7 +380,7 @@ InstrType* GetInstrType(uint32_t code) {
|
||||
|
||||
// Slow lookup via linear scan.
|
||||
// This is primarily due to laziness. It could be made fast like the others.
|
||||
for (size_t n = 0; n < poly::countof(tables::instr_table_scan); n++) {
|
||||
for (size_t n = 0; n < xe::countof(tables::instr_table_scan); n++) {
|
||||
slot = &(tables::instr_table_scan[n]);
|
||||
if (slot->opcode == (code & slot->opcode_mask)) {
|
||||
return slot;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -547,7 +547,7 @@ class InstrDisasm {
|
||||
void Dump(std::string& out_str, size_t pad = 13);
|
||||
};
|
||||
|
||||
typedef void (*InstrDisasmFn)(InstrData& i, poly::StringBuffer* str);
|
||||
typedef void (*InstrDisasmFn)(InstrData& i, StringBuffer* str);
|
||||
typedef void* InstrEmitFn;
|
||||
|
||||
class InstrType {
|
||||
|
||||
@@ -12,84 +12,84 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm__(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_0(InstrData& i, StringBuffer* str);
|
||||
void Disasm__(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_sync(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_bx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bcx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_mfcr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mftb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_cmp(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_rld(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_srawix(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_sradix(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str);
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str);
|
||||
|
||||
namespace tables {
|
||||
|
||||
@@ -364,7 +364,7 @@ static InstrType instr_table_4_unprep[] = {
|
||||
"Vector Logical XOR"),
|
||||
};
|
||||
static InstrType** instr_table_4 = instr_table_prep(
|
||||
instr_table_4_unprep, poly::countof(instr_table_4_unprep), 0, 11);
|
||||
instr_table_4_unprep, xe::countof(instr_table_4_unprep), 0, 11);
|
||||
|
||||
// Opcode = 19, index = bits 10-1 (10)
|
||||
static InstrType instr_table_19_unprep[] = {
|
||||
@@ -384,7 +384,7 @@ static InstrType instr_table_19_unprep[] = {
|
||||
"Branch Conditional to Count Register"),
|
||||
};
|
||||
static InstrType** instr_table_19 = instr_table_prep(
|
||||
instr_table_19_unprep, poly::countof(instr_table_19_unprep), 1, 10);
|
||||
instr_table_19_unprep, xe::countof(instr_table_19_unprep), 1, 10);
|
||||
|
||||
// Opcode = 30, index = bits 4-1 (4)
|
||||
static InstrType instr_table_30_unprep[] = {
|
||||
@@ -400,7 +400,7 @@ static InstrType instr_table_30_unprep[] = {
|
||||
// INSTRUCTION(rldcrx, 0x78000012, MDS, General , 0),
|
||||
};
|
||||
static InstrType** instr_table_30 = instr_table_prep(
|
||||
instr_table_30_unprep, poly::countof(instr_table_30_unprep), 0, 0);
|
||||
instr_table_30_unprep, xe::countof(instr_table_30_unprep), 0, 0);
|
||||
|
||||
// Opcode = 31, index = bits 10-1 (10)
|
||||
static InstrType instr_table_31_unprep[] = {
|
||||
@@ -651,7 +651,7 @@ static InstrType instr_table_31_unprep[] = {
|
||||
"Store Vector Right Indexed LRU"),
|
||||
};
|
||||
static InstrType** instr_table_31 = instr_table_prep(
|
||||
instr_table_31_unprep, poly::countof(instr_table_31_unprep), 1, 10);
|
||||
instr_table_31_unprep, xe::countof(instr_table_31_unprep), 1, 10);
|
||||
|
||||
// Opcode = 58, index = bits 1-0 (2)
|
||||
static InstrType instr_table_58_unprep[] = {
|
||||
@@ -662,7 +662,7 @@ static InstrType instr_table_58_unprep[] = {
|
||||
"Load Word Algebraic"),
|
||||
};
|
||||
static InstrType** instr_table_58 = instr_table_prep(
|
||||
instr_table_58_unprep, poly::countof(instr_table_58_unprep), 0, 1);
|
||||
instr_table_58_unprep, xe::countof(instr_table_58_unprep), 0, 1);
|
||||
|
||||
// Opcode = 59, index = bits 5-1 (5)
|
||||
static InstrType instr_table_59_unprep[] = {
|
||||
@@ -688,7 +688,7 @@ static InstrType instr_table_59_unprep[] = {
|
||||
"Floating Negative Multiply-Add [Single]"),
|
||||
};
|
||||
static InstrType** instr_table_59 = instr_table_prep(
|
||||
instr_table_59_unprep, poly::countof(instr_table_59_unprep), 1, 5);
|
||||
instr_table_59_unprep, xe::countof(instr_table_59_unprep), 1, 5);
|
||||
|
||||
// Opcode = 62, index = bits 1-0 (2)
|
||||
static InstrType instr_table_62_unprep[] = {
|
||||
@@ -697,7 +697,7 @@ static InstrType instr_table_62_unprep[] = {
|
||||
"Store Doubleword with Update"),
|
||||
};
|
||||
static InstrType** instr_table_62 = instr_table_prep(
|
||||
instr_table_62_unprep, poly::countof(instr_table_62_unprep), 0, 1);
|
||||
instr_table_62_unprep, xe::countof(instr_table_62_unprep), 0, 1);
|
||||
|
||||
// Opcode = 63, index = bits 10-1 (10)
|
||||
// NOTE: the A format instructions need some special handling because
|
||||
@@ -757,7 +757,7 @@ static InstrType instr_table_63_unprep[] = {
|
||||
"Floating Convert From Integer Doubleword"),
|
||||
};
|
||||
static InstrType** instr_table_63 = instr_table_prep_63(
|
||||
instr_table_63_unprep, poly::countof(instr_table_63_unprep), 1, 10);
|
||||
instr_table_63_unprep, xe::countof(instr_table_63_unprep), 1, 10);
|
||||
|
||||
// Main table, index = bits 31-26 (6) : (code >> 26)
|
||||
static InstrType instr_table_unprep[64] = {
|
||||
@@ -837,7 +837,7 @@ static InstrType instr_table_unprep[64] = {
|
||||
"Store Floating-Point Double with Update"),
|
||||
};
|
||||
static InstrType** instr_table = instr_table_prep(
|
||||
instr_table_unprep, poly::countof(instr_table_unprep), 26, 31);
|
||||
instr_table_unprep, xe::countof(instr_table_unprep), 26, 31);
|
||||
|
||||
// Altivec instructions.
|
||||
// TODO(benvanik): build a table like the other instructions.
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#if 0
|
||||
@@ -63,7 +63,7 @@ int PPCScanner::FindExtents(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
while (true) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
|
||||
// If we fetched 0 assume that we somehow hit one of the awesome
|
||||
// 'no really we meant to end after that bl' functions.
|
||||
@@ -290,7 +290,7 @@ std::vector<BlockInfo> PPCScanner::FindBlocks(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
for (uint32_t address = start_address; address <= end_address; address += 4) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
if (!i.code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_translator.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/memory.h"
|
||||
#include "poly/reset_scope.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/base/reset_scope.h"
|
||||
#include "xenia/cpu/compiler/compiler_passes.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
@@ -92,10 +92,10 @@ int PPCTranslator::Translate(FunctionInfo* symbol_info,
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
// Reset() all caching when we leave.
|
||||
poly::make_reset_scope(builder_);
|
||||
poly::make_reset_scope(compiler_);
|
||||
poly::make_reset_scope(assembler_);
|
||||
poly::make_reset_scope(&string_buffer_);
|
||||
xe::make_reset_scope(builder_);
|
||||
xe::make_reset_scope(compiler_);
|
||||
xe::make_reset_scope(assembler_);
|
||||
xe::make_reset_scope(&string_buffer_);
|
||||
|
||||
// Scan the function to find its extents. We only need to do this if we
|
||||
// haven't already been provided with them from some other source.
|
||||
@@ -176,7 +176,7 @@ int PPCTranslator::Translate(FunctionInfo* symbol_info,
|
||||
};
|
||||
|
||||
void PPCTranslator::DumpSource(FunctionInfo* symbol_info,
|
||||
poly::StringBuffer* string_buffer) {
|
||||
StringBuffer* string_buffer) {
|
||||
Memory* memory = frontend_->memory();
|
||||
|
||||
string_buffer->Append("%s fn %.8X-%.8X %s\n",
|
||||
@@ -193,7 +193,7 @@ void PPCTranslator::DumpSource(FunctionInfo* symbol_info,
|
||||
for (uint32_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/backend/assembler.h"
|
||||
#include "xenia/cpu/compiler/compiler.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -34,7 +34,7 @@ class PPCTranslator {
|
||||
uint32_t trace_flags, Function** out_function);
|
||||
|
||||
private:
|
||||
void DumpSource(FunctionInfo* symbol_info, poly::StringBuffer* string_buffer);
|
||||
void DumpSource(FunctionInfo* symbol_info, StringBuffer* string_buffer);
|
||||
|
||||
private:
|
||||
PPCFrontend* frontend_;
|
||||
@@ -43,7 +43,7 @@ class PPCTranslator {
|
||||
std::unique_ptr<compiler::Compiler> compiler_;
|
||||
std::unique_ptr<backend::Assembler> assembler_;
|
||||
|
||||
poly::StringBuffer string_buffer_;
|
||||
StringBuffer string_buffer_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/main.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/raw_module.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
#if !XE_PLATFORM_WIN32
|
||||
#include <dirent.h>
|
||||
@@ -48,11 +48,11 @@ struct TestCase {
|
||||
class TestSuite {
|
||||
public:
|
||||
TestSuite(const std::wstring& src_file_path) : src_file_path(src_file_path) {
|
||||
name = src_file_path.substr(
|
||||
src_file_path.find_last_of(poly::path_separator) + 1);
|
||||
name = src_file_path.substr(src_file_path.find_last_of(xe::path_separator) +
|
||||
1);
|
||||
name = ReplaceExtension(name, L"");
|
||||
map_file_path = poly::to_wstring(FLAGS_test_bin_path) + name + L".map";
|
||||
bin_file_path = poly::to_wstring(FLAGS_test_bin_path) + name + L".bin";
|
||||
map_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".map";
|
||||
bin_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".bin";
|
||||
}
|
||||
|
||||
bool Load() {
|
||||
@@ -92,7 +92,7 @@ class TestSuite {
|
||||
}
|
||||
|
||||
bool ReadMap(const std::wstring& map_file_path) {
|
||||
FILE* f = fopen(poly::to_string(map_file_path).c_str(), "r");
|
||||
FILE* f = fopen(xe::to_string(map_file_path).c_str(), "r");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class TestSuite {
|
||||
|
||||
bool ReadAnnotations(const std::wstring& src_file_path) {
|
||||
TestCase* current_test_case = nullptr;
|
||||
FILE* f = fopen(poly::to_string(src_file_path).c_str(), "r");
|
||||
FILE* f = fopen(xe::to_string(src_file_path).c_str(), "r");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ class TestRunner {
|
||||
auto reg_value = it.second.substr(space_pos + 1);
|
||||
if (!ppc_state->CompareRegWithString(reg_name.c_str(),
|
||||
reg_value.c_str(), actual_value,
|
||||
poly::countof(actual_value))) {
|
||||
xe::countof(actual_value))) {
|
||||
any_failed = true;
|
||||
printf("Register %s assert failed:\n", reg_name.c_str());
|
||||
printf(" Expected: %s == %s\n", reg_name.c_str(), reg_value.c_str());
|
||||
@@ -373,7 +373,7 @@ bool RunTests(const std::wstring& test_name) {
|
||||
int passed_count = 0;
|
||||
|
||||
auto test_path_root =
|
||||
poly::fix_path_separators(poly::to_wstring(FLAGS_test_path));
|
||||
xe::fix_path_separators(xe::to_wstring(FLAGS_test_path));
|
||||
std::vector<std::wstring> test_files;
|
||||
if (!DiscoverTests(test_path_root, test_files)) {
|
||||
return false;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include "xenia/cpu/function.h"
|
||||
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/debugger.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/hir/block.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/hir/instr.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef XENIA_HIR_BLOCK_H_
|
||||
#define XENIA_HIR_BLOCK_H_
|
||||
|
||||
#include "poly/arena.h"
|
||||
#include "xenia/base/arena.h"
|
||||
|
||||
namespace llvm {
|
||||
class BitVector;
|
||||
@@ -46,7 +46,7 @@ class Edge {
|
||||
|
||||
class Block {
|
||||
public:
|
||||
poly::Arena* arena;
|
||||
Arena* arena;
|
||||
|
||||
Block* next;
|
||||
Block* prev;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/hir/block.h"
|
||||
#include "xenia/cpu/hir/instr.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
@@ -29,7 +29,7 @@ namespace hir {
|
||||
assert_true((value1->type) == (value2->type))
|
||||
|
||||
HIRBuilder::HIRBuilder() {
|
||||
arena_ = new poly::Arena();
|
||||
arena_ = new Arena();
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int HIRBuilder::Finalize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HIRBuilder::DumpValue(poly::StringBuffer* str, Value* value) {
|
||||
void HIRBuilder::DumpValue(StringBuffer* str, Value* value) {
|
||||
if (value->IsConstant()) {
|
||||
switch (value->type) {
|
||||
case INT8_TYPE:
|
||||
@@ -128,7 +128,7 @@ void HIRBuilder::DumpValue(poly::StringBuffer* str, Value* value) {
|
||||
}
|
||||
}
|
||||
|
||||
void HIRBuilder::DumpOp(poly::StringBuffer* str, OpcodeSignatureType sig_type,
|
||||
void HIRBuilder::DumpOp(StringBuffer* str, OpcodeSignatureType sig_type,
|
||||
Instr::Op* op) {
|
||||
switch (sig_type) {
|
||||
case OPCODE_SIG_TYPE_X:
|
||||
@@ -155,7 +155,7 @@ void HIRBuilder::DumpOp(poly::StringBuffer* str, OpcodeSignatureType sig_type,
|
||||
}
|
||||
}
|
||||
|
||||
void HIRBuilder::Dump(poly::StringBuffer* str) {
|
||||
void HIRBuilder::Dump(StringBuffer* str) {
|
||||
if (attributes_) {
|
||||
str->Append("; attributes = %.8X\n", attributes_);
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/hir/block.h"
|
||||
#include "xenia/cpu/hir/instr.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/hir/opcodes.h"
|
||||
#include "xenia/cpu/hir/value.h"
|
||||
#include "poly/arena.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -36,10 +36,10 @@ class HIRBuilder {
|
||||
virtual void Reset();
|
||||
virtual int Finalize();
|
||||
|
||||
void Dump(poly::StringBuffer* str);
|
||||
void Dump(StringBuffer* str);
|
||||
void AssertNoCycles();
|
||||
|
||||
poly::Arena* arena() const { return arena_; }
|
||||
Arena* arena() const { return arena_; }
|
||||
|
||||
uint32_t attributes() const { return attributes_; }
|
||||
void set_attributes(uint32_t value) { attributes_ = value; }
|
||||
@@ -229,9 +229,8 @@ class HIRBuilder {
|
||||
Value* AtomicSub(Value* address, Value* value);
|
||||
|
||||
protected:
|
||||
void DumpValue(poly::StringBuffer* str, Value* value);
|
||||
void DumpOp(poly::StringBuffer* str, OpcodeSignatureType sig_type,
|
||||
Instr::Op* op);
|
||||
void DumpValue(StringBuffer* str, Value* value);
|
||||
void DumpOp(StringBuffer* str, OpcodeSignatureType sig_type, Instr::Op* op);
|
||||
|
||||
Value* AllocValue(TypeName type = INT64_TYPE);
|
||||
Value* CloneValue(Value* source);
|
||||
@@ -246,7 +245,7 @@ class HIRBuilder {
|
||||
TypeName part_type);
|
||||
|
||||
protected:
|
||||
poly::Arena* arena_;
|
||||
Arena* arena_;
|
||||
|
||||
uint32_t attributes_;
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace hir {
|
||||
|
||||
Value::Use* Value::AddUse(poly::Arena* arena, Instr* instr) {
|
||||
Value::Use* Value::AddUse(Arena* arena, Instr* instr) {
|
||||
Use* use = arena->Alloc<Use>();
|
||||
use->instr = instr;
|
||||
use->prev = NULL;
|
||||
@@ -587,17 +587,17 @@ void Value::ByteSwap() {
|
||||
constant.i8 = constant.i8;
|
||||
break;
|
||||
case INT16_TYPE:
|
||||
constant.i16 = poly::byte_swap(constant.i16);
|
||||
constant.i16 = xe::byte_swap(constant.i16);
|
||||
break;
|
||||
case INT32_TYPE:
|
||||
constant.i32 = poly::byte_swap(constant.i32);
|
||||
constant.i32 = xe::byte_swap(constant.i32);
|
||||
break;
|
||||
case INT64_TYPE:
|
||||
constant.i64 = poly::byte_swap(constant.i64);
|
||||
constant.i64 = xe::byte_swap(constant.i64);
|
||||
break;
|
||||
case VEC128_TYPE:
|
||||
for (int n = 0; n < 4; n++) {
|
||||
constant.v128.u32[n] = poly::byte_swap(constant.v128.u32[n]);
|
||||
constant.v128.u32[n] = xe::byte_swap(constant.v128.u32[n]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -609,16 +609,16 @@ void Value::ByteSwap() {
|
||||
void Value::CountLeadingZeros(const Value* other) {
|
||||
switch (other->type) {
|
||||
case INT8_TYPE:
|
||||
constant.i8 = poly::lzcnt(constant.i8);
|
||||
constant.i8 = xe::lzcnt(constant.i8);
|
||||
break;
|
||||
case INT16_TYPE:
|
||||
constant.i8 = poly::lzcnt(constant.i16);
|
||||
constant.i8 = xe::lzcnt(constant.i16);
|
||||
break;
|
||||
case INT32_TYPE:
|
||||
constant.i8 = poly::lzcnt(constant.i32);
|
||||
constant.i8 = xe::lzcnt(constant.i32);
|
||||
break;
|
||||
case INT64_TYPE:
|
||||
constant.i8 = poly::lzcnt(constant.i64);
|
||||
constant.i8 = xe::lzcnt(constant.i64);
|
||||
break;
|
||||
default:
|
||||
assert_unhandled_case(type);
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#ifndef XENIA_HIR_VALUE_H_
|
||||
#define XENIA_HIR_VALUE_H_
|
||||
|
||||
#include "poly/arena.h"
|
||||
#include "poly/assert.h"
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/base/arena.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/vec128.h"
|
||||
#include "xenia/cpu/backend/machine_info.h"
|
||||
#include "xenia/cpu/hir/opcodes.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace hir {
|
||||
|
||||
class Instr;
|
||||
|
||||
using vec128_t = poly::vec128_t;
|
||||
using vec128_t = xe::vec128_t;
|
||||
|
||||
enum TypeName {
|
||||
// Many tables rely on this ordering.
|
||||
@@ -102,7 +102,7 @@ class Value {
|
||||
// TODO(benvanik): remove to shrink size.
|
||||
void* tag;
|
||||
|
||||
Use* AddUse(poly::Arena* arena, Instr* instr);
|
||||
Use* AddUse(Arena* arena, Instr* instr);
|
||||
void RemoveUse(Use* use);
|
||||
|
||||
int8_t get_constant(int8_t) const { return constant.i8; }
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "xenia/cpu/mmio_handler.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace BE {
|
||||
#include <beaengine/BeaEngine.h>
|
||||
@@ -230,7 +230,7 @@ bool MMIOHandler::HandleAccessFault(void* thread_state,
|
||||
// register.
|
||||
uint64_t value = range->read(range->context, fault_address & 0xFFFFFFFF);
|
||||
uint32_t be_reg_index;
|
||||
if (!poly::bit_scan_forward(arg1_type & 0xFFFF, &be_reg_index)) {
|
||||
if (!xe::bit_scan_forward(arg1_type & 0xFFFF, &be_reg_index)) {
|
||||
be_reg_index = 0;
|
||||
}
|
||||
uint64_t* reg_ptr = GetThreadStateRegPtr(thread_state, be_reg_index);
|
||||
@@ -239,13 +239,13 @@ bool MMIOHandler::HandleAccessFault(void* thread_state,
|
||||
*reg_ptr = static_cast<uint8_t>(value);
|
||||
break;
|
||||
case 16:
|
||||
*reg_ptr = poly::byte_swap(static_cast<uint16_t>(value));
|
||||
*reg_ptr = xe::byte_swap(static_cast<uint16_t>(value));
|
||||
break;
|
||||
case 32:
|
||||
*reg_ptr = poly::byte_swap(static_cast<uint32_t>(value));
|
||||
*reg_ptr = xe::byte_swap(static_cast<uint32_t>(value));
|
||||
break;
|
||||
case 64:
|
||||
*reg_ptr = poly::byte_swap(static_cast<uint64_t>(value));
|
||||
*reg_ptr = xe::byte_swap(static_cast<uint64_t>(value));
|
||||
break;
|
||||
}
|
||||
} else if (is_store) {
|
||||
@@ -253,7 +253,7 @@ bool MMIOHandler::HandleAccessFault(void* thread_state,
|
||||
uint64_t value;
|
||||
if ((arg2_type & BE::REGISTER_TYPE) == BE::REGISTER_TYPE) {
|
||||
uint32_t be_reg_index;
|
||||
if (!poly::bit_scan_forward(arg2_type & 0xFFFF, &be_reg_index)) {
|
||||
if (!xe::bit_scan_forward(arg2_type & 0xFFFF, &be_reg_index)) {
|
||||
be_reg_index = 0;
|
||||
}
|
||||
uint64_t* reg_ptr = GetThreadStateRegPtr(thread_state, be_reg_index);
|
||||
@@ -269,13 +269,13 @@ bool MMIOHandler::HandleAccessFault(void* thread_state,
|
||||
value = static_cast<uint8_t>(value);
|
||||
break;
|
||||
case 16:
|
||||
value = poly::byte_swap(static_cast<uint16_t>(value));
|
||||
value = xe::byte_swap(static_cast<uint16_t>(value));
|
||||
break;
|
||||
case 32:
|
||||
value = poly::byte_swap(static_cast<uint32_t>(value));
|
||||
value = xe::byte_swap(static_cast<uint32_t>(value));
|
||||
break;
|
||||
case 64:
|
||||
value = poly::byte_swap(static_cast<uint64_t>(value));
|
||||
value = xe::byte_swap(static_cast<uint64_t>(value));
|
||||
break;
|
||||
}
|
||||
range->write(range->context, fault_address & 0xFFFFFFFF, value);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
||||
// Mach internal function, not defined in any header.
|
||||
// http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/exc_server.html
|
||||
@@ -117,7 +117,7 @@ void MachMMIOHandler::ThreadEntry() {
|
||||
listen_port_, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
|
||||
if (ret != MACH_MSG_SUCCESS) {
|
||||
XELOGE("mach_msg receive failed with %d %s", ret, mach_error_string(ret));
|
||||
poly::debugging::Break();
|
||||
xe::debugging::Break();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void MachMMIOHandler::ThreadEntry() {
|
||||
MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE,
|
||||
MACH_PORT_NULL) != MACH_MSG_SUCCESS) {
|
||||
XELOGE("mach_msg reply send failed");
|
||||
poly::debugging::Break();
|
||||
xe::debugging::Break();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ kern_return_t CatchExceptionRaise(mach_port_t thread) {
|
||||
XELOGE("MMIO unhandled bad access for %llx, bubbling", fault_address);
|
||||
// TODO(benvanik): manipulate stack so that we can rip = break_handler or
|
||||
// something and have the stack trace be valid.
|
||||
poly::debugging::Break();
|
||||
xe::debugging::Break();
|
||||
|
||||
// When the thread resumes, kill it.
|
||||
thread_state.__rip = reinterpret_cast<uint64_t>(FailBadAccess);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
@@ -37,7 +37,7 @@ SymbolInfo* Module::LookupSymbol(uint32_t address, bool wait) {
|
||||
do {
|
||||
lock_.unlock();
|
||||
// TODO(benvanik): sleep for less time?
|
||||
poly::threading::Sleep(std::chrono::microseconds(100));
|
||||
xe::threading::Sleep(std::chrono::microseconds(100));
|
||||
lock_.lock();
|
||||
} while (symbol_info->status() == SymbolInfo::STATUS_DECLARING);
|
||||
} else {
|
||||
@@ -70,7 +70,7 @@ SymbolInfo::Status Module::DeclareSymbol(SymbolInfo::Type type,
|
||||
do {
|
||||
lock_.unlock();
|
||||
// TODO(benvanik): sleep for less time?
|
||||
poly::threading::Sleep(std::chrono::microseconds(100));
|
||||
xe::threading::Sleep(std::chrono::microseconds(100));
|
||||
lock_.lock();
|
||||
} while (symbol_info->status() == SymbolInfo::STATUS_DECLARING);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ SymbolInfo::Status Module::DefineSymbol(SymbolInfo* symbol_info) {
|
||||
do {
|
||||
lock_.unlock();
|
||||
// TODO(benvanik): sleep for less time?
|
||||
poly::threading::Sleep(std::chrono::microseconds(100));
|
||||
xe::threading::Sleep(std::chrono::microseconds(100));
|
||||
lock_.lock();
|
||||
} while (symbol_info->status() == SymbolInfo::STATUS_DEFINING);
|
||||
status = symbol_info->status();
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
#include "xenia/cpu/processor.h"
|
||||
|
||||
#include "poly/atomic.h"
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/atomic.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/xex_module.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -151,13 +151,13 @@ uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address,
|
||||
|
||||
Irql Processor::RaiseIrql(Irql new_value) {
|
||||
return static_cast<Irql>(
|
||||
poly::atomic_exchange(static_cast<uint32_t>(new_value),
|
||||
reinterpret_cast<volatile uint32_t*>(&irql_)));
|
||||
xe::atomic_exchange(static_cast<uint32_t>(new_value),
|
||||
reinterpret_cast<volatile uint32_t*>(&irql_)));
|
||||
}
|
||||
|
||||
void Processor::LowerIrql(Irql old_value) {
|
||||
poly::atomic_exchange(static_cast<uint32_t>(old_value),
|
||||
reinterpret_cast<volatile uint32_t*>(&irql_));
|
||||
xe::atomic_exchange(static_cast<uint32_t>(old_value),
|
||||
reinterpret_cast<volatile uint32_t*>(&irql_));
|
||||
}
|
||||
|
||||
uint64_t Processor::ExecuteInterrupt(uint32_t cpu, uint32_t address,
|
||||
@@ -168,7 +168,7 @@ uint64_t Processor::ExecuteInterrupt(uint32_t cpu, uint32_t address,
|
||||
std::lock_guard<std::mutex> lock(interrupt_thread_lock_);
|
||||
|
||||
// Set 0x10C(r13) to the current CPU ID.
|
||||
poly::store_and_swap<uint8_t>(
|
||||
xe::store_and_swap<uint8_t>(
|
||||
memory_->TranslateVirtual(interrupt_thread_block_ + 0x10C), cpu);
|
||||
|
||||
// Execute interrupt.
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/cpu/raw_module.h"
|
||||
|
||||
#include "poly/platform.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/base/string.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -21,7 +21,7 @@ RawModule::RawModule(Runtime* runtime)
|
||||
RawModule::~RawModule() {}
|
||||
|
||||
int RawModule::LoadFile(uint32_t base_address, const std::wstring& path) {
|
||||
auto fixed_path = poly::to_string(poly::fix_path_separators(path));
|
||||
auto fixed_path = xe::to_string(xe::fix_path_separators(path));
|
||||
FILE* file = fopen(fixed_path.c_str(), "rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
uint32_t file_length = static_cast<uint32_t>(ftell(file));
|
||||
@@ -39,7 +39,7 @@ int RawModule::LoadFile(uint32_t base_address, const std::wstring& path) {
|
||||
fclose(file);
|
||||
|
||||
// Setup debug info.
|
||||
auto last_slash = fixed_path.find_last_of(poly::path_separator);
|
||||
auto last_slash = fixed_path.find_last_of(xe::path_separator);
|
||||
if (last_slash != std::string::npos) {
|
||||
name_ = fixed_path.substr(last_slash + 1);
|
||||
} else {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/module.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("BYTE_SWAP_V128", "[instr]") {
|
||||
TestFunction([](HIRBuilder& b) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("EXTRACT_INT8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("INSERT_INT8", "[instr]") {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("LOAD_VECTOR_SHL", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("PACK_D3DCOLOR", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
|
||||
{
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("SHR_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("SWIZZLE_V128", "[instr]") {
|
||||
TestFunction([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("UNPACK_D3DCOLOR", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_ADD_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_MAX_I8_SIGNED", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_MIN_I8_SIGNED", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include "third_party/xbyak/xbyak/xbyak_bin2hex.h"
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_ROTATE_LEFT_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_SHA_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_SHL_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::test;
|
||||
using xe::cpu::frontend::PPCContext;
|
||||
using namespace poly;
|
||||
|
||||
TEST_CASE("VECTOR_SHR_I8", "[instr]") {
|
||||
TestFunction test([](HIRBuilder& b) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef XENIA_TEST_UTIL_H_
|
||||
#define XENIA_TEST_UTIL_H_
|
||||
|
||||
#include "poly/main.h"
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "third_party/catch/single_include/catch.hpp"
|
||||
|
||||
#include "poly/debugging.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/debugging.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/cpu/test/util.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -25,7 +25,7 @@ int main(std::vector<std::wstring>& args) {
|
||||
std::vector<std::string> narrow_args;
|
||||
auto narrow_argv = new char* [args.size()];
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
auto narrow_arg = poly::to_string(args[i]);
|
||||
auto narrow_arg = xe::to_string(args[i]);
|
||||
narrow_argv[i] = const_cast<char*>(narrow_arg.data());
|
||||
narrow_args.push_back(std::move(narrow_arg));
|
||||
}
|
||||
@@ -33,8 +33,8 @@ int main(std::vector<std::wstring>& args) {
|
||||
if (ret) {
|
||||
#if XE_PLATFORM_WIN32
|
||||
// Visual Studio kills the console on shutdown, so prevent that.
|
||||
if (poly::debugging::IsDebuggerAttached()) {
|
||||
poly::debugging::Break();
|
||||
if (xe::debugging::IsDebuggerAttached()) {
|
||||
xe::debugging::Break();
|
||||
}
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/main.h"
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/cpu/test_module.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/platform.h"
|
||||
#include "poly/reset_scope.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/base/reset_scope.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/cpu/compiler/compiler_passes.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
@@ -78,8 +78,8 @@ SymbolInfo::Status TestModule::DeclareFunction(uint32_t address,
|
||||
auto symbol_info = *out_symbol_info;
|
||||
|
||||
// Reset() all caching when we leave.
|
||||
poly::make_reset_scope(compiler_);
|
||||
poly::make_reset_scope(assembler_);
|
||||
xe::make_reset_scope(compiler_);
|
||||
xe::make_reset_scope(assembler_);
|
||||
|
||||
if (!generate_(*builder_.get())) {
|
||||
symbol_info->set_status(SymbolInfo::STATUS_FAILED);
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/threading.h"
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -36,7 +36,7 @@ ThreadState::ThreadState(Runtime* runtime, uint32_t thread_id,
|
||||
if (thread_id_ == UINT_MAX) {
|
||||
// System thread. Assign the system thread ID with a high bit
|
||||
// set so people know what's up.
|
||||
uint32_t system_thread_handle = poly::threading::current_thread_id();
|
||||
uint32_t system_thread_handle = xe::threading::current_thread_id();
|
||||
thread_id_ = 0x80000000 | system_thread_handle;
|
||||
}
|
||||
backend_data_ = runtime->backend()->AllocThreadData();
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/export_resolver.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -111,12 +111,12 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||
|
||||
if (kernel_export) {
|
||||
if (info->thunk_address) {
|
||||
snprintf(name, poly::countof(name), "__imp_%s", kernel_export->name);
|
||||
snprintf(name, xe::countof(name), "__imp_%s", kernel_export->name);
|
||||
} else {
|
||||
snprintf(name, poly::countof(name), "%s", kernel_export->name);
|
||||
snprintf(name, xe::countof(name), "%s", kernel_export->name);
|
||||
}
|
||||
} else {
|
||||
snprintf(name, poly::countof(name), "__imp_%s_%.3X", library->name,
|
||||
snprintf(name, xe::countof(name), "__imp_%s_%.3X", library->name,
|
||||
info->ordinal);
|
||||
}
|
||||
|
||||
@@ -134,20 +134,20 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||
if (kernel_export->type == KernelExport::Function) {
|
||||
// Not exactly sure what this should be...
|
||||
if (info->thunk_address) {
|
||||
*slot = poly::byte_swap(info->thunk_address);
|
||||
*slot = xe::byte_swap(info->thunk_address);
|
||||
} else {
|
||||
// TODO(benvanik): find out what import variables are.
|
||||
XELOGW("kernel import variable not defined %.8X %s",
|
||||
info->value_address, kernel_export->name);
|
||||
*slot = poly::byte_swap(0xF00DF00D);
|
||||
*slot = xe::byte_swap(0xF00DF00D);
|
||||
}
|
||||
} else {
|
||||
if (kernel_export->is_implemented) {
|
||||
// Implemented - replace with pointer.
|
||||
poly::store_and_swap<uint32_t>(slot, kernel_export->variable_ptr);
|
||||
xe::store_and_swap<uint32_t>(slot, kernel_export->variable_ptr);
|
||||
} else {
|
||||
// Not implemented - write with a dummy value.
|
||||
poly::store_and_swap<uint32_t>(
|
||||
xe::store_and_swap<uint32_t>(
|
||||
slot, 0xD000BEEF | (kernel_export->ordinal & 0xFFF) << 16);
|
||||
XELOGCPU("WARNING: imported a variable with no value: %s",
|
||||
kernel_export->name);
|
||||
@@ -157,9 +157,9 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||
|
||||
if (info->thunk_address) {
|
||||
if (kernel_export) {
|
||||
snprintf(name, poly::countof(name), "%s", kernel_export->name);
|
||||
snprintf(name, xe::countof(name), "%s", kernel_export->name);
|
||||
} else {
|
||||
snprintf(name, poly::countof(name), "__kernel_%s_%.3X", library->name,
|
||||
snprintf(name, xe::countof(name), "__kernel_%s_%.3X", library->name,
|
||||
info->ordinal);
|
||||
}
|
||||
|
||||
@@ -178,10 +178,10 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||
// nop
|
||||
// nop
|
||||
uint8_t* p = memory()->TranslateVirtual(info->thunk_address);
|
||||
poly::store_and_swap<uint32_t>(p + 0x0, 0x44000002);
|
||||
poly::store_and_swap<uint32_t>(p + 0x4, 0x4E800020);
|
||||
poly::store_and_swap<uint32_t>(p + 0x8, 0x60000000);
|
||||
poly::store_and_swap<uint32_t>(p + 0xC, 0x60000000);
|
||||
xe::store_and_swap<uint32_t>(p + 0x0, 0x44000002);
|
||||
xe::store_and_swap<uint32_t>(p + 0x4, 0x4E800020);
|
||||
xe::store_and_swap<uint32_t>(p + 0x8, 0x60000000);
|
||||
xe::store_and_swap<uint32_t>(p + 0xC, 0x60000000);
|
||||
|
||||
FunctionInfo::ExternHandler handler = 0;
|
||||
void* handler_data = 0;
|
||||
@@ -390,17 +390,17 @@ int XexModule::FindSaveRest() {
|
||||
if (!gplr_start) {
|
||||
gplr_start = memory_->SearchAligned(start_address, end_address,
|
||||
gprlr_code_values,
|
||||
poly::countof(gprlr_code_values));
|
||||
xe::countof(gprlr_code_values));
|
||||
}
|
||||
if (!fpr_start) {
|
||||
fpr_start =
|
||||
memory_->SearchAligned(start_address, end_address, fpr_code_values,
|
||||
poly::countof(fpr_code_values));
|
||||
xe::countof(fpr_code_values));
|
||||
}
|
||||
if (!vmx_start) {
|
||||
vmx_start =
|
||||
memory_->SearchAligned(start_address, end_address, vmx_code_values,
|
||||
poly::countof(vmx_code_values));
|
||||
xe::countof(vmx_code_values));
|
||||
}
|
||||
if (gplr_start && fpr_start && vmx_start) {
|
||||
break;
|
||||
@@ -414,7 +414,7 @@ int XexModule::FindSaveRest() {
|
||||
if (gplr_start) {
|
||||
uint32_t address = gplr_start;
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__savegprlr_%d", n);
|
||||
snprintf(name, xe::countof(name), "__savegprlr_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_end_address(address + (31 - n) * 4 + 2 * 4);
|
||||
@@ -427,7 +427,7 @@ int XexModule::FindSaveRest() {
|
||||
}
|
||||
address = gplr_start + 20 * 4;
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__restgprlr_%d", n);
|
||||
snprintf(name, xe::countof(name), "__restgprlr_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_end_address(address + (31 - n) * 4 + 3 * 4);
|
||||
@@ -442,7 +442,7 @@ int XexModule::FindSaveRest() {
|
||||
if (fpr_start) {
|
||||
uint32_t address = fpr_start;
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__savefpr_%d", n);
|
||||
snprintf(name, xe::countof(name), "__savefpr_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_end_address(address + (31 - n) * 4 + 1 * 4);
|
||||
@@ -455,7 +455,7 @@ int XexModule::FindSaveRest() {
|
||||
}
|
||||
address = fpr_start + (18 * 4) + (1 * 4);
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__restfpr_%d", n);
|
||||
snprintf(name, xe::countof(name), "__restfpr_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_end_address(address + (31 - n) * 4 + 1 * 4);
|
||||
@@ -475,7 +475,7 @@ int XexModule::FindSaveRest() {
|
||||
// 64-127 rest
|
||||
uint32_t address = vmx_start;
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__savevmx_%d", n);
|
||||
snprintf(name, xe::countof(name), "__savevmx_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_name(name);
|
||||
@@ -487,7 +487,7 @@ int XexModule::FindSaveRest() {
|
||||
}
|
||||
address += 4;
|
||||
for (int n = 64; n <= 127; n++) {
|
||||
snprintf(name, poly::countof(name), "__savevmx_%d", n);
|
||||
snprintf(name, xe::countof(name), "__savevmx_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_name(name);
|
||||
@@ -499,7 +499,7 @@ int XexModule::FindSaveRest() {
|
||||
}
|
||||
address = vmx_start + (18 * 2 * 4) + (1 * 4) + (64 * 2 * 4) + (1 * 4);
|
||||
for (int n = 14; n <= 31; n++) {
|
||||
snprintf(name, poly::countof(name), "__restvmx_%d", n);
|
||||
snprintf(name, xe::countof(name), "__restvmx_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_name(name);
|
||||
@@ -511,7 +511,7 @@ int XexModule::FindSaveRest() {
|
||||
}
|
||||
address += 4;
|
||||
for (int n = 64; n <= 127; n++) {
|
||||
snprintf(name, poly::countof(name), "__restvmx_%d", n);
|
||||
snprintf(name, xe::countof(name), "__restvmx_%d", n);
|
||||
FunctionInfo* symbol_info;
|
||||
DeclareFunction(address, &symbol_info);
|
||||
symbol_info->set_name(name);
|
||||
|
||||
Reference in New Issue
Block a user