Merge branch 'master' of github.com:benvanik/xenia
This commit is contained in:
commit
eebe68b77a
|
@ -22,6 +22,17 @@ and set the 'Command' to `$(SolutionDir)$(TargetPath)` and the
|
|||
'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and
|
||||
the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`).
|
||||
|
||||
### OSX
|
||||
|
||||
* Mac OSX 10.9+
|
||||
* Xcode 5.1+
|
||||
|
||||
#### Debugging
|
||||
|
||||
Choose `Product > Scheme > Edit Scheme`. For xenia-run, alloy-sandbox, and the
|
||||
other executables select the Run action on the left and set
|
||||
`Options > Working Directory` to your root xenia/ git path.
|
||||
|
||||
## xenia-build
|
||||
|
||||
A simple build script is included to manage basic tasks such as building
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef ALLOY_ARENA_H_
|
||||
#define ALLOY_ARENA_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace alloy {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <poly/assert.h>
|
||||
#include <poly/math.h>
|
||||
#include <xenia/profiling.h>
|
||||
|
||||
namespace alloy {
|
||||
namespace backend {
|
||||
|
|
|
@ -528,7 +528,7 @@ template <typename SEQ, typename T>
|
|||
struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
|
||||
typedef Sequence<SingleSequence<SEQ, T>, T> BASE;
|
||||
typedef T EmitArgType;
|
||||
static const uint32_t head_key = T::key;
|
||||
static constexpr uint32_t head_key() { return T::key; }
|
||||
static void Emit(X64Emitter& e, const typename BASE::EmitArgs& _) {
|
||||
SEQ::Emit(e, _.i1);
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ static const tag_t TAG7 = 7;
|
|||
|
||||
template <typename T>
|
||||
void Register() {
|
||||
sequence_table.insert({ T::head_key, T::Select });
|
||||
sequence_table.insert({ T::head_key(), T::Select });
|
||||
}
|
||||
template <typename T, typename Tn, typename... Ts>
|
||||
void Register() {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef ALLOY_FRONTEND_CONTEXT_INFO_H_
|
||||
#define ALLOY_FRONTEND_CONTEXT_INFO_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace alloy {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <alloy/runtime/debug_info.h>
|
||||
|
||||
#include <memory>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace alloy {
|
||||
namespace runtime {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||
#define ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace alloy {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <alloy/runtime/raw_module.h>
|
||||
|
||||
#include <poly/platform.h>
|
||||
#include <poly/string.h>
|
||||
|
||||
namespace alloy {
|
||||
namespace runtime {
|
||||
|
@ -19,8 +20,9 @@ RawModule::RawModule(Runtime* runtime)
|
|||
|
||||
RawModule::~RawModule() {}
|
||||
|
||||
int RawModule::LoadFile(uint64_t base_address, const std::string& path) {
|
||||
FILE* file = fopen(path.c_str(), "rb");
|
||||
int RawModule::LoadFile(uint64_t base_address, const std::wstring& path) {
|
||||
auto fixed_path = poly::to_string(poly::fix_path_separators(path));
|
||||
FILE* file = fopen(fixed_path.c_str(), "rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
size_t file_length = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
@ -37,11 +39,11 @@ int RawModule::LoadFile(uint64_t base_address, const std::string& path) {
|
|||
fclose(file);
|
||||
|
||||
// Setup debug info.
|
||||
auto last_slash = path.find_last_of(poly::path_separator);
|
||||
auto last_slash = fixed_path.find_last_of(poly::path_separator);
|
||||
if (last_slash != std::string::npos) {
|
||||
name_ = path.substr(last_slash + 1);
|
||||
name_ = fixed_path.substr(last_slash + 1);
|
||||
} else {
|
||||
name_ = path;
|
||||
name_ = fixed_path;
|
||||
}
|
||||
// TODO(benvanik): debug info
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class RawModule : public Module {
|
|||
RawModule(Runtime* runtime);
|
||||
~RawModule() override;
|
||||
|
||||
int LoadFile(uint64_t base_address, const std::string& path);
|
||||
int LoadFile(uint64_t base_address, const std::wstring& path);
|
||||
|
||||
const std::string& name() const override { return name_; }
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ void log_line(const char* file_path, const uint32_t line_number,
|
|||
#if 0 // defined(OutputDebugString)
|
||||
OutputDebugStringA(buffer);
|
||||
#else
|
||||
fprintf(stdout, buffer);
|
||||
fprintf(stdout, "%s", buffer);
|
||||
fflush(stdout);
|
||||
#endif // OutputDebugString
|
||||
if (!FLAGS_fast_stdout) {
|
||||
|
@ -102,7 +102,7 @@ void handle_fatal(const char* file_path, const uint32_t line_number,
|
|||
#if defined(OutputDebugString)
|
||||
OutputDebugStringA(buffer);
|
||||
#else
|
||||
fprintf(stderr, buffer);
|
||||
fprintf(stderr, "%s", buffer);
|
||||
fflush(stderr);
|
||||
#endif // OutputDebugString
|
||||
if (!FLAGS_fast_stdout) {
|
||||
|
|
|
@ -89,142 +89,6 @@ static const uint64_t k0 = 0xc3a5c85c97cb3127ULL;
|
|||
static const uint64_t k1 = 0xb492b66fbe98f273ULL;
|
||||
static const uint64_t k2 = 0x9ae16a3b2f90404fULL;
|
||||
|
||||
// Magic numbers for 32-bit hashing. Copied from Murmur3.
|
||||
static const uint32_t c1 = 0xcc9e2d51;
|
||||
static const uint32_t c2 = 0x1b873593;
|
||||
|
||||
// A 32-bit to 32-bit integer hash copied from Murmur3.
|
||||
static uint32_t fmix(uint32_t h) {
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
return h;
|
||||
}
|
||||
|
||||
static uint32_t Rotate32(uint32_t val, int shift) {
|
||||
// Avoid shifting by 32: doing so yields an undefined result.
|
||||
return shift == 0 ? val : ((val >> shift) | (val << (32 - shift)));
|
||||
}
|
||||
|
||||
#undef PERMUTE3
|
||||
#define PERMUTE3(a, b, c) \
|
||||
do { \
|
||||
std::swap(a, b); \
|
||||
std::swap(a, c); \
|
||||
} while (0)
|
||||
|
||||
static uint32_t Mur(uint32_t a, uint32_t h) {
|
||||
// Helper from Murmur3 for combining two 32-bit values.
|
||||
a *= c1;
|
||||
a = Rotate32(a, 17);
|
||||
a *= c2;
|
||||
h ^= a;
|
||||
h = Rotate32(h, 19);
|
||||
return h * 5 + 0xe6546b64;
|
||||
}
|
||||
|
||||
static uint32_t Hash32Len13to24(const char *s, size_t len) {
|
||||
uint32_t a = Fetch32(s - 4 + (len >> 1));
|
||||
uint32_t b = Fetch32(s + 4);
|
||||
uint32_t c = Fetch32(s + len - 8);
|
||||
uint32_t d = Fetch32(s + (len >> 1));
|
||||
uint32_t e = Fetch32(s);
|
||||
uint32_t f = Fetch32(s + len - 4);
|
||||
uint32_t h = (uint32_t)len;
|
||||
|
||||
return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h)))))));
|
||||
}
|
||||
|
||||
static uint32_t Hash32Len0to4(const char *s, size_t len) {
|
||||
uint32_t b = 0;
|
||||
uint32_t c = 9;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
signed char v = s[i];
|
||||
b = b * c1 + v;
|
||||
c ^= b;
|
||||
}
|
||||
return fmix(Mur(b, Mur((uint32_t)len, c)));
|
||||
}
|
||||
|
||||
static uint32_t Hash32Len5to12(const char *s, size_t len) {
|
||||
uint32_t a = (uint32_t)len, b = (uint32_t)len * 5, c = 9, d = b;
|
||||
a += Fetch32(s);
|
||||
b += Fetch32(s + len - 4);
|
||||
c += Fetch32(s + ((len >> 1) & 4));
|
||||
return fmix(Mur(c, Mur(b, Mur(a, d))));
|
||||
}
|
||||
|
||||
uint32_t CityHash32(const char *s, size_t len) {
|
||||
if (len <= 24) {
|
||||
return len <= 12
|
||||
? (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len))
|
||||
: Hash32Len13to24(s, len);
|
||||
}
|
||||
|
||||
// len > 24
|
||||
uint32_t h = (uint32_t)len, g = c1 * (uint32_t)len, f = g;
|
||||
uint32_t a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2;
|
||||
uint32_t a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2;
|
||||
uint32_t a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2;
|
||||
uint32_t a3 = Rotate32(Fetch32(s + len - 12) * c1, 17) * c2;
|
||||
uint32_t a4 = Rotate32(Fetch32(s + len - 20) * c1, 17) * c2;
|
||||
h ^= a0;
|
||||
h = Rotate32(h, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
h ^= a2;
|
||||
h = Rotate32(h, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
g ^= a1;
|
||||
g = Rotate32(g, 19);
|
||||
g = g * 5 + 0xe6546b64;
|
||||
g ^= a3;
|
||||
g = Rotate32(g, 19);
|
||||
g = g * 5 + 0xe6546b64;
|
||||
f += a4;
|
||||
f = Rotate32(f, 19);
|
||||
f = f * 5 + 0xe6546b64;
|
||||
size_t iters = (len - 1) / 20;
|
||||
do {
|
||||
uint32_t a0 = Rotate32(Fetch32(s) * c1, 17) * c2;
|
||||
uint32_t a1 = Fetch32(s + 4);
|
||||
uint32_t a2 = Rotate32(Fetch32(s + 8) * c1, 17) * c2;
|
||||
uint32_t a3 = Rotate32(Fetch32(s + 12) * c1, 17) * c2;
|
||||
uint32_t a4 = Fetch32(s + 16);
|
||||
h ^= a0;
|
||||
h = Rotate32(h, 18);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
f += a1;
|
||||
f = Rotate32(f, 19);
|
||||
f = f * c1;
|
||||
g += a2;
|
||||
g = Rotate32(g, 18);
|
||||
g = g * 5 + 0xe6546b64;
|
||||
h ^= a3 + a1;
|
||||
h = Rotate32(h, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
g ^= a4;
|
||||
g = poly::byte_swap(g) * 5;
|
||||
h += a4 * 5;
|
||||
h = poly::byte_swap(h);
|
||||
f += a0;
|
||||
PERMUTE3(f, h, g);
|
||||
s += 20;
|
||||
} while (--iters != 0);
|
||||
g = Rotate32(g, 11) * c1;
|
||||
g = Rotate32(g, 17) * c1;
|
||||
f = Rotate32(f, 11) * c1;
|
||||
f = Rotate32(f, 17) * c1;
|
||||
h = Rotate32(h + g, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
h = Rotate32(h, 17) * c1;
|
||||
h = Rotate32(h + f, 19);
|
||||
h = h * 5 + 0xe6546b64;
|
||||
h = Rotate32(h, 17) * c1;
|
||||
return h;
|
||||
}
|
||||
|
||||
// Bitwise right rotate. Normally this will compile to a single
|
||||
// instruction, especially if the shift is a manifest constant.
|
||||
static uint64_t Rotate(uint64_t val, int shift) {
|
||||
|
|
|
@ -9,11 +9,15 @@
|
|||
|
||||
#include <xenia/core/socket.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
|
||||
void xe_socket_init() {
|
||||
// No-op.
|
||||
|
@ -81,7 +85,7 @@ int xe_socket_bind_loopback(socket_t socket) {
|
|||
socket_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
socket_addr.sin_port = htons(0);
|
||||
int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr));
|
||||
if (r == SOCKET_ERROR) {
|
||||
if (r == -1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -108,7 +112,7 @@ int xe_socket_accept(socket_t socket, xe_socket_connection_t* out_client_info) {
|
|||
|
||||
int client_ip = client_addr.sin_addr.s_addr;
|
||||
inet_ntop(AF_INET, &client_ip, out_client_info->addr,
|
||||
XECOUNT(out_client_info->addr));
|
||||
poly::countof(out_client_info->addr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -177,7 +181,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read,
|
|||
|
||||
// Poll.
|
||||
int r;
|
||||
while ((r = poll(loop->events, XECOUNT(loop->events), -1)) == -1 &&
|
||||
while ((r = poll(loop->events, poly::countof(loop->events), -1)) == -1 &&
|
||||
errno == EINTR)
|
||||
;
|
||||
if (r == -1) {
|
||||
|
@ -193,7 +197,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read,
|
|||
loop->pending_queued_write = loop->events[1].revents != 0;
|
||||
if (loop->pending_queued_write) {
|
||||
uint8_t dummy;
|
||||
XEIGNORE(recv(loop->notify_rd_id, &dummy, 1, 0));
|
||||
recv(loop->notify_rd_id, &dummy, 1, 0);
|
||||
}
|
||||
loop->events[1].revents = 0;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <xenia/cpu/xenon_runtime.h>
|
||||
#include <xenia/cpu/xex_module.h>
|
||||
|
||||
|
||||
using namespace alloy;
|
||||
using namespace alloy::backend;
|
||||
using namespace alloy::frontend::ppc;
|
||||
|
@ -23,35 +22,33 @@ using namespace alloy::runtime;
|
|||
using namespace xe;
|
||||
using namespace xe::cpu;
|
||||
|
||||
|
||||
namespace {
|
||||
void InitializeIfNeeded();
|
||||
void CleanupOnShutdown();
|
||||
void InitializeIfNeeded();
|
||||
void CleanupOnShutdown();
|
||||
|
||||
void InitializeIfNeeded() {
|
||||
void InitializeIfNeeded() {
|
||||
static bool has_initialized = false;
|
||||
if (has_initialized) {
|
||||
return;
|
||||
}
|
||||
has_initialized = true;
|
||||
|
||||
//ppc::RegisterDisasmCategoryAltivec();
|
||||
//ppc::RegisterDisasmCategoryALU();
|
||||
//ppc::RegisterDisasmCategoryControl();
|
||||
//ppc::RegisterDisasmCategoryFPU();
|
||||
//ppc::RegisterDisasmCategoryMemory();
|
||||
// ppc::RegisterDisasmCategoryAltivec();
|
||||
// ppc::RegisterDisasmCategoryALU();
|
||||
// ppc::RegisterDisasmCategoryControl();
|
||||
// ppc::RegisterDisasmCategoryFPU();
|
||||
// ppc::RegisterDisasmCategoryMemory();
|
||||
|
||||
atexit(CleanupOnShutdown);
|
||||
}
|
||||
|
||||
void CleanupOnShutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
void CleanupOnShutdown() {}
|
||||
}
|
||||
|
||||
Processor::Processor(Emulator* emulator) :
|
||||
emulator_(emulator), export_resolver_(emulator->export_resolver()),
|
||||
runtime_(0), memory_(emulator->memory()),
|
||||
Processor::Processor(Emulator* emulator)
|
||||
: export_resolver_(emulator->export_resolver()),
|
||||
runtime_(0),
|
||||
memory_(emulator->memory()),
|
||||
interrupt_thread_state_(NULL),
|
||||
interrupt_thread_block_(0) {
|
||||
InitializeIfNeeded();
|
||||
|
@ -101,11 +98,9 @@ int Processor::Setup() {
|
|||
return result;
|
||||
}
|
||||
|
||||
interrupt_thread_state_ = new XenonThreadState(
|
||||
runtime_, 0, 16 * 1024, 0);
|
||||
interrupt_thread_state_ = new XenonThreadState(runtime_, 0, 16 * 1024, 0);
|
||||
interrupt_thread_state_->set_name("Interrupt");
|
||||
interrupt_thread_block_ = memory_->HeapAlloc(
|
||||
0, 2048, MEMORY_FLAG_ZERO);
|
||||
interrupt_thread_block_ = memory_->HeapAlloc(0, 2048, MEMORY_FLAG_ZERO);
|
||||
interrupt_thread_state_->context()->r[13] = interrupt_thread_block_;
|
||||
|
||||
return 0;
|
||||
|
@ -136,9 +131,8 @@ int Processor::Execute(XenonThreadState* thread_state, uint64_t address) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint64_t Processor::Execute(
|
||||
XenonThreadState* thread_state, uint64_t address, uint64_t args[],
|
||||
size_t arg_count) {
|
||||
uint64_t Processor::Execute(XenonThreadState* thread_state, uint64_t address,
|
||||
uint64_t args[], size_t arg_count) {
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
PPCContext* context = thread_state->context();
|
||||
|
@ -163,8 +157,8 @@ void Processor::LowerIrql(Irql old_value) {
|
|||
reinterpret_cast<volatile uint32_t*>(&irql_));
|
||||
}
|
||||
|
||||
uint64_t Processor::ExecuteInterrupt(
|
||||
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count) {
|
||||
uint64_t Processor::ExecuteInterrupt(uint32_t cpu, uint64_t address,
|
||||
uint64_t args[], size_t arg_count) {
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
// Acquire lock on interrupt thread (we can only dispatch one at a time).
|
||||
|
|
|
@ -53,7 +53,6 @@ class Processor {
|
|||
size_t arg_count);
|
||||
|
||||
private:
|
||||
Emulator* emulator_;
|
||||
ExportResolver* export_resolver_;
|
||||
|
||||
XenonRuntime* runtime_;
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
|
||||
#include <xenia/core.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace xenos {
|
||||
|
||||
|
||||
#if XE_COMPILER_MSVC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
||||
|
@ -27,16 +25,12 @@ namespace xenos {
|
|||
#define XEPACKEDUNION(name, value) \
|
||||
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
||||
typedef union name##_s name;
|
||||
#elif XE_COMPILER_GNUC
|
||||
#define XEPACKEDSTRUCT(name, value) \
|
||||
struct __attribute__((packed)) name
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||
struct __attribute__((packed))
|
||||
#define XEPACKEDUNION(name, value) \
|
||||
union __attribute__((packed)) name
|
||||
#else
|
||||
#define XEPACKEDSTRUCT(name, value) struct __attribute__((packed)) name
|
||||
#define XEPACKEDSTRUCTANONYMOUS(value) struct __attribute__((packed))
|
||||
#define XEPACKEDUNION(name, value) union __attribute__((packed)) name
|
||||
#endif // MSVC
|
||||
|
||||
|
||||
// This code comes from the freedreno project:
|
||||
// https://github.com/freedreno/freedreno/blob/master/includes/instr-a2xx.h
|
||||
/*
|
||||
|
@ -62,7 +56,6 @@ namespace xenos {
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
enum a2xx_sq_surfaceformat {
|
||||
FMT_1_REVERSE = 0,
|
||||
FMT_1 = 1,
|
||||
|
@ -127,7 +120,6 @@ enum a2xx_sq_surfaceformat {
|
|||
FMT_DXT3A_AS_1_1_1_1 = 61,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ALU instructions:
|
||||
*/
|
||||
|
@ -264,8 +256,6 @@ XEPACKEDSTRUCT(instr_alu_t, {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CF instructions:
|
||||
*/
|
||||
|
@ -317,10 +307,8 @@ XEPACKEDSTRUCT(instr_cf_exec_t, {
|
|||
uint32_t opc : 4; // instr_cf_opc_t
|
||||
});
|
||||
bool is_cond_exec() const {
|
||||
return (this->opc == COND_EXEC) ||
|
||||
(this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) ||
|
||||
(this->opc == COND_PRED_EXEC_END) ||
|
||||
return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||
}
|
||||
|
@ -380,8 +368,10 @@ XEPACKEDUNION(instr_cf_t, {
|
|||
instr_cf_jmp_call_t jmp_call;
|
||||
instr_cf_alloc_t alloc;
|
||||
XEPACKEDSTRUCTANONYMOUS({
|
||||
uint32_t : 32;
|
||||
uint32_t : 12;
|
||||
uint32_t:
|
||||
32;
|
||||
uint32_t:
|
||||
12;
|
||||
uint32_t opc : 4; // instr_cf_opc_t
|
||||
});
|
||||
XEPACKEDSTRUCTANONYMOUS({
|
||||
|
@ -390,27 +380,20 @@ XEPACKEDUNION(instr_cf_t, {
|
|||
});
|
||||
|
||||
bool is_exec() const {
|
||||
return (this->opc == EXEC) ||
|
||||
(this->opc == EXEC_END) ||
|
||||
(this->opc == COND_EXEC) ||
|
||||
(this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) ||
|
||||
(this->opc == COND_PRED_EXEC_END) ||
|
||||
return (this->opc == EXEC) || (this->opc == EXEC_END) ||
|
||||
(this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||
}
|
||||
bool is_cond_exec() const {
|
||||
return (this->opc == COND_EXEC) ||
|
||||
(this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) ||
|
||||
(this->opc == COND_PRED_EXEC_END) ||
|
||||
return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN) ||
|
||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* FETCH instructions:
|
||||
*/
|
||||
|
@ -553,23 +536,24 @@ XEPACKEDUNION(instr_fetch_t, {
|
|||
/* dword0: */
|
||||
XEPACKEDSTRUCTANONYMOUS({
|
||||
uint32_t opc : 5; // instr_fetch_opc_t
|
||||
uint32_t : 27;
|
||||
uint32_t:
|
||||
27;
|
||||
});
|
||||
/* dword1: */
|
||||
XEPACKEDSTRUCTANONYMOUS({
|
||||
uint32_t : 32;
|
||||
uint32_t:
|
||||
32;
|
||||
});
|
||||
/* dword2: */
|
||||
XEPACKEDSTRUCTANONYMOUS({
|
||||
uint32_t : 32;
|
||||
uint32_t:
|
||||
32;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
} // namespace xenos
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_XENOS_UCODE_H_
|
||||
|
|
|
@ -20,22 +20,18 @@ namespace fs {
|
|||
|
||||
class DiscImageMemoryMapping : public MemoryMapping {
|
||||
public:
|
||||
DiscImageMemoryMapping(uint8_t* address, size_t length,
|
||||
poly::MappedMemory* mmap)
|
||||
: MemoryMapping(address, length), mmap_(mmap) {}
|
||||
DiscImageMemoryMapping(uint8_t* address, size_t length)
|
||||
: MemoryMapping(address, length) {}
|
||||
|
||||
virtual ~DiscImageMemoryMapping() {}
|
||||
|
||||
private:
|
||||
poly::MappedMemory* mmap_;
|
||||
~DiscImageMemoryMapping() override = default;
|
||||
};
|
||||
|
||||
DiscImageEntry::DiscImageEntry(Type type, Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
||||
: gdfx_entry_(gdfx_entry),
|
||||
gdfx_entry_iterator_(gdfx_entry->children.end()),
|
||||
: Entry(type, device, path),
|
||||
mmap_(mmap),
|
||||
Entry(type, device, path) {}
|
||||
gdfx_entry_(gdfx_entry),
|
||||
gdfx_entry_iterator_(gdfx_entry->children.end()) {}
|
||||
|
||||
DiscImageEntry::~DiscImageEntry() {}
|
||||
|
||||
|
@ -107,7 +103,7 @@ std::unique_ptr<MemoryMapping> DiscImageEntry::CreateMemoryMapping(
|
|||
size_t real_length =
|
||||
length ? std::min(length, gdfx_entry_->size) : gdfx_entry_->size;
|
||||
return std::make_unique<DiscImageMemoryMapping>(mmap_->data() + real_offset,
|
||||
real_length, mmap_);
|
||||
real_length);
|
||||
}
|
||||
|
||||
X_STATUS DiscImageEntry::Open(KernelState* kernel_state, Mode mode, bool async,
|
||||
|
|
|
@ -27,21 +27,21 @@ class DiscImageEntry : public Entry {
|
|||
public:
|
||||
DiscImageEntry(Type type, Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry);
|
||||
virtual ~DiscImageEntry();
|
||||
~DiscImageEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart);
|
||||
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart) override;
|
||||
|
||||
virtual bool can_map() { return true; }
|
||||
virtual std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||
Mode map_mode, const size_t offset, const size_t length);
|
||||
bool can_map() override { return true; }
|
||||
std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||
Mode map_mode, const size_t offset, const size_t length) override;
|
||||
|
||||
virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||
XFile** out_file);
|
||||
X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||
XFile** out_file) override;
|
||||
|
||||
private:
|
||||
poly::MappedMemory* mmap_;
|
||||
|
|
|
@ -22,20 +22,20 @@ class HostPathEntry : public Entry {
|
|||
public:
|
||||
HostPathEntry(Type type, Device* device, const char* path,
|
||||
const std::wstring& local_path);
|
||||
virtual ~HostPathEntry();
|
||||
~HostPathEntry() override;
|
||||
|
||||
const std::wstring& local_path() { return local_path_; }
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart);
|
||||
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart) override;
|
||||
|
||||
virtual bool can_map() { return true; }
|
||||
virtual std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||
Mode map_mode, const size_t offset, const size_t length);
|
||||
bool can_map() override { return true; }
|
||||
std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||
Mode map_mode, const size_t offset, const size_t length) override;
|
||||
|
||||
virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||
XFile** out_file);
|
||||
X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||
XFile** out_file) override;
|
||||
|
||||
private:
|
||||
std::wstring local_path_;
|
||||
|
|
|
@ -20,12 +20,12 @@ STFSContainerEntry::STFSContainerEntry(Type type, Device* device,
|
|||
const char* path,
|
||||
poly::MappedMemory* mmap,
|
||||
STFSEntry* stfs_entry)
|
||||
: stfs_entry_(stfs_entry),
|
||||
stfs_entry_iterator_(stfs_entry->children.end()),
|
||||
: Entry(type, device, path),
|
||||
mmap_(mmap),
|
||||
Entry(type, device, path) {}
|
||||
stfs_entry_(stfs_entry),
|
||||
stfs_entry_iterator_(stfs_entry->children.end()) {}
|
||||
|
||||
STFSContainerEntry::~STFSContainerEntry() {}
|
||||
STFSContainerEntry::~STFSContainerEntry() = default;
|
||||
|
||||
X_STATUS STFSContainerEntry::QueryInfo(XFileInfo* out_info) {
|
||||
assert_not_null(out_info);
|
||||
|
|
|
@ -27,17 +27,17 @@ class STFSContainerEntry : public Entry {
|
|||
public:
|
||||
STFSContainerEntry(Type type, Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, STFSEntry* stfs_entry);
|
||||
virtual ~STFSContainerEntry();
|
||||
~STFSContainerEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
STFSEntry* stfs_entry() const { return stfs_entry_; }
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart);
|
||||
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
const char* file_name, bool restart) override;
|
||||
|
||||
virtual X_STATUS Open(KernelState* kernel_state, Mode desired_access,
|
||||
bool async, XFile** out_file);
|
||||
X_STATUS Open(KernelState* kernel_state, Mode desired_access, bool async,
|
||||
XFile** out_file) override;
|
||||
|
||||
private:
|
||||
poly::MappedMemory* mmap_;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace fs {
|
|||
|
||||
STFSContainerFile::STFSContainerFile(KernelState* kernel_state, Mode mode,
|
||||
STFSContainerEntry* entry)
|
||||
: entry_(entry), XFile(kernel_state, mode) {}
|
||||
: XFile(kernel_state, mode), entry_(entry) {}
|
||||
|
||||
STFSContainerFile::~STFSContainerFile() { delete entry_; }
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ X_STATUS XThread::PlatformExit(int exit_code) {
|
|||
|
||||
static void* XThreadStartCallbackPthreads(void* param) {
|
||||
XThread* thread = reinterpret_cast<XThread*>(param);
|
||||
xe::Profiler::ThreadEnter(thread->name());
|
||||
xe::Profiler::ThreadEnter(thread->name().c_str());
|
||||
current_thread_tls = thread;
|
||||
thread->Execute();
|
||||
current_thread_tls = nullptr;
|
||||
|
@ -334,7 +334,7 @@ void XThread::PlatformDestroy() {
|
|||
|
||||
X_STATUS XThread::PlatformExit(int exit_code) {
|
||||
// NOTE: does not return.
|
||||
pthread_exit((void*)exit_code);
|
||||
pthread_exit(reinterpret_cast<void*>(exit_code));
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void XUserModule::Dump() {
|
|||
const xe_xex2_header_t* header = xe_xex2_get_header(xex_);
|
||||
|
||||
// XEX info.
|
||||
printf("Module %s:\n\n", path_);
|
||||
printf("Module %s:\n\n", path_.c_str());
|
||||
printf(" Module Flags: %.8X\n", header->module_flags);
|
||||
printf(" System Flags: %.8X\n", header->system_flags);
|
||||
printf("\n");
|
||||
|
@ -292,7 +292,7 @@ void XUserModule::Dump() {
|
|||
unimpl_count++;
|
||||
}
|
||||
}
|
||||
printf(" Total: %4u\n", import_info_count);
|
||||
printf(" Total: %4zu\n", import_info_count);
|
||||
printf(" Known: %3d%% (%d known, %d unknown)\n",
|
||||
(int)(known_count / (float)import_info_count * 100.0f),
|
||||
known_count, unknown_count);
|
||||
|
|
|
@ -12,41 +12,37 @@
|
|||
|
||||
#include <xenia/core.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
|
||||
class App;
|
||||
class Window;
|
||||
|
||||
|
||||
class UIEvent {
|
||||
public:
|
||||
UIEvent(Window* window = NULL) :
|
||||
window_(window) {}
|
||||
virtual ~UIEvent() {}
|
||||
public:
|
||||
UIEvent(Window* window = NULL) : window_(window) {}
|
||||
virtual ~UIEvent() = default;
|
||||
|
||||
Window* window() const { return window_; }
|
||||
|
||||
private:
|
||||
private:
|
||||
Window* window_;
|
||||
};
|
||||
|
||||
class KeyEvent : public UIEvent {
|
||||
public:
|
||||
KeyEvent(Window* window, int key_code) :
|
||||
key_code_(key_code),
|
||||
UIEvent(window) {}
|
||||
virtual ~KeyEvent() {}
|
||||
public:
|
||||
KeyEvent(Window* window, int key_code)
|
||||
: UIEvent(window), key_code_(key_code) {}
|
||||
~KeyEvent() override = default;
|
||||
|
||||
int key_code() const { return key_code_; }
|
||||
|
||||
private:
|
||||
private:
|
||||
int key_code_;
|
||||
};
|
||||
|
||||
class MouseEvent : public UIEvent {
|
||||
public:
|
||||
public:
|
||||
enum Button {
|
||||
MOUSE_BUTTON_NONE = 0,
|
||||
MOUSE_BUTTON_LEFT,
|
||||
|
@ -56,13 +52,11 @@ public:
|
|||
MOUSE_BUTTON_X2,
|
||||
};
|
||||
|
||||
public:
|
||||
MouseEvent(Window* window,
|
||||
Button button, int32_t x, int32_t y,
|
||||
int32_t dx = 0, int32_t dy = 0) :
|
||||
button_(button), x_(x), y_(y), dx_(dx), dy_(dy),
|
||||
UIEvent(window) {}
|
||||
virtual ~MouseEvent() {}
|
||||
public:
|
||||
MouseEvent(Window* window, Button button, int32_t x, int32_t y,
|
||||
int32_t dx = 0, int32_t dy = 0)
|
||||
: UIEvent(window), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {}
|
||||
~MouseEvent() override = default;
|
||||
|
||||
Button button() const { return button_; }
|
||||
int32_t x() const { return x_; }
|
||||
|
@ -70,7 +64,7 @@ public:
|
|||
int32_t dx() const { return dx_; }
|
||||
int32_t dy() const { return dy_; }
|
||||
|
||||
private:
|
||||
private:
|
||||
Button button_;
|
||||
int32_t x_;
|
||||
int32_t y_;
|
||||
|
@ -78,9 +72,7 @@ private:
|
|||
int32_t dy_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ui
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_UI_UI_EVENT_H_
|
||||
|
|
|
@ -94,7 +94,7 @@ int main(std::vector<std::wstring>& args) {
|
|||
runtime->Initialize(std::move(frontend), std::move(backend));
|
||||
|
||||
auto module = std::make_unique<alloy::runtime::RawModule>(runtime.get());
|
||||
module->LoadFile(0x00001000, "test\\codegen\\instr_add.bin");
|
||||
module->LoadFile(0x00001000, L"test\\codegen\\instr_add.bin");
|
||||
runtime->AddModule(std::move(module));
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue