xb format --all (we are now format clean). Buildbot will yell at you.

This commit is contained in:
Ben Vanik 2015-06-22 22:26:51 -07:00
parent f902f8b78a
commit fb1f4906d9
87 changed files with 3542 additions and 2938 deletions

View File

@ -15,6 +15,16 @@ Code that really breaks from the formatting rules will not be accepted, as then
no one else can use clang-format on the code without also touching all your
lines.
The buildbot runs `xb lint --all` on the master branch, and will run
`xb lint --origin` on pull requests. Run `xb format` before you commit each
local change so that you are consistently clean, otherwise you may have to
rebase. If you forget, run `xb format --origin` and rebase your changes (so you
don't end up with 5 changes and then a 6th 'whoops' one - that's nasty).
The buildbot is running LLVM 3.6.1. If you are noticing style differences
between your local lint/format and the buildbot, ensure you are running that
version.
## Tools
### clang-format

View File

@ -35,7 +35,8 @@ using namespace System::Security::Permissions;
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// You can specify all the value or you can default the Revision and Build
// Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];

View File

@ -42,7 +42,7 @@ Disassembler::~Disassembler() {
delete string_buffer_;
}
String^ Disassembler::DisassemblePPC(IntPtr code_address, size_t code_size) {
String ^ Disassembler::DisassemblePPC(IntPtr code_address, size_t code_size) {
string_buffer_->Reset();
auto code_base = reinterpret_cast<const uint32_t*>(code_address.ToPointer());
@ -59,7 +59,7 @@ String^ Disassembler::DisassemblePPC(IntPtr code_address, size_t code_size) {
return gcnew String(string_buffer_->ToString());
}
String^ Disassembler::DisassembleX64(IntPtr code_address, size_t code_size) {
String ^ Disassembler::DisassembleX64(IntPtr code_address, size_t code_size) {
string_buffer_->Reset();
auto code_base = reinterpret_cast<const uint8_t*>(code_address.ToPointer());

View File

@ -21,13 +21,14 @@ namespace Native {
using namespace System;
using namespace System::Text;
public ref class Disassembler {
public
ref class Disassembler {
public:
Disassembler();
~Disassembler();
String^ DisassemblePPC(IntPtr code_address, size_t code_size);
String^ DisassembleX64(IntPtr code_address, size_t code_size);
String ^ DisassemblePPC(IntPtr code_address, size_t code_size);
String ^ DisassembleX64(IntPtr code_address, size_t code_size);
private:
uintptr_t capstone_handle_;

View File

@ -38,15 +38,14 @@ namespace apu {
using namespace xe::cpu;
AudioSystem::AudioSystem(Emulator* emulator)
: emulator_(emulator),
memory_(emulator->memory()),
worker_running_(false) {
: emulator_(emulator), memory_(emulator->memory()), worker_running_(false) {
std::memset(clients_, 0, sizeof(clients_));
for (size_t i = 0; i < kMaximumClientCount; ++i) {
unused_clients_.push(i);
}
for (size_t i = 0; i < kMaximumClientCount; ++i) {
client_semaphores_[i] = CreateSemaphore(NULL, 0, kMaximumQueuedFrames, NULL);
client_semaphores_[i] =
CreateSemaphore(NULL, 0, kMaximumQueuedFrames, NULL);
wait_handles_[i] = client_semaphores_[i];
}
shutdown_event_ = CreateEvent(NULL, TRUE, FALSE, NULL);

View File

@ -48,7 +48,8 @@ class AudioSystem {
AudioDriver** out_driver) = 0;
virtual void DestroyDriver(AudioDriver* driver) = 0;
// TODO(gibbed): respect XAUDIO2_MAX_QUEUED_BUFFERS somehow (ie min(64, XAUDIO2_MAX_QUEUED_BUFFERS))
// TODO(gibbed): respect XAUDIO2_MAX_QUEUED_BUFFERS somehow (ie min(64,
// XAUDIO2_MAX_QUEUED_BUFFERS))
static const size_t kMaximumQueuedFrames = 64;
protected:
@ -79,7 +80,7 @@ class AudioSystem {
} clients_[kMaximumClientCount];
HANDLE client_semaphores_[kMaximumClientCount];
HANDLE shutdown_event_; // Event is always there in case we have no clients.
HANDLE shutdown_event_; // Event is always there in case we have no clients.
HANDLE wait_handles_[kMaximumClientCount + 1];
std::queue<size_t> unused_clients_;
};

View File

@ -27,15 +27,15 @@ namespace xe {
namespace apu {
XmaContext::XmaContext()
: id_(0)
, guest_ptr_(0)
, is_allocated_(false)
, is_enabled_(false)
, decoding_packet_(false)
, codec_(nullptr)
, context_(nullptr)
, decoded_frame_(nullptr)
, packet_(nullptr) {}
: id_(0),
guest_ptr_(0),
is_allocated_(false),
is_enabled_(false),
decoding_packet_(false),
codec_(nullptr),
context_(nullptr),
decoded_frame_(nullptr),
packet_(nullptr) {}
XmaContext::~XmaContext() {
if (context_) {
@ -48,11 +48,11 @@ XmaContext::~XmaContext() {
av_frame_free(&decoded_frame_);
}
if (current_frame_) {
delete [] current_frame_;
delete[] current_frame_;
}
}
int XmaContext::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) {
int XmaContext::Setup(uint32_t id, Memory *memory, uint32_t guest_ptr) {
id_ = id;
memory_ = memory;
guest_ptr_ = guest_ptr;
@ -94,7 +94,7 @@ int XmaContext::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) {
extra_data_.decode_flags = 0x10D6;
context_->extradata_size = sizeof(extra_data_);
context_->extradata = (uint8_t*)&extra_data_;
context_->extradata = (uint8_t *)&extra_data_;
// Current frame stuff whatever
// samples per frame * 2 max channels * output bytes
@ -126,10 +126,11 @@ void XmaContext::Enable() {
auto context_ptr = memory()->TranslateVirtual(guest_ptr());
XMA_CONTEXT_DATA data(context_ptr);
XELOGAPU("XmaContext: kicking context %d (%d/%d bytes)", id(),
XELOGAPU(
"XmaContext: kicking context %d (%d/%d bytes)", id(),
(data.input_buffer_read_offset & ~0x7FF) / 8,
(data.input_buffer_0_packet_count + data.input_buffer_1_packet_count)
* kBytesPerPacket);
(data.input_buffer_0_packet_count + data.input_buffer_1_packet_count) *
kBytesPerPacket);
// Reset valid flags so our audio decoder knows to process this one.
data.input_buffer_0_valid = data.input_buffer_0_ptr != 0;
@ -190,16 +191,20 @@ void XmaContext::Release() {
int XmaContext::GetSampleRate(int id) {
switch (id) {
case 0: return 24000;
case 1: return 32000;
case 2: return 44100;
case 3: return 48000;
case 0:
return 24000;
case 1:
return 32000;
case 2:
return 44100;
case 3:
return 48000;
}
assert_always();
return 0;
}
void XmaContext::DecodePackets(XMA_CONTEXT_DATA& data) {
void XmaContext::DecodePackets(XMA_CONTEXT_DATA &data) {
SCOPE_profile_cpu_f("apu");
// What I see:
@ -231,10 +236,12 @@ void XmaContext::DecodePackets(XMA_CONTEXT_DATA& data) {
// Output buffers are in raw PCM samples, 256 bytes per block.
// Output buffer is a ring buffer. We need to write from the write offset
// to the read offset.
uint8_t* output_buffer = memory()->TranslatePhysical(data.output_buffer_ptr);
uint8_t *output_buffer = memory()->TranslatePhysical(data.output_buffer_ptr);
uint32_t output_capacity = data.output_buffer_block_count * kBytesPerSubframe;
uint32_t output_read_offset = data.output_buffer_read_offset * kBytesPerSubframe;
uint32_t output_write_offset = data.output_buffer_write_offset * kBytesPerSubframe;
uint32_t output_read_offset =
data.output_buffer_read_offset * kBytesPerSubframe;
uint32_t output_write_offset =
data.output_buffer_write_offset * kBytesPerSubframe;
RingBuffer output_rb(output_buffer, output_capacity);
output_rb.set_read_offset(output_read_offset);
@ -254,7 +261,7 @@ void XmaContext::DecodePackets(XMA_CONTEXT_DATA& data) {
while (decode_attempts_remaining) {
read_bytes = DecodePacket(work_buffer, 0, output_remaining_bytes);
if (read_bytes >= 0) {
//assert_true((read_bytes % 256) == 0);
// assert_true((read_bytes % 256) == 0);
auto written_bytes = output_rb.Write(work_buffer, read_bytes);
assert_true(read_bytes == written_bytes);
@ -269,7 +276,8 @@ void XmaContext::DecodePackets(XMA_CONTEXT_DATA& data) {
}
if (!decode_attempts_remaining) {
XELOGAPU("XmaContext: libav failed to decode packet (returned %.8X)", -read_bytes);
XELOGAPU("XmaContext: libav failed to decode packet (returned %.8X)",
-read_bytes);
// Failed out.
if (data.input_buffer_0_valid || data.input_buffer_1_valid) {
@ -309,10 +317,10 @@ void XmaContext::DecodePackets(XMA_CONTEXT_DATA& data) {
int XmaContext::StartPacket(XMA_CONTEXT_DATA &data) {
// Translate pointers for future use.
uint8_t* in0 = data.input_buffer_0_valid
uint8_t *in0 = data.input_buffer_0_valid
? memory()->TranslatePhysical(data.input_buffer_0_ptr)
: nullptr;
uint8_t* in1 = data.input_buffer_1_valid
uint8_t *in1 = data.input_buffer_1_valid
? memory()->TranslatePhysical(data.input_buffer_1_ptr)
: nullptr;
@ -348,9 +356,8 @@ int XmaContext::StartPacket(XMA_CONTEXT_DATA &data) {
// Still have data to read.
auto packet = input_buffer + input_offset_bytes;
assert_true(input_offset_bytes % 2048 == 0);
PreparePacket(packet, seq_offset_bytes,
kBytesPerPacket,
sample_rate, channels);
PreparePacket(packet, seq_offset_bytes, kBytesPerPacket, sample_rate,
channels);
data.input_buffer_read_offset += kBytesPerPacket * 8;
input_remaining_bytes -= kBytesPerPacket;
@ -395,7 +402,8 @@ int XmaContext::PreparePacket(uint8_t *input, size_t seq_offset, size_t size,
context_->sample_rate = sample_rate;
context_->channels = channels;
extra_data_.channel_mask = channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
extra_data_.channel_mask =
channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
if (avcodec_open2(context_, codec_, NULL) < 0) {
XELOGE("XmaContext: Failed to reopen libav context");
@ -487,8 +495,7 @@ int XmaContext::DecodePacket(uint8_t *output, size_t output_offset,
// Total size of the frame's samples
// Magic number 2 is sizeof an output sample
frame_samples_size_ =
context_->channels * decoded_frame_->nb_samples * 2;
frame_samples_size_ = context_->channels * decoded_frame_->nb_samples * 2;
to_copy = std::min(output_size, (size_t)(frame_samples_size_));
std::memcpy(output + output_offset, current_frame_, to_copy);

View File

@ -45,25 +45,25 @@ namespace apu {
struct XMA_CONTEXT_DATA {
// DWORD 0
uint32_t input_buffer_0_packet_count : 12; // XMASetInputBuffer0, number of
// 2KB packets. Max 4095 packets.
// These packets form a block.
uint32_t loop_count : 8; // +12bit, XMASetLoopData NumLoops
uint32_t input_buffer_0_valid : 1; // +20bit, XMAIsInputBuffer0Valid
uint32_t input_buffer_1_valid : 1; // +21bit, XMAIsInputBuffer1Valid
uint32_t output_buffer_block_count : 5; // +22bit SizeWrite 256byte blocks
uint32_t output_buffer_write_offset : 5; // +27bit
// XMAGetOutputBufferWriteOffset
// AKA OffsetWrite
uint32_t input_buffer_0_packet_count : 12; // XMASetInputBuffer0, number of
// 2KB packets. Max 4095 packets.
// These packets form a block.
uint32_t loop_count : 8; // +12bit, XMASetLoopData NumLoops
uint32_t input_buffer_0_valid : 1; // +20bit, XMAIsInputBuffer0Valid
uint32_t input_buffer_1_valid : 1; // +21bit, XMAIsInputBuffer1Valid
uint32_t output_buffer_block_count : 5; // +22bit SizeWrite 256byte blocks
uint32_t output_buffer_write_offset : 5; // +27bit
// XMAGetOutputBufferWriteOffset
// AKA OffsetWrite
// DWORD 1
uint32_t input_buffer_1_packet_count : 12; // XMASetInputBuffer1, number of
// 2KB packets. Max 4095 packets.
// These packets form a block.
uint32_t loop_subframe_end : 2; // +12bit, XMASetLoopData
uint32_t unk_dword_1_a : 3; // ? might be loop_subframe_skip
uint32_t loop_subframe_skip : 3; // +17bit, XMASetLoopData might be
// subframe_decode_count
uint32_t input_buffer_1_packet_count : 12; // XMASetInputBuffer1, number of
// 2KB packets. Max 4095 packets.
// These packets form a block.
uint32_t loop_subframe_end : 2; // +12bit, XMASetLoopData
uint32_t unk_dword_1_a : 3; // ? might be loop_subframe_skip
uint32_t loop_subframe_skip : 3; // +17bit, XMASetLoopData might be
// subframe_decode_count
uint32_t subframe_decode_count : 4; // +20bit might be subframe_skip_count
uint32_t unk_dword_1_b : 3; // ? NumSubframesToSkip/NumChannels(?)
uint32_t sample_rate : 2; // +27bit enum of sample rates
@ -99,7 +99,7 @@ struct XMA_CONTEXT_DATA {
uint32_t unk_dword_9 : 27; // StopWhenDone/InterruptWhenDone(?)
// DWORD 10-15
uint32_t unk_dwords_10_15[6]; // reserved?
uint32_t unk_dwords_10_15[6]; // reserved?
XMA_CONTEXT_DATA(const void* ptr) {
xe::copy_and_swap(reinterpret_cast<uint32_t*>(this),
@ -117,86 +117,87 @@ static_assert_size(XMA_CONTEXT_DATA, 64);
#pragma pack(push, 1)
struct WmaProExtraData {
uint16_t bits_per_sample;
uint32_t channel_mask;
uint8_t unk06[8];
uint16_t decode_flags;
uint8_t unk10[2];
uint16_t bits_per_sample;
uint32_t channel_mask;
uint8_t unk06[8];
uint16_t decode_flags;
uint8_t unk10[2];
};
static_assert_size(WmaProExtraData, 18);
#pragma pack(pop)
class XmaContext {
public:
static const uint32_t kBytesPerPacket = 2048;
public:
static const uint32_t kBytesPerPacket = 2048;
static const uint32_t kBytesPerSample = 2;
static const uint32_t kSamplesPerFrame = 512;
static const uint32_t kSamplesPerSubframe = 128;
static const uint32_t kBytesPerSubframe = kSamplesPerSubframe * kBytesPerSample;
static const uint32_t kBytesPerSample = 2;
static const uint32_t kSamplesPerFrame = 512;
static const uint32_t kSamplesPerSubframe = 128;
static const uint32_t kBytesPerSubframe =
kSamplesPerSubframe * kBytesPerSample;
static const uint32_t kOutputBytesPerBlock = 256;
static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
static const uint32_t kOutputBytesPerBlock = 256;
static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
XmaContext();
~XmaContext();
XmaContext();
~XmaContext();
int Setup(uint32_t id, Memory* memory, uint32_t guest_ptr);
void Work();
int Setup(uint32_t id, Memory* memory, uint32_t guest_ptr);
void Work();
void Enable();
bool Block(bool poll);
void Clear();
void Disable();
void Release();
void Enable();
bool Block(bool poll);
void Clear();
void Disable();
void Release();
Memory* memory() const { return memory_; }
Memory* memory() const { return memory_; }
uint32_t id() { return id_; }
uint32_t guest_ptr() { return guest_ptr_; }
bool is_allocated() { return is_allocated_; }
bool is_enabled() { return is_enabled_; }
uint32_t id() { return id_; }
uint32_t guest_ptr() { return guest_ptr_; }
bool is_allocated() { return is_allocated_; }
bool is_enabled() { return is_enabled_; }
void set_is_allocated(bool is_allocated) { is_allocated_ = is_allocated; }
void set_is_enabled(bool is_enabled) { is_enabled_ = is_enabled; }
void set_is_allocated(bool is_allocated) { is_allocated_ = is_allocated; }
void set_is_enabled(bool is_enabled) { is_enabled_ = is_enabled; }
private:
static int GetSampleRate(int id);
private:
static int GetSampleRate(int id);
void DecodePackets(XMA_CONTEXT_DATA& data);
int StartPacket(XMA_CONTEXT_DATA &data);
void DecodePackets(XMA_CONTEXT_DATA& data);
int StartPacket(XMA_CONTEXT_DATA& data);
int PreparePacket(uint8_t* input, size_t seq_offset, size_t size,
int sample_rate, int channels);
void DiscardPacket();
int PreparePacket(uint8_t* input, size_t seq_offset, size_t size,
int sample_rate, int channels);
void DiscardPacket();
int DecodePacket(uint8_t* output, size_t offset, size_t size);
int DecodePacket(uint8_t* output, size_t offset, size_t size);
Memory* memory_;
Memory* memory_;
uint32_t id_;
uint32_t guest_ptr_;
xe::mutex lock_;
bool is_allocated_;
bool is_enabled_;
uint32_t id_;
uint32_t guest_ptr_;
xe::mutex lock_;
bool is_allocated_;
bool is_enabled_;
bool decoding_packet_;
bool decoding_packet_;
// libav structures
AVCodec* codec_;
AVCodecContext* context_;
AVFrame* decoded_frame_;
AVPacket* packet_;
WmaProExtraData extra_data_;
// libav structures
AVCodec* codec_;
AVCodecContext* context_;
AVFrame* decoded_frame_;
AVPacket* packet_;
WmaProExtraData extra_data_;
size_t current_frame_pos_;
uint8_t* current_frame_;
uint32_t frame_samples_size_;
size_t current_frame_pos_;
uint8_t* current_frame_;
uint32_t frame_samples_size_;
uint8_t packet_data_[kBytesPerPacket];
uint8_t packet_data_[kBytesPerPacket];
};
} // namespace apu
} // namespace xe
} // namespace apu
} // namespace xe
#endif // XENIA_APU_XMA_CONTEXT_H_

View File

@ -53,17 +53,16 @@ namespace apu {
using namespace xe::cpu;
XmaDecoder::XmaDecoder(Emulator* emulator)
: emulator_(emulator)
, memory_(emulator->memory())
, processor_(emulator->processor())
, worker_running_(false)
, context_data_first_ptr_(0)
, context_data_last_ptr_(0) {
}
: emulator_(emulator),
memory_(emulator->memory()),
processor_(emulator->processor()),
worker_running_(false),
context_data_first_ptr_(0),
context_data_last_ptr_(0) {}
XmaDecoder::~XmaDecoder() {}
void av_log_callback(void *avcl, int level, const char *fmt, va_list va) {
void av_log_callback(void* avcl, int level, const char* fmt, va_list va) {
StringBuffer buff;
buff.AppendVarargs(fmt, va);
xe::log_line('i', "libav: %s", buff.GetString());
@ -82,12 +81,14 @@ X_STATUS XmaDecoder::Setup() {
// Setup XMA context data.
context_data_first_ptr_ = memory()->SystemHeapAlloc(
sizeof(XMA_CONTEXT_DATA) * kContextCount, 256, kSystemHeapPhysical);
context_data_last_ptr_ = context_data_first_ptr_ + (sizeof(XMA_CONTEXT_DATA) * kContextCount - 1);
context_data_last_ptr_ =
context_data_first_ptr_ + (sizeof(XMA_CONTEXT_DATA) * kContextCount - 1);
registers_.context_array_ptr = context_data_first_ptr_;
// Setup XMA contexts.
for (int i = 0; i < kContextCount; ++i) {
uint32_t guest_ptr = registers_.context_array_ptr + i * sizeof(XMA_CONTEXT_DATA);
uint32_t guest_ptr =
registers_.context_array_ptr + i * sizeof(XMA_CONTEXT_DATA);
XmaContext& context = contexts_[i];
if (context.Setup(i, memory(), guest_ptr)) {
assert_always();

View File

@ -41,9 +41,7 @@ class XmaDecoder {
virtual X_STATUS Setup();
virtual void Shutdown();
uint32_t context_array_ptr() const {
return registers_.context_array_ptr;
}
uint32_t context_array_ptr() const { return registers_.context_array_ptr; }
uint32_t AllocateContext();
void ReleaseContext(uint32_t guest_ptr);

View File

@ -66,9 +66,7 @@ void* Arena::Alloc(size_t size) {
return p;
}
void Arena::Rewind(size_t size) {
active_chunk_->offset -= size;
}
void Arena::Rewind(size_t size) { active_chunk_->offset -= size; }
void* Arena::CloneContents() {
size_t total_length = 0;

View File

@ -22,7 +22,7 @@
namespace xe {
template <typename T, size_t N>
size_t countof(T (&arr)[N]) {
size_t countof(T(&arr)[N]) {
return std::extent<T[N]>::value;
}

View File

@ -15,10 +15,7 @@
namespace xe {
RingBuffer::RingBuffer(uint8_t* buffer, size_t capacity)
: buffer_(buffer)
, capacity_(capacity)
, read_offset_(0)
, write_offset_(0) {}
: buffer_(buffer), capacity_(capacity), read_offset_(0), write_offset_(0) {}
size_t RingBuffer::Read(uint8_t* buffer, size_t count) {
count = std::min(count, capacity_);
@ -60,4 +57,4 @@ size_t RingBuffer::Write(uint8_t* buffer, size_t count) {
return count;
}
} // namespace xe
} // namespace xe

View File

@ -17,52 +17,48 @@
namespace xe {
class RingBuffer {
public:
RingBuffer(uint8_t* buffer, size_t capacity);
public:
RingBuffer(uint8_t* buffer, size_t capacity);
size_t Read(uint8_t* buffer, size_t count);
size_t Write(uint8_t* buffer, size_t count);
size_t Read(uint8_t* buffer, size_t count);
size_t Write(uint8_t* buffer, size_t count);
uint8_t* buffer() { return buffer_; }
size_t capacity() { return capacity_; }
uint8_t* buffer() { return buffer_; }
size_t capacity() { return capacity_; }
size_t read_offset() { return read_offset_; }
size_t read_count() {
if (read_offset_ == write_offset_) {
return 0;
} else if (read_offset_ < write_offset_) {
return write_offset_ - read_offset_;
} else {
return (capacity_ - read_offset_) + write_offset_;
}
size_t read_offset() { return read_offset_; }
size_t read_count() {
if (read_offset_ == write_offset_) {
return 0;
} else if (read_offset_ < write_offset_) {
return write_offset_ - read_offset_;
} else {
return (capacity_ - read_offset_) + write_offset_;
}
}
size_t write_offset() { return write_offset_; }
size_t write_count() {
if (read_offset_ == write_offset_) {
return capacity_;
} else if (write_offset_ < read_offset_) {
return read_offset_ - write_offset_;
} else {
return (capacity_ - write_offset_) + read_offset_;
}
size_t write_offset() { return write_offset_; }
size_t write_count() {
if (read_offset_ == write_offset_) {
return capacity_;
} else if (write_offset_ < read_offset_) {
return read_offset_ - write_offset_;
} else {
return (capacity_ - write_offset_) + read_offset_;
}
}
void set_read_offset(size_t offset) {
read_offset_ = offset % capacity_;
}
void set_read_offset(size_t offset) { read_offset_ = offset % capacity_; }
void set_write_offset(size_t offset) {
write_offset_ = offset % capacity_;
}
void set_write_offset(size_t offset) { write_offset_ = offset % capacity_; }
private:
uint8_t* buffer_;
size_t capacity_;
size_t read_offset_;
size_t write_offset_;
private:
uint8_t* buffer_;
size_t capacity_;
size_t read_offset_;
size_t write_offset_;
};
} // namespace xe
} // namespace xe
#endif // XENIA_BASE_RING_BUFFER_H_
#endif // XENIA_BASE_RING_BUFFER_H_

View File

@ -66,7 +66,8 @@ bool X64CodeCache::Initialize() {
// Create mmap file. This allows us to share the code cache with the debugger.
wchar_t file_name[256];
wsprintf(file_name, L"Local\\xenia_code_cache_%p", Clock::QueryHostTickCount());
wsprintf(file_name, L"Local\\xenia_code_cache_%p",
Clock::QueryHostTickCount());
file_name_ = file_name;
mapping_ = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
PAGE_EXECUTE_READWRITE | SEC_RESERVE, 0,

View File

@ -358,8 +358,9 @@ template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2>
struct I<OPCODE, DEST, SRC1, SRC2> : DestField<DEST> {
typedef DestField<DEST> BASE;
static const hir::Opcode opcode = OPCODE;
static const uint32_t key = InstrKey::Construct<
OPCODE, DEST::key_type, SRC1::key_type, SRC2::key_type>::value;
static const uint32_t key =
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type,
SRC2::key_type>::value;
static const KeyType dest_type = DEST::key_type;
static const KeyType src1_type = SRC1::key_type;
static const KeyType src2_type = SRC2::key_type;

View File

@ -7,6 +7,9 @@
******************************************************************************
*/
// TODO(benvanik): fix this so we can auto format.
// clang-format off
// A note about vectors:
// Xenia represents vectors as xyzw pairs, with indices 0123.
// XMM registers are xyzw pairs with indices 3210, making them more like wzyx.

View File

@ -205,7 +205,7 @@ void TraceMemoryStoreV128(void* raw_context, uint32_t address, __m128 value) {
}
void TraceMemset(void* raw_context, uint32_t address, uint8_t value,
uint32_t length) {
uint32_t length) {
auto thread_state = *((ThreadState**)raw_context);
DPRINT("memset %.8X-%.8X (%d) = %.2X", address, address + length, length,
value);

View File

@ -65,41 +65,41 @@ void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str) {
}
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str) {
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
}
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str) {
if (i.D.RA) {
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
} else {
str->AppendFormat("%-8s r%d, 0, %d", i.type->name, i.D.RT,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
}
}
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str) {
str->AppendFormat("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
}
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str) {
if (i.D.RA) {
str->AppendFormat("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
} else {
str->AppendFormat("%-8s f%d, 0, %d", i.type->name, i.D.RT,
(int32_t)(int16_t) XEEXTS16(i.D.DS));
(int32_t)(int16_t)XEEXTS16(i.D.DS));
}
}
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str) {
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
}
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str) {
if (i.DS.RA) {
str->AppendFormat("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
} else {
str->AppendFormat("%-8s r%d, 0, %d", i.type->name, i.DS.RT,
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
(int32_t)(int16_t)XEEXTS16(i.DS.DS << 2));
}
}
void Disasm_D_RA(InstrData& i, StringBuffer* str) {

View File

@ -994,8 +994,7 @@ XEEMITTER(dcbz, 0x7C0007EC, X)(PPCHIRBuilder& f, InstrData& i) {
// dcbz128 - 128 byte set
block_size = 128;
address_mask = ~127;
}
else {
} else {
// dcbz - 32 byte set
block_size = 32;
address_mask = ~31;

View File

@ -77,14 +77,14 @@ void InstrOperand::Dump(std::string& out_str) {
switch (imm.width) {
case 1:
if (imm.is_signed) {
snprintf(buffer, max_count, "%d", (int32_t)(int8_t) imm.value);
snprintf(buffer, max_count, "%d", (int32_t)(int8_t)imm.value);
} else {
snprintf(buffer, max_count, "0x%.2X", (uint8_t)imm.value);
}
break;
case 2:
if (imm.is_signed) {
snprintf(buffer, max_count, "%d", (int32_t)(int16_t) imm.value);
snprintf(buffer, max_count, "%d", (int32_t)(int16_t)imm.value);
} else {
snprintf(buffer, max_count, "0x%.4X", (uint16_t)imm.value);
}

View File

@ -68,8 +68,10 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) {
if (backend->machine_info()->supports_extended_load_store) {
// Backend supports the advanced LOAD/STORE instructions.
// These will save us a lot of HIR opcodes.
compiler_->AddPass(std::make_unique<passes::MemorySequenceCombinationPass>());
if (validate) compiler_->AddPass(std::make_unique<passes::ValidationPass>());
compiler_->AddPass(
std::make_unique<passes::MemorySequenceCombinationPass>());
if (validate)
compiler_->AddPass(std::make_unique<passes::ValidationPass>());
}
compiler_->AddPass(std::make_unique<passes::SimplificationPass>());
if (validate) compiler_->AddPass(std::make_unique<passes::ValidationPass>());

View File

@ -7,6 +7,7 @@
******************************************************************************
*/
// clang-format off
DEFINE_OPCODE(
OPCODE_COMMENT,

View File

@ -23,62 +23,69 @@ TEST_CASE("ADD_I8", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT8_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == INT8_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT8_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == UINT8_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT8_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == INT8_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT8_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT8_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == INT8_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT8_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == UINT8_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT8_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == INT8_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT8_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("ADD_I16", "[instr]") {
@ -88,62 +95,69 @@ TEST_CASE("ADD_I16", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT16_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == INT16_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT16_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == UINT16_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT16_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == INT16_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT16_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT16_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == INT16_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT16_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == UINT16_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT16_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == INT16_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT16_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("ADD_I32", "[instr]") {
@ -153,62 +167,69 @@ TEST_CASE("ADD_I32", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT32_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == INT32_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT32_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == UINT32_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT32_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == INT32_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT32_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0x23);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == -15);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT32_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == INT32_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT32_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == UINT32_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT32_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == INT32_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT32_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<int32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("ADD_I64", "[instr]") {
@ -216,62 +237,69 @@ TEST_CASE("ADD_I64", "[instr]") {
StoreGPR(b, 3, b.Add(LoadGPR(b, 4), LoadGPR(b, 5)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0x23);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == -15);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT64_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == INT64_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT64_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == UINT64_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = INT64_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == INT64_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = UINT64_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 10;
ctx->r[5] = 25;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0x23);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = -10;
ctx->r[5] = -5;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == -15);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT64_MIN;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == INT64_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT64_MAX;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == UINT64_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = INT64_MIN;
ctx->r[5] = -1;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == INT64_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = UINT64_MAX;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == 0);
});
}
TEST_CASE("ADD_F32", "[instr]") {
@ -281,54 +309,60 @@ TEST_CASE("ADD_F32", "[instr]") {
FLOAT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = 0.0;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 0.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = 5.0;
ctx->f[5] = 7.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 12.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = FLT_MAX / 2.0;
ctx->f[5] = FLT_MAX / 2.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = -100.0;
ctx->f[5] = -150.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == -250.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = FLT_MIN;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = FLT_MAX;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = 0.0;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 0.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = 5.0;
ctx->f[5] = 7.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 12.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = FLT_MAX / 2.0;
ctx->f[5] = FLT_MAX / 2.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = -100.0;
ctx->f[5] = -150.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == -250.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = FLT_MIN;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = FLT_MAX;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == FLT_MAX);
});
}
TEST_CASE("ADD_F64", "[instr]") {
@ -336,52 +370,58 @@ TEST_CASE("ADD_F64", "[instr]") {
StoreFPR(b, 3, b.Add(LoadFPR(b, 4), LoadFPR(b, 5)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = 0.0;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 0.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = 5.0;
ctx->f[5] = 7.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 12.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = DBL_MAX / 2.0;
ctx->f[5] = DBL_MAX / 2.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MAX);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = -100.0;
ctx->f[5] = -150.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == -250.0);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = DBL_MIN;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MIN);
});
test.Run([](PPCContext* ctx) {
ctx->f[4] = DBL_MAX;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = 0.0;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 0.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = 5.0;
ctx->f[5] = 7.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == 12.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = DBL_MAX / 2.0;
ctx->f[5] = DBL_MAX / 2.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MAX);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = -100.0;
ctx->f[5] = -150.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == -250.0);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = DBL_MIN;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MIN);
});
test.Run(
[](PPCContext* ctx) {
ctx->f[4] = DBL_MAX;
ctx->f[5] = 0.0;
},
[](PPCContext* ctx) {
auto result = ctx->f[3];
REQUIRE(result == DBL_MAX);
});
}

View File

@ -17,27 +17,30 @@ using xe::cpu::frontend::PPCContext;
TEST_CASE("BYTE_SWAP_V128", "[instr]") {
TestFunction([](HIRBuilder& b) {
StoreVR(b, 3, b.ByteSwap(LoadVR(b, 4)));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(3, 2, 1, 0, 7, 6, 5, 4, 11,
10, 9, 8, 15, 14, 13, 12));
});
StoreVR(b, 3, b.ByteSwap(LoadVR(b, 4)));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15,
14, 13, 12));
});
TestFunction([](HIRBuilder& b) {
StoreVR(b, 3, b.ByteSwap(LoadVR(b, 4)));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0x0C13100F, 0x0E0D0C0B, 0x0A000000,
0x00000000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0x0F10130C, 0x0B0C0D0E,
0x0000000A, 0x00000000));
});
StoreVR(b, 3, b.ByteSwap(LoadVR(b, 4)));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x0C13100F, 0x0E0D0C0B, 0x0A000000, 0x00000000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x0F10130C, 0x0B0C0D0E, 0x0000000A, 0x00000000));
});
}

View File

@ -26,36 +26,37 @@ TEST_CASE("EXTRACT_INT8", "[instr]") {
b.Return();
});
for (int i = 0; i < 16; ++i) {
test.Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
test.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
}
}
TEST_CASE("EXTRACT_INT8_CONSTANT", "[instr]") {
for (int i = 0; i < 16; ++i) {
TestFunction(
[i](HIRBuilder& b) {
StoreGPR(b, 3,
b.ZeroExtend(b.Extract(LoadVR(b, 4), b.LoadConstantInt8(i),
INT8_TYPE),
INT64_TYPE));
b.Return();
}).Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
TestFunction([i](HIRBuilder& b) {
StoreGPR(b, 3, b.ZeroExtend(b.Extract(LoadVR(b, 4), b.LoadConstantInt8(i),
INT8_TYPE),
INT64_TYPE));
b.Return();
})
.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
}
}
@ -68,34 +69,36 @@ TEST_CASE("EXTRACT_INT16", "[instr]") {
b.Return();
});
for (int i = 0; i < 8; ++i) {
test.Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128s(0x0000, 0x1001, 0x2002, 0x3003, 0x4004,
0x5005, 0x6006, 0x7007);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == (i | (i << 12)));
});
test.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128s(0x0000, 0x1001, 0x2002, 0x3003, 0x4004, 0x5005,
0x6006, 0x7007);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == (i | (i << 12)));
});
}
}
TEST_CASE("EXTRACT_INT16_CONSTANT", "[instr]") {
for (int i = 0; i < 8; ++i) {
TestFunction([i](HIRBuilder& b) {
StoreGPR(b, 3, b.ZeroExtend(b.Extract(LoadVR(b, 4),
b.LoadConstantInt8(i),
INT16_TYPE),
INT64_TYPE));
b.Return();
}).Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
StoreGPR(b, 3, b.ZeroExtend(b.Extract(LoadVR(b, 4), b.LoadConstantInt8(i),
INT16_TYPE),
INT64_TYPE));
b.Return();
})
.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
}
}
@ -108,32 +111,34 @@ TEST_CASE("EXTRACT_INT32", "[instr]") {
b.Return();
});
for (int i = 0; i < 4; ++i) {
test.Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128i(0, 1, 2, 3);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
test.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128i(0, 1, 2, 3);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
}
}
TEST_CASE("EXTRACT_INT32_CONSTANT", "[instr]") {
for (int i = 0; i < 4; ++i) {
TestFunction([i](HIRBuilder& b) {
StoreGPR(b, 3, b.ZeroExtend(b.Extract(LoadVR(b, 4),
b.LoadConstantInt8(i),
INT32_TYPE),
INT64_TYPE));
b.Return();
}).Run([i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128i(0, 1, 2, 3);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
StoreGPR(b, 3, b.ZeroExtend(b.Extract(LoadVR(b, 4), b.LoadConstantInt8(i),
INT32_TYPE),
INT64_TYPE));
b.Return();
})
.Run(
[i](PPCContext* ctx) {
ctx->r[4] = i;
ctx->v[4] = vec128i(0, 1, 2, 3);
},
[i](PPCContext* ctx) {
auto result = ctx->r[3];
REQUIRE(result == i);
});
}
}

View File

@ -24,19 +24,20 @@ TEST_CASE("INSERT_INT8", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT8_TYPE)));
b.Return();
});
test.Run([i](PPCContext* ctx) {
ctx->v[4] = vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected = vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15);
expected.i8[i ^ 0x3] = 100 + i;
REQUIRE(result == expected);
});
test.Run(
[i](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
expected.i8[i ^ 0x3] = 100 + i;
REQUIRE(result == expected);
});
}
}
@ -47,17 +48,18 @@ TEST_CASE("INSERT_INT16", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT16_TYPE)));
b.Return();
});
test.Run([i](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
expected.i16[i ^ 0x1] = 100 + i;
REQUIRE(result == expected);
});
test.Run(
[i](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
expected.i16[i ^ 0x1] = 100 + i;
REQUIRE(result == expected);
});
}
}
@ -68,16 +70,17 @@ TEST_CASE("INSERT_INT32", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT32_TYPE)));
b.Return();
});
test.Run([i](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected = vec128i(0, 1, 2, 3);
expected.i32[i] = 100 + i;
REQUIRE(result == expected);
});
test.Run(
[i](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->r[4] = i;
ctx->r[5] = 100 + i;
},
[i](PPCContext* ctx) {
auto result = ctx->v[3];
auto expected = vec128i(0, 1, 2, 3);
expected.i32[i] = 100 + i;
REQUIRE(result == expected);
});
}
}

View File

@ -25,14 +25,14 @@ TEST_CASE("PACK_D3DCOLOR", "[instr]") {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x40400050, 0x40400060, 0x40400070, 0x40400080);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x80506070));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x40400050, 0x40400060, 0x40400070, 0x40400080);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x80506070));
});
}
TEST_CASE("PACK_FLOAT16_2", "[instr]") {
@ -45,22 +45,22 @@ TEST_CASE("PACK_FLOAT16_2", "[instr]") {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x47FFE000, 0xC7FFE000, 0x00000000, 0x3F800000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x7FFFFFFF));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x42AAA000, 0x44CCC000, 0x00000000, 0x3F800000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x55556666));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x47FFE000, 0xC7FFE000, 0x00000000, 0x3F800000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x7FFFFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x42AAA000, 0x44CCC000, 0x00000000, 0x3F800000);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x55556666));
});
}
TEST_CASE("PACK_FLOAT16_4", "[instr]") {
@ -73,15 +73,15 @@ TEST_CASE("PACK_FLOAT16_4", "[instr]") {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x449A4000, 0x45B17000, 0x41103261, 0x40922B6B);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000000, 0x00000000, 0x64D26D8C, 0x48824491));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x449A4000, 0x45B17000, 0x41103261, 0x40922B6B);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000000, 0x00000000, 0x64D26D8C, 0x48824491));
});
}
TEST_CASE("PACK_SHORT_2", "[instr]") {
@ -94,18 +94,20 @@ TEST_CASE("PACK_SHORT_2", "[instr]") {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0x43817E00, 0xC37CFC00, 0, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x7FFF8001));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0xC0D47D97, 0xC2256E9D, 0, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x80018001));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x43817E00, 0xC37CFC00, 0, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x7FFF8001));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0xC0D47D97, 0xC2256E9D, 0, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 0, 0x80018001));
});
}

View File

@ -19,66 +19,70 @@ TEST_CASE("PERMUTE_V128_BY_INT32_CONSTANT", "[instr]") {
{
uint32_t mask = PERMUTE_MASK(0, 0, 0, 1, 0, 2, 0, 3);
TestFunction([mask](HIRBuilder& b) {
StoreVR(b, 3,
b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, 2, 3));
});
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, 2, 3));
});
}
{
uint32_t mask = PERMUTE_MASK(1, 0, 1, 1, 1, 2, 1, 3);
TestFunction([mask](HIRBuilder& b) {
StoreVR(b, 3,
b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(4, 5, 6, 7));
});
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(4, 5, 6, 7));
});
}
{
uint32_t mask = PERMUTE_MASK(0, 3, 0, 2, 0, 1, 0, 0);
TestFunction([mask](HIRBuilder& b) {
StoreVR(b, 3,
b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(3, 2, 1, 0));
});
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(3, 2, 1, 0));
});
}
{
uint32_t mask = PERMUTE_MASK(1, 3, 1, 2, 1, 1, 1, 0);
TestFunction([mask](HIRBuilder& b) {
StoreVR(b, 3,
b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
}).Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(7, 6, 5, 4));
});
StoreVR(b, 3, b.Permute(b.LoadConstantUint32(mask), LoadVR(b, 4),
LoadVR(b, 5), INT32_TYPE));
b.Return();
})
.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(7, 6, 5, 4));
});
}
}
@ -88,56 +92,60 @@ TEST_CASE("PERMUTE_V128_BY_V128", "[instr]") {
b.Permute(LoadVR(b, 3), LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[3] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[4] = vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15));
});
test.Run([](PPCContext* ctx) {
ctx->v[3] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31);
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(116, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(116, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31));
});
test.Run([](PPCContext* ctx) {
ctx->v[3] =
vec128b(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
ctx->v[4] = vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4,
3, 2, 1, 100));
});
test.Run([](PPCContext* ctx) {
ctx->v[3] = vec128b(31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20,
19, 18, 17, 16);
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 131);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(131, 30, 29, 28, 27, 26, 25, 24, 23, 22,
21, 20, 19, 18, 17, 16));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[3] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[4] =
vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[3] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31);
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(116, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(116, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[3] =
vec128b(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
ctx->v[4] =
vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
2, 1, 100));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[3] = vec128b(31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19,
18, 17, 16);
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 131);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(131, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21,
20, 19, 18, 17, 16));
});
}

View File

@ -21,46 +21,51 @@ TEST_CASE("SHA_I8", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xF0;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xF0;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHA_I16", "[instr]") {
@ -70,46 +75,51 @@ TEST_CASE("SHA_I16", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF00;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF00;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHA_I32", "[instr]") {
@ -119,46 +129,51 @@ TEST_CASE("SHA_I32", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFF0000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFF0000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHA_I64", "[instr]") {
@ -167,44 +182,49 @@ TEST_CASE("SHA_I64", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT8_TYPE)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF00000000ull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFEull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF00000000ull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFEull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}

View File

@ -21,46 +21,51 @@ TEST_CASE("SHL_I8", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x0F;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xF0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFE);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x80);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x0F;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xF0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFE);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x80);
});
}
TEST_CASE("SHL_I16", "[instr]") {
@ -70,46 +75,51 @@ TEST_CASE("SHL_I16", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x00FF;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFF00);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFE);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x8000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x00FF;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFF00);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFE);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x8000);
});
}
TEST_CASE("SHL_I32", "[instr]") {
@ -119,46 +129,51 @@ TEST_CASE("SHL_I32", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x0000FFFF;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF0000);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFE);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x0000FFFF;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF0000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFE);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
}
TEST_CASE("SHL_I64", "[instr]") {
@ -167,44 +182,49 @@ TEST_CASE("SHL_I64", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT8_TYPE)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x00000000FFFFFFFFull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF00000000ull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFEull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x00000000FFFFFFFFull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF00000000ull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFEull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
}

View File

@ -22,46 +22,51 @@ TEST_CASE("SHR_I8", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xF0;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x0F);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x7F);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xF0;
ctx->r[5] = 4;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x0F);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0xFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0x7F);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7F;
ctx->r[5] = 7;
},
[](PPCContext* ctx) {
auto result = static_cast<uint8_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHR_I16", "[instr]") {
@ -71,46 +76,51 @@ TEST_CASE("SHR_I16", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFF00;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x00FF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x7FFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFF00;
ctx->r[5] = 8;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x00FF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0xFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0x7FFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFF;
ctx->r[5] = 15;
},
[](PPCContext* ctx) {
auto result = static_cast<uint16_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHR_I32", "[instr]") {
@ -120,46 +130,51 @@ TEST_CASE("SHR_I32", "[instr]") {
INT64_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFF0000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x0000FFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x7FFFFFFF);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFF0000;
ctx->r[5] = 16;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x0000FFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFE;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x7FFFFFFF);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x80000000;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0x80000000);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFF;
ctx->r[5] = 31;
},
[](PPCContext* ctx) {
auto result = static_cast<uint32_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHR_I64", "[instr]") {
@ -168,46 +183,51 @@ TEST_CASE("SHR_I64", "[instr]") {
b.Truncate(LoadGPR(b, 5), INT8_TYPE)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF00000000ull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x00000000FFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFEull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x7FFFFFFFFFFFFFFFull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run([](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFF00000000ull;
ctx->r[5] = 32;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x00000000FFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFFull;
ctx->r[5] = 0;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0xFFFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0xFFFFFFFFFFFFFFFEull;
ctx->r[5] = 1;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x7FFFFFFFFFFFFFFFull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x8000000000000000ull;
ctx->r[5] = 64;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0x8000000000000000ull);
});
test.Run(
[](PPCContext* ctx) {
ctx->r[4] = 0x7FFFFFFFFFFFFFFFull;
ctx->r[5] = 63;
},
[](PPCContext* ctx) {
auto result = static_cast<uint64_t>(ctx->r[3]);
REQUIRE(result == 0);
});
}
TEST_CASE("SHR_V128", "[instr]") {
@ -215,44 +235,44 @@ TEST_CASE("SHR_V128", "[instr]") {
StoreVR(b, 3, b.Shr(LoadVR(b, 4), b.Truncate(LoadGPR(b, 1), INT8_TYPE)));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->r[1] = 0;
ctx->v[4] =
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run([](PPCContext* ctx) {
ctx->r[1] = 1;
ctx->v[4] =
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run([](PPCContext* ctx) {
ctx->r[1] = 2;
ctx->v[4] =
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0x3FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run([](PPCContext* ctx) {
ctx->r[1] = 8;
ctx->v[4] =
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->r[1] = 0;
ctx->v[4] = vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->r[1] = 1;
ctx->v[4] = vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->r[1] = 2;
ctx->v[4] = vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0x3FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->r[1] = 8;
ctx->v[4] = vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
},
[](PPCContext* ctx) {
auto result1 = ctx->v[3];
REQUIRE(result1 ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
});
}

View File

@ -17,30 +17,33 @@ using xe::cpu::frontend::PPCContext;
TEST_CASE("SWIZZLE_V128", "[instr]") {
TestFunction([](HIRBuilder& b) {
StoreVR(b, 3, b.Swizzle(LoadVR(b, 4), INT32_TYPE,
SWIZZLE_MASK(0, 1, 2, 3)));
b.Return();
}).Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, 2, 3));
});
StoreVR(b, 3,
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(0, 1, 2, 3)));
b.Return();
})
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, 2, 3));
});
TestFunction([](HIRBuilder& b) {
StoreVR(b, 3, b.Swizzle(LoadVR(b, 4), INT32_TYPE,
SWIZZLE_MASK(3, 2, 1, 0)));
b.Return();
}).Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(3, 2, 1, 0));
});
StoreVR(b, 3,
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(3, 2, 1, 0)));
b.Return();
})
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(3, 2, 1, 0));
});
TestFunction([](HIRBuilder& b) {
StoreVR(b, 3, b.Swizzle(LoadVR(b, 4), INT32_TYPE,
SWIZZLE_MASK(1, 1, 2, 2)));
b.Return();
}).Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(1, 1, 2, 2));
});
StoreVR(b, 3,
b.Swizzle(LoadVR(b, 4), INT32_TYPE, SWIZZLE_MASK(1, 1, 2, 2)));
b.Return();
})
.Run([](PPCContext* ctx) { ctx->v[4] = vec128i(0, 1, 2, 3); },
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(1, 1, 2, 2));
});
}

View File

@ -20,23 +20,25 @@ TEST_CASE("UNPACK_D3DCOLOR", "[instr]") {
StoreVR(b, 3, b.Unpack(LoadVR(b, 4), PACK_TYPE_D3DCOLOR));
b.Return();
});
test.Run([](PPCContext* ctx) {
uint32_t value = 0;
ctx->v[4] = vec128i(0, 0, 0, value);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128f(1.0f, 1.0f, 1.0f, 1.0f));
});
test.Run([](PPCContext* ctx) {
uint32_t value = 0x80506070;
ctx->v[4] = vec128i(0, 0, 0, value);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x3F800050, 0x3F800060, 0x3F800070, 0x3F800080));
});
test.Run(
[](PPCContext* ctx) {
uint32_t value = 0;
ctx->v[4] = vec128i(0, 0, 0, value);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128f(1.0f, 1.0f, 1.0f, 1.0f));
});
test.Run(
[](PPCContext* ctx) {
uint32_t value = 0x80506070;
ctx->v[4] = vec128i(0, 0, 0, value);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x3F800050, 0x3F800060, 0x3F800070, 0x3F800080));
});
}
TEST_CASE("UNPACK_FLOAT16_2", "[instr]") {
@ -73,14 +75,15 @@ TEST_CASE("UNPACK_FLOAT16_4", "[instr]") {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 0, 0, 0, 0x64D2, 0x6D8B, 0x4881, 0x4491);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x449A4000, 0x45B16000, 0x41102000, 0x40922000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 0, 0, 0, 0x64D2, 0x6D8B, 0x4881, 0x4491);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x449A4000, 0x45B16000, 0x41102000, 0x40922000));
});
}
TEST_CASE("UNPACK_SHORT_2", "[instr]") {
@ -94,23 +97,24 @@ TEST_CASE("UNPACK_SHORT_2", "[instr]") {
REQUIRE(result ==
vec128i(0x40400000, 0x40400000, 0x00000000, 0x3F800000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x7004FD60, 0x8201C990, 0x00000000, 0x7FFF8001);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x40407FFF, 0x403F8001, 0x00000000, 0x3F800000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 0, 0, (0x1234u << 16) | 0x5678u);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x40401234, 0x40405678, 0x00000000, 0x3F800000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x7004FD60, 0x8201C990, 0x00000000, 0x7FFF8001);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x40407FFF, 0x403F8001, 0x00000000, 0x3F800000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 0, 0, (0x1234u << 16) | 0x5678u);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x40401234, 0x40405678, 0x00000000, 0x3F800000));
});
}
// TEST_CASE("UNPACK_S8_IN_16_LO", "[instr]") {

View File

@ -22,25 +22,27 @@ TEST_CASE("VECTOR_ADD_I8", "[instr]") {
StoreVR(b, 3, b.VectorAdd(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(100, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20,
22, 24, 26, 28, 30));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128b(UINT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] =
vec128b(100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(100, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
24, 26, 28, 30));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(UINT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0));
});
}
TEST_CASE("VECTOR_ADD_I8_SAT_SIGNED", "[instr]") {
@ -49,22 +51,24 @@ TEST_CASE("VECTOR_ADD_I8_SAT_SIGNED", "[instr]") {
ARITHMETIC_SATURATE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128b(INT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(INT8_MAX));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128b(INT8_MIN);
ctx->v[5] = vec128b(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(INT8_MIN));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(INT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(INT8_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(INT8_MIN);
ctx->v[5] = vec128b(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(INT8_MIN));
});
}
TEST_CASE("VECTOR_ADD_I8_SAT_UNSIGNED", "[instr]") {
@ -73,14 +77,15 @@ TEST_CASE("VECTOR_ADD_I8_SAT_UNSIGNED", "[instr]") {
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128b(UINT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(UINT8_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(UINT8_MAX);
ctx->v[5] = vec128b(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(UINT8_MAX));
});
}
TEST_CASE("VECTOR_ADD_I16", "[instr]") {
@ -88,30 +93,33 @@ TEST_CASE("VECTOR_ADD_I16", "[instr]") {
StoreVR(b, 3, b.VectorAdd(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
ctx->v[5] = vec128s(100, 1, 2, 3, 4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(100, 2, 4, 6, 8, 10, 12, 14));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(UINT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0);
ctx->v[5] = vec128s(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(UINT16_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, 6, 7);
ctx->v[5] = vec128s(100, 1, 2, 3, 4, 5, 6, 7);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(100, 2, 4, 6, 8, 10, 12, 14));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(UINT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0);
ctx->v[5] = vec128s(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(UINT16_MAX));
});
}
TEST_CASE("VECTOR_ADD_I16_SAT_SIGNED", "[instr]") {
@ -120,22 +128,24 @@ TEST_CASE("VECTOR_ADD_I16_SAT_SIGNED", "[instr]") {
ARITHMETIC_SATURATE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(INT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(INT16_MAX));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(INT16_MIN);
ctx->v[5] = vec128s(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(INT16_MIN));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(INT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(INT16_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(INT16_MIN);
ctx->v[5] = vec128s(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(INT16_MIN));
});
}
TEST_CASE("VECTOR_ADD_I16_SAT_UNSIGNED", "[instr]") {
@ -144,14 +154,15 @@ TEST_CASE("VECTOR_ADD_I16_SAT_UNSIGNED", "[instr]") {
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(UINT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(UINT16_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(UINT16_MAX);
ctx->v[5] = vec128s(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(UINT16_MAX));
});
}
TEST_CASE("VECTOR_ADD_I32", "[instr]") {
@ -159,30 +170,33 @@ TEST_CASE("VECTOR_ADD_I32", "[instr]") {
StoreVR(b, 3, b.VectorAdd(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(100, 1, 2, 3);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(100, 2, 4, 6));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(UINT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0);
ctx->v[5] = vec128i(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(UINT32_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 2, 3);
ctx->v[5] = vec128i(100, 1, 2, 3);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(100, 2, 4, 6));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(UINT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0);
ctx->v[5] = vec128i(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(UINT32_MAX));
});
}
TEST_CASE("VECTOR_ADD_I32_SAT_SIGNED", "[instr]") {
@ -191,30 +205,33 @@ TEST_CASE("VECTOR_ADD_I32_SAT_SIGNED", "[instr]") {
ARITHMETIC_SATURATE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(5);
ctx->v[5] = vec128i(5);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(10));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(INT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(INT32_MAX));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(INT32_MIN);
ctx->v[5] = vec128i(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(INT32_MIN));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(5);
ctx->v[5] = vec128i(5);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(10));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(INT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(INT32_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(INT32_MIN);
ctx->v[5] = vec128i(-1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(INT32_MIN));
});
}
TEST_CASE("VECTOR_ADD_I32_SAT_UNSIGNED", "[instr]") {
@ -223,22 +240,24 @@ TEST_CASE("VECTOR_ADD_I32_SAT_UNSIGNED", "[instr]") {
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(5);
ctx->v[5] = vec128i(5);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(10));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(UINT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(UINT32_MAX));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(5);
ctx->v[5] = vec128i(5);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(10));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(UINT32_MAX);
ctx->v[5] = vec128i(1);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(UINT32_MAX));
});
}
TEST_CASE("VECTOR_ADD_F32", "[instr]") {
@ -246,37 +265,41 @@ TEST_CASE("VECTOR_ADD_F32", "[instr]") {
StoreVR(b, 3, b.VectorAdd(LoadVR(b, 4), LoadVR(b, 5), FLOAT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128f(0.12f, 0.34f, 0.56f, 0.78f);
ctx->v[5] = vec128f(0.12f, 0.34f, 0.56f, 0.78f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x3E75C28F, 0x3F2E147B, 0x3F8F5C29, 0x3FC7AE14));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128f(FLT_MAX);
ctx->v[5] = vec128f(FLT_MAX);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0x7F800000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128f(-FLT_MIN);
ctx->v[5] = vec128f(-1.0f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0xBF800000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128f(FLT_MAX);
ctx->v[5] = vec128f(1.0f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0x7F7FFFFF));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128f(0.12f, 0.34f, 0.56f, 0.78f);
ctx->v[5] = vec128f(0.12f, 0.34f, 0.56f, 0.78f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x3E75C28F, 0x3F2E147B, 0x3F8F5C29, 0x3FC7AE14));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128f(FLT_MAX);
ctx->v[5] = vec128f(FLT_MAX);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0x7F800000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128f(-FLT_MIN);
ctx->v[5] = vec128f(-1.0f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0xBF800000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128f(FLT_MAX);
ctx->v[5] = vec128f(1.0f);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0x7F7FFFFF));
});
}

View File

@ -22,17 +22,18 @@ TEST_CASE("VECTOR_MAX_I8_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMax(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0, 1, 100, 3, 4, 5, 60, 7, 8, 9, 10, 11,
INT8_MAX, 13, 14, 15));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0, 1, 100, 3, 4, 5, 60, 7, 8, 9, 10, 11,
INT8_MAX, 13, 14, 15));
});
}
TEST_CASE("VECTOR_MAX_I8_UNSIGNED", "[instr]") {
@ -41,17 +42,18 @@ TEST_CASE("VECTOR_MAX_I8_UNSIGNED", "[instr]") {
ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9,
10, INT8_MIN, INT8_MAX, 13, 14, 15));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 14, 15));
});
}
TEST_CASE("VECTOR_MAX_I16_SIGNED", "[instr]") {
@ -59,14 +61,15 @@ TEST_CASE("VECTOR_MAX_I16_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMax(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, SHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0, 1, 2, 3, 4, SHRT_MAX, 6, 7));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, SHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0, 1, 2, 3, 4, SHRT_MAX, 6, 7));
});
}
TEST_CASE("VECTOR_MAX_I16_UNSIGNED", "[instr]") {
@ -91,14 +94,15 @@ TEST_CASE("VECTOR_MAX_I32_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMax(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, INT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, INT_MAX, 3));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, INT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 1, INT_MAX, 3));
});
}
TEST_CASE("VECTOR_MAX_I32_UNSIGNED", "[instr]") {
@ -107,12 +111,13 @@ TEST_CASE("VECTOR_MAX_I32_UNSIGNED", "[instr]") {
ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, UINT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(-1000000, 1, UINT_MAX, 3));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, UINT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(-1000000, 1, UINT_MAX, 3));
});
}

View File

@ -22,17 +22,18 @@ TEST_CASE("VECTOR_MIN_I8_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMin(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(-100, 1, 2, -3, 4, -5, 6, 7, -80, 9, 10,
INT8_MIN, 12, 13, 2, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(-100, 1, 100, -3, 4, -5, 60, 7, -80, 9, 10,
INT8_MIN, INT8_MAX, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(-100, 1, 2, -3, 4, -5, 6, 7, -80, 9, 10,
INT8_MIN, 12, 13, 2, 0));
});
}
TEST_CASE("VECTOR_MIN_I8_UNSIGNED", "[instr]") {
@ -41,17 +42,18 @@ TEST_CASE("VECTOR_MIN_I8_UNSIGNED", "[instr]") {
ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(255, 1, 200, -3, 4, -5, 60, 7, -80, 9, 10, 11,
12, 13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 2, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] =
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ctx->v[5] = vec128b(255, 1, 200, -3, 4, -5, 60, 7, -80, 9, 10, 11, 12,
13, 2, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 2, 0));
});
}
TEST_CASE("VECTOR_MIN_I16_SIGNED", "[instr]") {
@ -59,14 +61,15 @@ TEST_CASE("VECTOR_MIN_I16_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMin(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, SHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(-1000, 1, -2000, 3, 4, 5, -6000, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, SHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(-1000, 1, -2000, 3, 4, 5, -6000, 0));
});
}
TEST_CASE("VECTOR_MIN_I16_UNSIGNED", "[instr]") {
@ -75,14 +78,15 @@ TEST_CASE("VECTOR_MIN_I16_UNSIGNED", "[instr]") {
ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, USHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0, 1, 2, 3, 4, 5, 6, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0, 1, 2, 3, 4, 5, -6000, 7);
ctx->v[5] = vec128s(-1000, 1, -2000, 3, 4, USHRT_MAX, 6, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0, 1, 2, 3, 4, 5, 6, 0));
});
}
TEST_CASE("VECTOR_MIN_I32_SIGNED", "[instr]") {
@ -90,14 +94,15 @@ TEST_CASE("VECTOR_MIN_I32_SIGNED", "[instr]") {
StoreVR(b, 3, b.VectorMin(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, INT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(-1000000, 0, 123, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, INT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(-1000000, 0, 123, 0));
});
}
TEST_CASE("VECTOR_MIN_I32_UNSIGNED", "[instr]") {
@ -106,12 +111,13 @@ TEST_CASE("VECTOR_MIN_I32_UNSIGNED", "[instr]") {
ARITHMETIC_UNSIGNED));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, UINT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 123, 0));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0, 1, 123, 3);
ctx->v[5] = vec128i(-1000000, 0, UINT_MAX, 0);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128i(0, 0, 123, 0));
});
}

View File

@ -41,16 +41,17 @@ TEST_CASE("VECTOR_ROTATE_LEFT_I16", "[instr]") {
StoreVR(b, 3, b.VectorRotateLeft(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x0001, 0x0001, 0x0001, 0x0001, 0x1000, 0x1000,
0x1000, 0x1000);
ctx->v[5] = vec128s(0, 1, 2, 3, 14, 15, 16, 17);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x0001, 0x0002, 0x0004, 0x0008, 0x0400,
0x0800, 0x1000, 0x2000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x0001, 0x0001, 0x0001, 0x0001, 0x1000, 0x1000,
0x1000, 0x1000);
ctx->v[5] = vec128s(0, 1, 2, 3, 14, 15, 16, 17);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x0001, 0x0002, 0x0004, 0x0008, 0x0400,
0x0800, 0x1000, 0x2000));
});
}
TEST_CASE("VECTOR_ROTATE_LEFT_I32", "[instr]") {
@ -58,14 +59,14 @@ TEST_CASE("VECTOR_ROTATE_LEFT_I32", "[instr]") {
StoreVR(b, 3, b.VectorRotateLeft(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x00000001, 0x00000001, 0x80000000, 0x80000000);
ctx->v[5] = vec128i(0, 1, 1, 2);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000001, 0x00000002, 0x00000001, 0x00000002));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x00000001, 0x00000001, 0x80000000, 0x80000000);
ctx->v[5] = vec128i(0, 1, 1, 2);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000001, 0x00000002, 0x00000001, 0x00000002));
});
}

View File

@ -20,19 +20,19 @@ TEST_CASE("VECTOR_SHA_I8", "[instr]") {
StoreVR(b, 3, b.VectorSha(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0xF8, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0xF8, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHA_I8_CONSTANT", "[instr]") {
@ -43,17 +43,17 @@ TEST_CASE("VECTOR_SHA_I8_CONSTANT", "[instr]") {
INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0xF8, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0xF8, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHA_I16", "[instr]") {
@ -61,16 +61,17 @@ TEST_CASE("VECTOR_SHA_I16", "[instr]") {
StoreVR(b, 3, b.VectorSha(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0xFFFF,
0xFFFF, 0x0000, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0xFFFF,
0xFFFF, 0x0000, 0x1234));
});
}
TEST_CASE("VECTOR_SHA_I16_CONSTANT", "[instr]") {
@ -80,15 +81,16 @@ TEST_CASE("VECTOR_SHA_I16_CONSTANT", "[instr]") {
INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0xFFFF,
0xFFFF, 0x0000, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0xFFFF,
0xFFFF, 0x0000, 0x1234));
});
}
TEST_CASE("VECTOR_SHA_I32", "[instr]") {
@ -96,26 +98,26 @@ TEST_CASE("VECTOR_SHA_I32", "[instr]") {
StoreVR(b, 3, b.VectorSha(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0x3FFFFFFF, 0x00007FFF, 0x00000000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x12345678));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0x3FFFFFFF, 0x00007FFF, 0x00000000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x12345678));
});
}
TEST_CASE("VECTOR_SHA_I32_CONSTANT", "[instr]") {

View File

@ -20,19 +20,19 @@ TEST_CASE("VECTOR_SHL_I8", "[instr]") {
StoreVR(b, 3, b.VectorShl(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0xFC, 0xF8, 0x7F, 0x00, 0xF0, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0xFC, 0xF8, 0x7F, 0x00, 0xF0, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHL_I8_CONSTANT", "[instr]") {
@ -43,17 +43,17 @@ TEST_CASE("VECTOR_SHL_I8_CONSTANT", "[instr]") {
INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0xFC, 0xF8, 0x7F, 0x00, 0xF0, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0xFC, 0xF8, 0x7F, 0x00, 0xF0, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHL_I16", "[instr]") {
@ -61,16 +61,17 @@ TEST_CASE("VECTOR_SHL_I16", "[instr]") {
StoreVR(b, 3, b.VectorShl(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0xFFFC, 0xFE00, 0x8000, 0x0000,
0xFF00, 0x0002, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0xFFFC, 0xFE00, 0x8000, 0x0000,
0xFF00, 0x0002, 0x1234));
});
}
TEST_CASE("VECTOR_SHL_I16_CONSTANT", "[instr]") {
@ -80,15 +81,16 @@ TEST_CASE("VECTOR_SHL_I16_CONSTANT", "[instr]") {
INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0xFFFC, 0xFE00, 0x8000, 0x0000,
0xFF00, 0x0002, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0xFFFC, 0xFE00, 0x8000, 0x0000,
0xFF00, 0x0002, 0x1234));
});
}
TEST_CASE("VECTOR_SHL_I32", "[instr]") {
@ -96,26 +98,26 @@ TEST_CASE("VECTOR_SHL_I32", "[instr]") {
StoreVR(b, 3, b.VectorShl(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0xFFFFFFFC, 0xFFFE0000, 0x80000000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000000, 0xFFFF0000, 0x00000002, 0x12345678));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0xFFFFFFFC, 0xFFFE0000, 0x80000000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000000, 0xFFFF0000, 0x00000002, 0x12345678));
});
}
TEST_CASE("VECTOR_SHL_I32_CONSTANT", "[instr]") {

View File

@ -20,19 +20,19 @@ TEST_CASE("VECTOR_SHR_I8", "[instr]") {
StoreVR(b, 3, b.VectorShr(LoadVR(b, 4), LoadVR(b, 5), INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0x08, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
ctx->v[5] =
vec128b(0, 1, 2, 8, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0x08, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHR_I8_CONSTANT", "[instr]") {
@ -43,17 +43,17 @@ TEST_CASE("VECTOR_SHR_I8_CONSTANT", "[instr]") {
INT8_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0x08, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128b(0x7E, 0x7E, 0x7E, 0x7F, 0x80, 0xFF, 0x01, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128b(0x7E, 0x3F, 0x1F, 0x7F, 0x08, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00));
});
}
TEST_CASE("VECTOR_SHR_I16", "[instr]") {
@ -61,16 +61,17 @@ TEST_CASE("VECTOR_SHR_I16", "[instr]") {
StoreVR(b, 3, b.VectorShr(LoadVR(b, 4), LoadVR(b, 5), INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0x0001,
0x00FF, 0x0000, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
ctx->v[5] = vec128s(0, 1, 8, 15, 15, 8, 1, 16);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0x0001,
0x00FF, 0x0000, 0x1234));
});
}
TEST_CASE("VECTOR_SHR_I16_CONSTANT", "[instr]") {
@ -80,15 +81,16 @@ TEST_CASE("VECTOR_SHR_I16_CONSTANT", "[instr]") {
INT16_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0x0001,
0x00FF, 0x0000, 0x1234));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128s(0x7FFE, 0x7FFE, 0x7FFE, 0x7FFF, 0x8000, 0xFFFF,
0x0001, 0x1234);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result == vec128s(0x7FFE, 0x3FFF, 0x007F, 0x0000, 0x0001,
0x00FF, 0x0000, 0x1234));
});
}
TEST_CASE("VECTOR_SHR_I32", "[instr]") {
@ -96,26 +98,26 @@ TEST_CASE("VECTOR_SHR_I32", "[instr]") {
StoreVR(b, 3, b.VectorShr(LoadVR(b, 4), LoadVR(b, 5), INT32_TYPE));
b.Return();
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0x3FFFFFFF, 0x00007FFF, 0x00000000));
});
test.Run([](PPCContext* ctx) {
ctx->v[4] =
vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000001, 0x0000FFFF, 0x00000000, 0x12345678));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFE, 0x7FFFFFFF);
ctx->v[5] = vec128i(0, 1, 16, 31);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x7FFFFFFE, 0x3FFFFFFF, 0x00007FFF, 0x00000000));
});
test.Run(
[](PPCContext* ctx) {
ctx->v[4] = vec128i(0x80000000, 0xFFFFFFFF, 0x00000001, 0x12345678);
ctx->v[5] = vec128i(31, 16, 1, 32);
},
[](PPCContext* ctx) {
auto result = ctx->v[3];
REQUIRE(result ==
vec128i(0x00000001, 0x0000FFFF, 0x00000000, 0x12345678));
});
}
TEST_CASE("VECTOR_SHR_I32_CONSTANT", "[instr]") {

View File

@ -18,7 +18,9 @@
namespace xe {
// KernelState forward decl.
namespace kernel { class KernelState; }
namespace kernel {
class KernelState;
}
namespace cpu {

View File

@ -328,26 +328,27 @@ void Debugger::OnMessage(std::vector<uint8_t> buffer) {
request_data->function_index_start() + 1;
std::vector<flatbuffers::Offset<proto::FunctionEntry>> function_list;
function_list.reserve(max_function_count);
processor_module->ForEachSymbol(request_data->function_index_start(),
request_data->function_index_end(),
[&](xe::cpu::SymbolInfo* symbol_info) {
if (symbol_info->type() != xe::cpu::SymbolType::kFunction) {
return;
}
auto function_info =
reinterpret_cast<xe::cpu::FunctionInfo*>(symbol_info);
flatbuffers::Offset<flatbuffers::String> name_offset;
if (!function_info->name().empty()) {
name_offset = fbb.CreateString(function_info->name());
}
auto function_entry = proto::FunctionEntryBuilder(fbb);
function_entry.add_identifier(
reinterpret_cast<uintptr_t>(function_info));
function_entry.add_address_start(function_info->address());
function_entry.add_address_end(function_info->end_address());
function_entry.add_name(name_offset);
function_list.push_back(function_entry.Finish());
});
processor_module->ForEachSymbol(
request_data->function_index_start(),
request_data->function_index_end(),
[&](xe::cpu::SymbolInfo* symbol_info) {
if (symbol_info->type() != xe::cpu::SymbolType::kFunction) {
return;
}
auto function_info =
reinterpret_cast<xe::cpu::FunctionInfo*>(symbol_info);
flatbuffers::Offset<flatbuffers::String> name_offset;
if (!function_info->name().empty()) {
name_offset = fbb.CreateString(function_info->name());
}
auto function_entry = proto::FunctionEntryBuilder(fbb);
function_entry.add_identifier(
reinterpret_cast<uintptr_t>(function_info));
function_entry.add_address_start(function_info->address());
function_entry.add_address_end(function_info->end_address());
function_entry.add_name(name_offset);
function_list.push_back(function_entry.Finish());
});
auto function_list_data = fbb.CreateVector(function_list);
response_data_type = proto::ResponseData_ListFunctionsResponse;
auto response_data = proto::ListFunctionsResponseBuilder(fbb);

View File

@ -33,216 +33,292 @@ MANUALLY_ALIGNED_STRUCT(4) Breakpoint FLATBUFFERS_FINAL_CLASS {
public:
Breakpoint(uint32_t breakpoint_id)
: breakpoint_id_(flatbuffers::EndianScalar(breakpoint_id)) { }
: breakpoint_id_(flatbuffers::EndianScalar(breakpoint_id)) {}
uint32_t breakpoint_id() const { return flatbuffers::EndianScalar(breakpoint_id_); }
uint32_t breakpoint_id() const {
return flatbuffers::EndianScalar(breakpoint_id_);
}
};
STRUCT_END(Breakpoint, 4);
struct ListBreakpointsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct ListBreakpointsRequest FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct ListBreakpointsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
ListBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListBreakpointsRequestBuilder &operator=(const ListBreakpointsRequestBuilder &);
ListBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListBreakpointsRequestBuilder &operator=(
const ListBreakpointsRequestBuilder &);
flatbuffers::Offset<ListBreakpointsRequest> Finish() {
auto o = flatbuffers::Offset<ListBreakpointsRequest>(fbb_.EndTable(start_, 0));
auto o =
flatbuffers::Offset<ListBreakpointsRequest>(fbb_.EndTable(start_, 0));
return o;
}
};
inline flatbuffers::Offset<ListBreakpointsRequest> CreateListBreakpointsRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<ListBreakpointsRequest> CreateListBreakpointsRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
ListBreakpointsRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct ListBreakpointsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const { return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4); }
struct ListBreakpointsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const {
return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* breakpoints */) &&
verifier.Verify(breakpoints()) &&
verifier.EndTable();
verifier.Verify(breakpoints()) && verifier.EndTable();
}
};
struct ListBreakpointsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_breakpoints(flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints) { fbb_.AddOffset(4, breakpoints); }
ListBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListBreakpointsResponseBuilder &operator=(const ListBreakpointsResponseBuilder &);
void add_breakpoints(flatbuffers::Offset<
flatbuffers::Vector<const Breakpoint *>> breakpoints) {
fbb_.AddOffset(4, breakpoints);
}
ListBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListBreakpointsResponseBuilder &operator=(
const ListBreakpointsResponseBuilder &);
flatbuffers::Offset<ListBreakpointsResponse> Finish() {
auto o = flatbuffers::Offset<ListBreakpointsResponse>(fbb_.EndTable(start_, 1));
auto o =
flatbuffers::Offset<ListBreakpointsResponse>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<ListBreakpointsResponse> CreateListBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints = 0) {
inline flatbuffers::Offset<ListBreakpointsResponse>
CreateListBreakpointsResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints =
0) {
ListBreakpointsResponseBuilder builder_(_fbb);
builder_.add_breakpoints(breakpoints);
return builder_.Finish();
}
struct AddBreakpointsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const { return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4); }
struct AddBreakpointsRequest FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const {
return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* breakpoints */) &&
verifier.Verify(breakpoints()) &&
verifier.EndTable();
verifier.Verify(breakpoints()) && verifier.EndTable();
}
};
struct AddBreakpointsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_breakpoints(flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints) { fbb_.AddOffset(4, breakpoints); }
AddBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_breakpoints(flatbuffers::Offset<
flatbuffers::Vector<const Breakpoint *>> breakpoints) {
fbb_.AddOffset(4, breakpoints);
}
AddBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
AddBreakpointsRequestBuilder &operator=(const AddBreakpointsRequestBuilder &);
flatbuffers::Offset<AddBreakpointsRequest> Finish() {
auto o = flatbuffers::Offset<AddBreakpointsRequest>(fbb_.EndTable(start_, 1));
auto o =
flatbuffers::Offset<AddBreakpointsRequest>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<AddBreakpointsRequest> CreateAddBreakpointsRequest(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints = 0) {
inline flatbuffers::Offset<AddBreakpointsRequest> CreateAddBreakpointsRequest(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints =
0) {
AddBreakpointsRequestBuilder builder_(_fbb);
builder_.add_breakpoints(breakpoints);
return builder_.Finish();
}
struct AddBreakpointsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct AddBreakpointsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct AddBreakpointsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
AddBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
AddBreakpointsResponseBuilder &operator=(const AddBreakpointsResponseBuilder &);
AddBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
AddBreakpointsResponseBuilder &operator=(
const AddBreakpointsResponseBuilder &);
flatbuffers::Offset<AddBreakpointsResponse> Finish() {
auto o = flatbuffers::Offset<AddBreakpointsResponse>(fbb_.EndTable(start_, 0));
auto o =
flatbuffers::Offset<AddBreakpointsResponse>(fbb_.EndTable(start_, 0));
return o;
}
};
inline flatbuffers::Offset<AddBreakpointsResponse> CreateAddBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<AddBreakpointsResponse> CreateAddBreakpointsResponse(
flatbuffers::FlatBufferBuilder &_fbb) {
AddBreakpointsResponseBuilder builder_(_fbb);
return builder_.Finish();
}
struct UpdateBreakpointsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const { return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4); }
struct UpdateBreakpointsRequest FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const {
return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* breakpoints */) &&
verifier.Verify(breakpoints()) &&
verifier.EndTable();
verifier.Verify(breakpoints()) && verifier.EndTable();
}
};
struct UpdateBreakpointsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_breakpoints(flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints) { fbb_.AddOffset(4, breakpoints); }
UpdateBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
UpdateBreakpointsRequestBuilder &operator=(const UpdateBreakpointsRequestBuilder &);
void add_breakpoints(flatbuffers::Offset<
flatbuffers::Vector<const Breakpoint *>> breakpoints) {
fbb_.AddOffset(4, breakpoints);
}
UpdateBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
UpdateBreakpointsRequestBuilder &operator=(
const UpdateBreakpointsRequestBuilder &);
flatbuffers::Offset<UpdateBreakpointsRequest> Finish() {
auto o = flatbuffers::Offset<UpdateBreakpointsRequest>(fbb_.EndTable(start_, 1));
auto o =
flatbuffers::Offset<UpdateBreakpointsRequest>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<UpdateBreakpointsRequest> CreateUpdateBreakpointsRequest(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints = 0) {
inline flatbuffers::Offset<UpdateBreakpointsRequest>
CreateUpdateBreakpointsRequest(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints =
0) {
UpdateBreakpointsRequestBuilder builder_(_fbb);
builder_.add_breakpoints(breakpoints);
return builder_.Finish();
}
struct UpdateBreakpointsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct UpdateBreakpointsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct UpdateBreakpointsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
UpdateBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
UpdateBreakpointsResponseBuilder &operator=(const UpdateBreakpointsResponseBuilder &);
UpdateBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
UpdateBreakpointsResponseBuilder &operator=(
const UpdateBreakpointsResponseBuilder &);
flatbuffers::Offset<UpdateBreakpointsResponse> Finish() {
auto o = flatbuffers::Offset<UpdateBreakpointsResponse>(fbb_.EndTable(start_, 0));
auto o = flatbuffers::Offset<UpdateBreakpointsResponse>(
fbb_.EndTable(start_, 0));
return o;
}
};
inline flatbuffers::Offset<UpdateBreakpointsResponse> CreateUpdateBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<UpdateBreakpointsResponse>
CreateUpdateBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb) {
UpdateBreakpointsResponseBuilder builder_(_fbb);
return builder_.Finish();
}
struct RemoveBreakpointsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const { return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4); }
struct RemoveBreakpointsRequest FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<const Breakpoint *> *breakpoints() const {
return GetPointer<const flatbuffers::Vector<const Breakpoint *> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* breakpoints */) &&
verifier.Verify(breakpoints()) &&
verifier.EndTable();
verifier.Verify(breakpoints()) && verifier.EndTable();
}
};
struct RemoveBreakpointsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_breakpoints(flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints) { fbb_.AddOffset(4, breakpoints); }
RemoveBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
RemoveBreakpointsRequestBuilder &operator=(const RemoveBreakpointsRequestBuilder &);
void add_breakpoints(flatbuffers::Offset<
flatbuffers::Vector<const Breakpoint *>> breakpoints) {
fbb_.AddOffset(4, breakpoints);
}
RemoveBreakpointsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
RemoveBreakpointsRequestBuilder &operator=(
const RemoveBreakpointsRequestBuilder &);
flatbuffers::Offset<RemoveBreakpointsRequest> Finish() {
auto o = flatbuffers::Offset<RemoveBreakpointsRequest>(fbb_.EndTable(start_, 1));
auto o =
flatbuffers::Offset<RemoveBreakpointsRequest>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<RemoveBreakpointsRequest> CreateRemoveBreakpointsRequest(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints = 0) {
inline flatbuffers::Offset<RemoveBreakpointsRequest>
CreateRemoveBreakpointsRequest(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const Breakpoint *>> breakpoints =
0) {
RemoveBreakpointsRequestBuilder builder_(_fbb);
builder_.add_breakpoints(breakpoints);
return builder_.Finish();
}
struct RemoveBreakpointsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct RemoveBreakpointsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct RemoveBreakpointsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
RemoveBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
RemoveBreakpointsResponseBuilder &operator=(const RemoveBreakpointsResponseBuilder &);
RemoveBreakpointsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
RemoveBreakpointsResponseBuilder &operator=(
const RemoveBreakpointsResponseBuilder &);
flatbuffers::Offset<RemoveBreakpointsResponse> Finish() {
auto o = flatbuffers::Offset<RemoveBreakpointsResponse>(fbb_.EndTable(start_, 0));
auto o = flatbuffers::Offset<RemoveBreakpointsResponse>(
fbb_.EndTable(start_, 0));
return o;
}
};
inline flatbuffers::Offset<RemoveBreakpointsResponse> CreateRemoveBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<RemoveBreakpointsResponse>
CreateRemoveBreakpointsResponse(flatbuffers::FlatBufferBuilder &_fbb) {
RemoveBreakpointsResponseBuilder builder_(_fbb);
return builder_.Finish();
}

View File

@ -5,7 +5,6 @@
#include "flatbuffers/flatbuffers.h"
namespace xe {
namespace debug {
namespace proto {
@ -17,8 +16,7 @@ MANUALLY_ALIGNED_STRUCT(4) XObject FLATBUFFERS_FINAL_CLASS {
uint32_t handle_;
public:
XObject(uint32_t handle)
: handle_(flatbuffers::EndianScalar(handle)) { }
XObject(uint32_t handle) : handle_(flatbuffers::EndianScalar(handle)) {}
uint32_t handle() const { return flatbuffers::EndianScalar(handle_); }
};

View File

@ -34,11 +34,13 @@ enum ContinueAction {
};
inline const char **EnumNamesContinueAction() {
static const char *names[] = { "Continue", "ContinueTo", nullptr };
static const char *names[] = {"Continue", "ContinueTo", nullptr};
return names;
}
inline const char *EnumNameContinueAction(ContinueAction e) { return EnumNamesContinueAction()[e]; }
inline const char *EnumNameContinueAction(ContinueAction e) {
return EnumNamesContinueAction()[e];
}
enum StepAction {
StepAction_StepIn = 0,
@ -47,23 +49,26 @@ enum StepAction {
};
inline const char **EnumNamesStepAction() {
static const char *names[] = { "StepIn", "StepOver", "StepOut", nullptr };
static const char *names[] = {"StepIn", "StepOver", "StepOut", nullptr};
return names;
}
inline const char *EnumNameStepAction(StepAction e) { return EnumNamesStepAction()[e]; }
inline const char *EnumNameStepAction(StepAction e) {
return EnumNamesStepAction()[e];
}
struct StopRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct StopRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
StopRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
StopRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
StopRequestBuilder &operator=(const StopRequestBuilder &);
flatbuffers::Offset<StopRequest> Finish() {
auto o = flatbuffers::Offset<StopRequest>(fbb_.EndTable(start_, 0));
@ -71,22 +76,24 @@ struct StopRequestBuilder {
}
};
inline flatbuffers::Offset<StopRequest> CreateStopRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<StopRequest> CreateStopRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
StopRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct StopResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct StopResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
StopResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
StopResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
StopResponseBuilder &operator=(const StopResponseBuilder &);
flatbuffers::Offset<StopResponse> Finish() {
auto o = flatbuffers::Offset<StopResponse>(fbb_.EndTable(start_, 0));
@ -94,22 +101,24 @@ struct StopResponseBuilder {
}
};
inline flatbuffers::Offset<StopResponse> CreateStopResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<StopResponse> CreateStopResponse(
flatbuffers::FlatBufferBuilder &_fbb) {
StopResponseBuilder builder_(_fbb);
return builder_.Finish();
}
struct BreakRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct BreakRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
BreakRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
BreakRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
BreakRequestBuilder &operator=(const BreakRequestBuilder &);
flatbuffers::Offset<BreakRequest> Finish() {
auto o = flatbuffers::Offset<BreakRequest>(fbb_.EndTable(start_, 0));
@ -117,22 +126,24 @@ struct BreakRequestBuilder {
}
};
inline flatbuffers::Offset<BreakRequest> CreateBreakRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<BreakRequest> CreateBreakRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
BreakRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct BreakResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct BreakResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
BreakResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
BreakResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
BreakResponseBuilder &operator=(const BreakResponseBuilder &);
flatbuffers::Offset<BreakResponse> Finish() {
auto o = flatbuffers::Offset<BreakResponse>(fbb_.EndTable(start_, 0));
@ -140,13 +151,16 @@ struct BreakResponseBuilder {
}
};
inline flatbuffers::Offset<BreakResponse> CreateBreakResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<BreakResponse> CreateBreakResponse(
flatbuffers::FlatBufferBuilder &_fbb) {
BreakResponseBuilder builder_(_fbb);
return builder_.Finish();
}
struct ContinueRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
ContinueAction action() const { return static_cast<ContinueAction>(GetField<int8_t>(4, 0)); }
ContinueAction action() const {
return static_cast<ContinueAction>(GetField<int8_t>(4, 0));
}
uint32_t target_address() const { return GetField<uint32_t>(6, 0); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
@ -159,9 +173,15 @@ struct ContinueRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct ContinueRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_action(ContinueAction action) { fbb_.AddElement<int8_t>(4, static_cast<int8_t>(action), 0); }
void add_target_address(uint32_t target_address) { fbb_.AddElement<uint32_t>(6, target_address, 0); }
ContinueRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_action(ContinueAction action) {
fbb_.AddElement<int8_t>(4, static_cast<int8_t>(action), 0);
}
void add_target_address(uint32_t target_address) {
fbb_.AddElement<uint32_t>(6, target_address, 0);
}
ContinueRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ContinueRequestBuilder &operator=(const ContinueRequestBuilder &);
flatbuffers::Offset<ContinueRequest> Finish() {
auto o = flatbuffers::Offset<ContinueRequest>(fbb_.EndTable(start_, 2));
@ -169,9 +189,10 @@ struct ContinueRequestBuilder {
}
};
inline flatbuffers::Offset<ContinueRequest> CreateContinueRequest(flatbuffers::FlatBufferBuilder &_fbb,
ContinueAction action = ContinueAction_Continue,
uint32_t target_address = 0) {
inline flatbuffers::Offset<ContinueRequest> CreateContinueRequest(
flatbuffers::FlatBufferBuilder &_fbb,
ContinueAction action = ContinueAction_Continue,
uint32_t target_address = 0) {
ContinueRequestBuilder builder_(_fbb);
builder_.add_target_address(target_address);
builder_.add_action(action);
@ -180,15 +201,16 @@ inline flatbuffers::Offset<ContinueRequest> CreateContinueRequest(flatbuffers::F
struct ContinueResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct ContinueResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
ContinueResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ContinueResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ContinueResponseBuilder &operator=(const ContinueResponseBuilder &);
flatbuffers::Offset<ContinueResponse> Finish() {
auto o = flatbuffers::Offset<ContinueResponse>(fbb_.EndTable(start_, 0));
@ -196,13 +218,16 @@ struct ContinueResponseBuilder {
}
};
inline flatbuffers::Offset<ContinueResponse> CreateContinueResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<ContinueResponse> CreateContinueResponse(
flatbuffers::FlatBufferBuilder &_fbb) {
ContinueResponseBuilder builder_(_fbb);
return builder_.Finish();
}
struct StepRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
StepAction action() const { return static_cast<StepAction>(GetField<int8_t>(4, 0)); }
StepAction action() const {
return static_cast<StepAction>(GetField<int8_t>(4, 0));
}
uint32_t thread_id() const { return GetField<uint32_t>(6, 0); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
@ -215,9 +240,15 @@ struct StepRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct StepRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_action(StepAction action) { fbb_.AddElement<int8_t>(4, static_cast<int8_t>(action), 0); }
void add_thread_id(uint32_t thread_id) { fbb_.AddElement<uint32_t>(6, thread_id, 0); }
StepRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_action(StepAction action) {
fbb_.AddElement<int8_t>(4, static_cast<int8_t>(action), 0);
}
void add_thread_id(uint32_t thread_id) {
fbb_.AddElement<uint32_t>(6, thread_id, 0);
}
StepRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
StepRequestBuilder &operator=(const StepRequestBuilder &);
flatbuffers::Offset<StepRequest> Finish() {
auto o = flatbuffers::Offset<StepRequest>(fbb_.EndTable(start_, 2));
@ -225,9 +256,9 @@ struct StepRequestBuilder {
}
};
inline flatbuffers::Offset<StepRequest> CreateStepRequest(flatbuffers::FlatBufferBuilder &_fbb,
StepAction action = StepAction_StepIn,
uint32_t thread_id = 0) {
inline flatbuffers::Offset<StepRequest> CreateStepRequest(
flatbuffers::FlatBufferBuilder &_fbb, StepAction action = StepAction_StepIn,
uint32_t thread_id = 0) {
StepRequestBuilder builder_(_fbb);
builder_.add_thread_id(thread_id);
builder_.add_action(action);
@ -236,15 +267,16 @@ inline flatbuffers::Offset<StepRequest> CreateStepRequest(flatbuffers::FlatBuffe
struct StepResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct StepResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
StepResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
StepResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
StepResponseBuilder &operator=(const StepResponseBuilder &);
flatbuffers::Offset<StepResponse> Finish() {
auto o = flatbuffers::Offset<StepResponse>(fbb_.EndTable(start_, 0));
@ -252,7 +284,8 @@ struct StepResponseBuilder {
}
};
inline flatbuffers::Offset<StepResponse> CreateStepResponse(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<StepResponse> CreateStepResponse(
flatbuffers::FlatBufferBuilder &_fbb) {
StepResponseBuilder builder_(_fbb);
return builder_.Finish();
}
@ -271,9 +304,15 @@ struct BreakpointEvent FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct BreakpointEventBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_thread_id(uint32_t thread_id) { fbb_.AddElement<uint32_t>(4, thread_id, 0); }
void add_breakpoint_id(uint32_t breakpoint_id) { fbb_.AddElement<uint32_t>(6, breakpoint_id, 0); }
BreakpointEventBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_thread_id(uint32_t thread_id) {
fbb_.AddElement<uint32_t>(4, thread_id, 0);
}
void add_breakpoint_id(uint32_t breakpoint_id) {
fbb_.AddElement<uint32_t>(6, breakpoint_id, 0);
}
BreakpointEventBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
BreakpointEventBuilder &operator=(const BreakpointEventBuilder &);
flatbuffers::Offset<BreakpointEvent> Finish() {
auto o = flatbuffers::Offset<BreakpointEvent>(fbb_.EndTable(start_, 2));
@ -281,16 +320,17 @@ struct BreakpointEventBuilder {
}
};
inline flatbuffers::Offset<BreakpointEvent> CreateBreakpointEvent(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t thread_id = 0,
uint32_t breakpoint_id = 0) {
inline flatbuffers::Offset<BreakpointEvent> CreateBreakpointEvent(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t thread_id = 0,
uint32_t breakpoint_id = 0) {
BreakpointEventBuilder builder_(_fbb);
builder_.add_breakpoint_id(breakpoint_id);
builder_.add_thread_id(thread_id);
return builder_.Finish();
}
struct AccessViolationEvent FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct AccessViolationEvent FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
uint32_t thread_id() const { return GetField<uint32_t>(4, 0); }
uint32_t target_address() const { return GetField<uint32_t>(6, 0); }
bool Verify(flatbuffers::Verifier &verifier) const {
@ -304,19 +344,27 @@ struct AccessViolationEvent FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
struct AccessViolationEventBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_thread_id(uint32_t thread_id) { fbb_.AddElement<uint32_t>(4, thread_id, 0); }
void add_target_address(uint32_t target_address) { fbb_.AddElement<uint32_t>(6, target_address, 0); }
AccessViolationEventBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_thread_id(uint32_t thread_id) {
fbb_.AddElement<uint32_t>(4, thread_id, 0);
}
void add_target_address(uint32_t target_address) {
fbb_.AddElement<uint32_t>(6, target_address, 0);
}
AccessViolationEventBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
AccessViolationEventBuilder &operator=(const AccessViolationEventBuilder &);
flatbuffers::Offset<AccessViolationEvent> Finish() {
auto o = flatbuffers::Offset<AccessViolationEvent>(fbb_.EndTable(start_, 2));
auto o =
flatbuffers::Offset<AccessViolationEvent>(fbb_.EndTable(start_, 2));
return o;
}
};
inline flatbuffers::Offset<AccessViolationEvent> CreateAccessViolationEvent(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t thread_id = 0,
uint32_t target_address = 0) {
inline flatbuffers::Offset<AccessViolationEvent> CreateAccessViolationEvent(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t thread_id = 0,
uint32_t target_address = 0) {
AccessViolationEventBuilder builder_(_fbb);
builder_.add_target_address(target_address);
builder_.add_thread_id(thread_id);

View File

@ -100,20 +100,20 @@ enum RequestData {
inline const char **EnumNamesRequestData() {
static const char *names[] = {
"NONE", "AttachRequest",
"ListBreakpointsRequest", "AddBreakpointsRequest",
"UpdateBreakpointsRequest", "RemoveBreakpointsRequest",
"ListModulesRequest", "GetModuleRequest",
"ListFunctionsRequest", "GetFunctionRequest",
"ListThreadsRequest", "StopRequest",
"BreakRequest", "ContinueRequest",
"StepRequest", nullptr};
"NONE", "AttachRequest", "ListBreakpointsRequest",
"AddBreakpointsRequest", "UpdateBreakpointsRequest",
"RemoveBreakpointsRequest", "ListModulesRequest", "GetModuleRequest",
"ListFunctionsRequest", "GetFunctionRequest", "ListThreadsRequest",
"StopRequest", "BreakRequest", "ContinueRequest", "StepRequest", nullptr};
return names;
}
inline const char *EnumNameRequestData(RequestData e) { return EnumNamesRequestData()[e]; }
inline const char *EnumNameRequestData(RequestData e) {
return EnumNamesRequestData()[e];
}
inline bool VerifyRequestData(flatbuffers::Verifier &verifier, const void *union_obj, RequestData type);
inline bool VerifyRequestData(flatbuffers::Verifier &verifier,
const void *union_obj, RequestData type);
enum ResponseData {
ResponseData_NONE = 0,
@ -137,33 +137,34 @@ enum ResponseData {
inline const char **EnumNamesResponseData() {
static const char *names[] = {
"NONE", "AttachResponse",
"ListBreakpointsResponse", "AddBreakpointsResponse",
"UpdateBreakpointsResponse", "RemoveBreakpointsResponse",
"ListModulesResponse", "GetModuleResponse",
"ListFunctionsResponse", "GetFunctionResponse",
"ListThreadsResponse", "StopResponse",
"BreakResponse", "ContinueResponse",
"StepResponse", "BreakpointEvent",
"AccessViolationEvent", nullptr};
"NONE", "AttachResponse", "ListBreakpointsResponse",
"AddBreakpointsResponse", "UpdateBreakpointsResponse",
"RemoveBreakpointsResponse", "ListModulesResponse", "GetModuleResponse",
"ListFunctionsResponse", "GetFunctionResponse", "ListThreadsResponse",
"StopResponse", "BreakResponse", "ContinueResponse", "StepResponse",
"BreakpointEvent", "AccessViolationEvent", nullptr};
return names;
}
inline const char *EnumNameResponseData(ResponseData e) { return EnumNamesResponseData()[e]; }
inline const char *EnumNameResponseData(ResponseData e) {
return EnumNamesResponseData()[e];
}
inline bool VerifyResponseData(flatbuffers::Verifier &verifier, const void *union_obj, ResponseData type);
inline bool VerifyResponseData(flatbuffers::Verifier &verifier,
const void *union_obj, ResponseData type);
struct AttachRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct AttachRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
AttachRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
AttachRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
AttachRequestBuilder &operator=(const AttachRequestBuilder &);
flatbuffers::Offset<AttachRequest> Finish() {
auto o = flatbuffers::Offset<AttachRequest>(fbb_.EndTable(start_, 0));
@ -171,44 +172,72 @@ struct AttachRequestBuilder {
}
};
inline flatbuffers::Offset<AttachRequest> CreateAttachRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<AttachRequest> CreateAttachRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
AttachRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct AttachResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::String *memory_file() const { return GetPointer<const flatbuffers::String *>(4); }
const flatbuffers::String *code_cache_file() const { return GetPointer<const flatbuffers::String *>(6); }
const flatbuffers::String *memory_file() const {
return GetPointer<const flatbuffers::String *>(4);
}
const flatbuffers::String *code_cache_file() const {
return GetPointer<const flatbuffers::String *>(6);
}
uint32_t code_cache_base() const { return GetField<uint32_t>(8, 0); }
uint32_t code_cache_size() const { return GetField<uint32_t>(10, 0); }
const flatbuffers::String *functions_file() const { return GetPointer<const flatbuffers::String *>(12); }
const flatbuffers::String *functions_trace_file() const { return GetPointer<const flatbuffers::String *>(14); }
const flatbuffers::String *functions_file() const {
return GetPointer<const flatbuffers::String *>(12);
}
const flatbuffers::String *functions_trace_file() const {
return GetPointer<const flatbuffers::String *>(14);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* memory_file */) &&
verifier.Verify(memory_file()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* code_cache_file */) &&
VerifyField<flatbuffers::uoffset_t>(verifier,
6 /* code_cache_file */) &&
verifier.Verify(code_cache_file()) &&
VerifyField<uint32_t>(verifier, 8 /* code_cache_base */) &&
VerifyField<uint32_t>(verifier, 10 /* code_cache_size */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* functions_file */) &&
VerifyField<flatbuffers::uoffset_t>(verifier,
12 /* functions_file */) &&
verifier.Verify(functions_file()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* functions_trace_file */) &&
verifier.Verify(functions_trace_file()) &&
verifier.EndTable();
VerifyField<flatbuffers::uoffset_t>(verifier,
14 /* functions_trace_file */) &&
verifier.Verify(functions_trace_file()) && verifier.EndTable();
}
};
struct AttachResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_memory_file(flatbuffers::Offset<flatbuffers::String> memory_file) { fbb_.AddOffset(4, memory_file); }
void add_code_cache_file(flatbuffers::Offset<flatbuffers::String> code_cache_file) { fbb_.AddOffset(6, code_cache_file); }
void add_code_cache_base(uint32_t code_cache_base) { fbb_.AddElement<uint32_t>(8, code_cache_base, 0); }
void add_code_cache_size(uint32_t code_cache_size) { fbb_.AddElement<uint32_t>(10, code_cache_size, 0); }
void add_functions_file(flatbuffers::Offset<flatbuffers::String> functions_file) { fbb_.AddOffset(12, functions_file); }
void add_functions_trace_file(flatbuffers::Offset<flatbuffers::String> functions_trace_file) { fbb_.AddOffset(14, functions_trace_file); }
AttachResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_memory_file(flatbuffers::Offset<flatbuffers::String> memory_file) {
fbb_.AddOffset(4, memory_file);
}
void add_code_cache_file(
flatbuffers::Offset<flatbuffers::String> code_cache_file) {
fbb_.AddOffset(6, code_cache_file);
}
void add_code_cache_base(uint32_t code_cache_base) {
fbb_.AddElement<uint32_t>(8, code_cache_base, 0);
}
void add_code_cache_size(uint32_t code_cache_size) {
fbb_.AddElement<uint32_t>(10, code_cache_size, 0);
}
void add_functions_file(
flatbuffers::Offset<flatbuffers::String> functions_file) {
fbb_.AddOffset(12, functions_file);
}
void add_functions_trace_file(
flatbuffers::Offset<flatbuffers::String> functions_trace_file) {
fbb_.AddOffset(14, functions_trace_file);
}
AttachResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
AttachResponseBuilder &operator=(const AttachResponseBuilder &);
flatbuffers::Offset<AttachResponse> Finish() {
auto o = flatbuffers::Offset<AttachResponse>(fbb_.EndTable(start_, 6));
@ -216,13 +245,13 @@ struct AttachResponseBuilder {
}
};
inline flatbuffers::Offset<AttachResponse> CreateAttachResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> memory_file = 0,
flatbuffers::Offset<flatbuffers::String> code_cache_file = 0,
uint32_t code_cache_base = 0,
uint32_t code_cache_size = 0,
flatbuffers::Offset<flatbuffers::String> functions_file = 0,
flatbuffers::Offset<flatbuffers::String> functions_trace_file = 0) {
inline flatbuffers::Offset<AttachResponse> CreateAttachResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> memory_file = 0,
flatbuffers::Offset<flatbuffers::String> code_cache_file = 0,
uint32_t code_cache_base = 0, uint32_t code_cache_size = 0,
flatbuffers::Offset<flatbuffers::String> functions_file = 0,
flatbuffers::Offset<flatbuffers::String> functions_trace_file = 0) {
AttachResponseBuilder builder_(_fbb);
builder_.add_functions_trace_file(functions_trace_file);
builder_.add_functions_file(functions_file);
@ -235,13 +264,16 @@ inline flatbuffers::Offset<AttachResponse> CreateAttachResponse(flatbuffers::Fla
struct Request FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint32_t id() const { return GetField<uint32_t>(4, 0); }
RequestData request_data_type() const { return static_cast<RequestData>(GetField<uint8_t>(6, 0)); }
RequestData request_data_type() const {
return static_cast<RequestData>(GetField<uint8_t>(6, 0));
}
const void *request_data() const { return GetPointer<const void *>(8); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint32_t>(verifier, 4 /* id */) &&
VerifyField<uint8_t>(verifier, 6 /* request_data_type */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* request_data */) &&
VerifyField<flatbuffers::uoffset_t>(verifier,
8 /* request_data */) &&
VerifyRequestData(verifier, request_data(), request_data_type()) &&
verifier.EndTable();
}
@ -251,9 +283,15 @@ struct RequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_id(uint32_t id) { fbb_.AddElement<uint32_t>(4, id, 0); }
void add_request_data_type(RequestData request_data_type) { fbb_.AddElement<uint8_t>(6, static_cast<uint8_t>(request_data_type), 0); }
void add_request_data(flatbuffers::Offset<void> request_data) { fbb_.AddOffset(8, request_data); }
RequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_request_data_type(RequestData request_data_type) {
fbb_.AddElement<uint8_t>(6, static_cast<uint8_t>(request_data_type), 0);
}
void add_request_data(flatbuffers::Offset<void> request_data) {
fbb_.AddOffset(8, request_data);
}
RequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
RequestBuilder &operator=(const RequestBuilder &);
flatbuffers::Offset<Request> Finish() {
auto o = flatbuffers::Offset<Request>(fbb_.EndTable(start_, 3));
@ -261,10 +299,10 @@ struct RequestBuilder {
}
};
inline flatbuffers::Offset<Request> CreateRequest(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t id = 0,
RequestData request_data_type = RequestData_NONE,
flatbuffers::Offset<void> request_data = 0) {
inline flatbuffers::Offset<Request> CreateRequest(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t id = 0,
RequestData request_data_type = RequestData_NONE,
flatbuffers::Offset<void> request_data = 0) {
RequestBuilder builder_(_fbb);
builder_.add_request_data(request_data);
builder_.add_id(id);
@ -274,14 +312,18 @@ inline flatbuffers::Offset<Request> CreateRequest(flatbuffers::FlatBufferBuilder
struct Response FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint32_t id() const { return GetField<uint32_t>(4, 0); }
ResponseData response_data_type() const { return static_cast<ResponseData>(GetField<uint8_t>(6, 0)); }
ResponseData response_data_type() const {
return static_cast<ResponseData>(GetField<uint8_t>(6, 0));
}
const void *response_data() const { return GetPointer<const void *>(8); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint32_t>(verifier, 4 /* id */) &&
VerifyField<uint8_t>(verifier, 6 /* response_data_type */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* response_data */) &&
VerifyResponseData(verifier, response_data(), response_data_type()) &&
VerifyField<flatbuffers::uoffset_t>(verifier,
8 /* response_data */) &&
VerifyResponseData(verifier, response_data(),
response_data_type()) &&
verifier.EndTable();
}
};
@ -290,9 +332,15 @@ struct ResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_id(uint32_t id) { fbb_.AddElement<uint32_t>(4, id, 0); }
void add_response_data_type(ResponseData response_data_type) { fbb_.AddElement<uint8_t>(6, static_cast<uint8_t>(response_data_type), 0); }
void add_response_data(flatbuffers::Offset<void> response_data) { fbb_.AddOffset(8, response_data); }
ResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_response_data_type(ResponseData response_data_type) {
fbb_.AddElement<uint8_t>(6, static_cast<uint8_t>(response_data_type), 0);
}
void add_response_data(flatbuffers::Offset<void> response_data) {
fbb_.AddOffset(8, response_data);
}
ResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ResponseBuilder &operator=(const ResponseBuilder &);
flatbuffers::Offset<Response> Finish() {
auto o = flatbuffers::Offset<Response>(fbb_.EndTable(start_, 3));
@ -300,10 +348,10 @@ struct ResponseBuilder {
}
};
inline flatbuffers::Offset<Response> CreateResponse(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t id = 0,
ResponseData response_data_type = ResponseData_NONE,
flatbuffers::Offset<void> response_data = 0) {
inline flatbuffers::Offset<Response> CreateResponse(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t id = 0,
ResponseData response_data_type = ResponseData_NONE,
flatbuffers::Offset<void> response_data = 0) {
ResponseBuilder builder_(_fbb);
builder_.add_response_data(response_data);
builder_.add_id(id);
@ -311,53 +359,135 @@ inline flatbuffers::Offset<Response> CreateResponse(flatbuffers::FlatBufferBuild
return builder_.Finish();
}
inline bool VerifyRequestData(flatbuffers::Verifier &verifier, const void *union_obj, RequestData type) {
inline bool VerifyRequestData(flatbuffers::Verifier &verifier,
const void *union_obj, RequestData type) {
switch (type) {
case RequestData_NONE: return true;
case RequestData_AttachRequest: return verifier.VerifyTable(reinterpret_cast<const AttachRequest *>(union_obj));
case RequestData_ListBreakpointsRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListBreakpointsRequest *>(union_obj));
case RequestData_AddBreakpointsRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::AddBreakpointsRequest *>(union_obj));
case RequestData_UpdateBreakpointsRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::UpdateBreakpointsRequest *>(union_obj));
case RequestData_RemoveBreakpointsRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::RemoveBreakpointsRequest *>(union_obj));
case RequestData_ListModulesRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListModulesRequest *>(union_obj));
case RequestData_GetModuleRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::GetModuleRequest *>(union_obj));
case RequestData_ListFunctionsRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListFunctionsRequest *>(union_obj));
case RequestData_GetFunctionRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::GetFunctionRequest *>(union_obj));
case RequestData_NONE:
return true;
case RequestData_AttachRequest:
return verifier.VerifyTable(
reinterpret_cast<const AttachRequest *>(union_obj));
case RequestData_ListBreakpointsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListBreakpointsRequest *>(
union_obj));
case RequestData_AddBreakpointsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::AddBreakpointsRequest *>(
union_obj));
case RequestData_UpdateBreakpointsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::UpdateBreakpointsRequest *>(
union_obj));
case RequestData_RemoveBreakpointsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::RemoveBreakpointsRequest *>(
union_obj));
case RequestData_ListModulesRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListModulesRequest *>(
union_obj));
case RequestData_GetModuleRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::GetModuleRequest *>(
union_obj));
case RequestData_ListFunctionsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListFunctionsRequest *>(
union_obj));
case RequestData_GetFunctionRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::GetFunctionRequest *>(
union_obj));
case RequestData_ListThreadsRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListThreadsRequest *>(
union_obj));
case RequestData_StopRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::StopRequest *>(union_obj));
case RequestData_BreakRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::BreakRequest *>(union_obj));
case RequestData_ContinueRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ContinueRequest *>(union_obj));
case RequestData_StepRequest: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::StepRequest *>(union_obj));
default: return false;
case RequestData_StopRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::StopRequest *>(union_obj));
case RequestData_BreakRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::BreakRequest *>(union_obj));
case RequestData_ContinueRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ContinueRequest *>(
union_obj));
case RequestData_StepRequest:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::StepRequest *>(union_obj));
default:
return false;
}
}
inline bool VerifyResponseData(flatbuffers::Verifier &verifier, const void *union_obj, ResponseData type) {
inline bool VerifyResponseData(flatbuffers::Verifier &verifier,
const void *union_obj, ResponseData type) {
switch (type) {
case ResponseData_NONE: return true;
case ResponseData_AttachResponse: return verifier.VerifyTable(reinterpret_cast<const AttachResponse *>(union_obj));
case ResponseData_ListBreakpointsResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListBreakpointsResponse *>(union_obj));
case ResponseData_AddBreakpointsResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::AddBreakpointsResponse *>(union_obj));
case ResponseData_UpdateBreakpointsResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::UpdateBreakpointsResponse *>(union_obj));
case ResponseData_RemoveBreakpointsResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::RemoveBreakpointsResponse *>(union_obj));
case ResponseData_ListModulesResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListModulesResponse *>(union_obj));
case ResponseData_GetModuleResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::GetModuleResponse *>(union_obj));
case ResponseData_ListFunctionsResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ListFunctionsResponse *>(union_obj));
case ResponseData_GetFunctionResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::GetFunctionResponse *>(union_obj));
case ResponseData_NONE:
return true;
case ResponseData_AttachResponse:
return verifier.VerifyTable(
reinterpret_cast<const AttachResponse *>(union_obj));
case ResponseData_ListBreakpointsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListBreakpointsResponse *>(
union_obj));
case ResponseData_AddBreakpointsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::AddBreakpointsResponse *>(
union_obj));
case ResponseData_UpdateBreakpointsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::UpdateBreakpointsResponse *>(
union_obj));
case ResponseData_RemoveBreakpointsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::RemoveBreakpointsResponse *>(
union_obj));
case ResponseData_ListModulesResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListModulesResponse *>(
union_obj));
case ResponseData_GetModuleResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::GetModuleResponse *>(
union_obj));
case ResponseData_ListFunctionsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListFunctionsResponse *>(
union_obj));
case ResponseData_GetFunctionResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::GetFunctionResponse *>(
union_obj));
case ResponseData_ListThreadsResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ListThreadsResponse *>(
union_obj));
case ResponseData_StopResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::StopResponse *>(union_obj));
case ResponseData_BreakResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::BreakResponse *>(union_obj));
case ResponseData_ContinueResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::ContinueResponse *>(union_obj));
case ResponseData_StepResponse: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::StepResponse *>(union_obj));
case ResponseData_BreakpointEvent: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::BreakpointEvent *>(union_obj));
case ResponseData_AccessViolationEvent: return verifier.VerifyTable(reinterpret_cast<const xe::debug::proto::AccessViolationEvent *>(union_obj));
default: return false;
case ResponseData_StopResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::StopResponse *>(union_obj));
case ResponseData_BreakResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::BreakResponse *>(union_obj));
case ResponseData_ContinueResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::ContinueResponse *>(
union_obj));
case ResponseData_StepResponse:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::StepResponse *>(union_obj));
case ResponseData_BreakpointEvent:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::BreakpointEvent *>(
union_obj));
case ResponseData_AccessViolationEvent:
return verifier.VerifyTable(
reinterpret_cast<const xe::debug::proto::AccessViolationEvent *>(
union_obj));
default:
return false;
}
}

View File

@ -30,17 +30,16 @@ struct ListFunctionsResponse;
struct GetFunctionRequest;
struct GetFunctionResponse;
enum ModuleType {
ModuleType_Kernel = 0,
ModuleType_User = 1
};
enum ModuleType { ModuleType_Kernel = 0, ModuleType_User = 1 };
inline const char **EnumNamesModuleType() {
static const char *names[] = { "Kernel", "User", nullptr };
static const char *names[] = {"Kernel", "User", nullptr};
return names;
}
inline const char *EnumNameModuleType(ModuleType e) { return EnumNamesModuleType()[e]; }
inline const char *EnumNameModuleType(ModuleType e) {
return EnumNamesModuleType()[e];
}
MANUALLY_ALIGNED_STRUCT(4) ListModuleEntry FLATBUFFERS_FINAL_CLASS {
private:
@ -49,18 +48,29 @@ MANUALLY_ALIGNED_STRUCT(4) ListModuleEntry FLATBUFFERS_FINAL_CLASS {
public:
ListModuleEntry(uint32_t handle, uint32_t function_count)
: handle_(flatbuffers::EndianScalar(handle)), function_count_(flatbuffers::EndianScalar(function_count)) { }
: handle_(flatbuffers::EndianScalar(handle)),
function_count_(flatbuffers::EndianScalar(function_count)) {}
uint32_t handle() const { return flatbuffers::EndianScalar(handle_); }
uint32_t function_count() const { return flatbuffers::EndianScalar(function_count_); }
uint32_t function_count() const {
return flatbuffers::EndianScalar(function_count_);
}
};
STRUCT_END(ListModuleEntry, 8);
struct Module FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const xe::debug::proto::XObject *object() const { return GetStruct<const xe::debug::proto::XObject *>(4); }
ModuleType type() const { return static_cast<ModuleType>(GetField<int8_t>(6, 0)); }
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(8); }
const flatbuffers::String *path() const { return GetPointer<const flatbuffers::String *>(10); }
const xe::debug::proto::XObject *object() const {
return GetStruct<const xe::debug::proto::XObject *>(4);
}
ModuleType type() const {
return static_cast<ModuleType>(GetField<int8_t>(6, 0));
}
const flatbuffers::String *name() const {
return GetPointer<const flatbuffers::String *>(8);
}
const flatbuffers::String *path() const {
return GetPointer<const flatbuffers::String *>(10);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<xe::debug::proto::XObject>(verifier, 4 /* object */) &&
@ -68,19 +78,28 @@ struct Module FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* name */) &&
verifier.Verify(name()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* path */) &&
verifier.Verify(path()) &&
verifier.EndTable();
verifier.Verify(path()) && verifier.EndTable();
}
};
struct ModuleBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_object(const xe::debug::proto::XObject *object) { fbb_.AddStruct(4, object); }
void add_type(ModuleType type) { fbb_.AddElement<int8_t>(6, static_cast<int8_t>(type), 0); }
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(8, name); }
void add_path(flatbuffers::Offset<flatbuffers::String> path) { fbb_.AddOffset(10, path); }
ModuleBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_object(const xe::debug::proto::XObject *object) {
fbb_.AddStruct(4, object);
}
void add_type(ModuleType type) {
fbb_.AddElement<int8_t>(6, static_cast<int8_t>(type), 0);
}
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(8, name);
}
void add_path(flatbuffers::Offset<flatbuffers::String> path) {
fbb_.AddOffset(10, path);
}
ModuleBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ModuleBuilder &operator=(const ModuleBuilder &);
flatbuffers::Offset<Module> Finish() {
auto o = flatbuffers::Offset<Module>(fbb_.EndTable(start_, 4));
@ -88,11 +107,12 @@ struct ModuleBuilder {
}
};
inline flatbuffers::Offset<Module> CreateModule(flatbuffers::FlatBufferBuilder &_fbb,
const xe::debug::proto::XObject *object = 0,
ModuleType type = ModuleType_Kernel,
flatbuffers::Offset<flatbuffers::String> name = 0,
flatbuffers::Offset<flatbuffers::String> path = 0) {
inline flatbuffers::Offset<Module> CreateModule(
flatbuffers::FlatBufferBuilder &_fbb,
const xe::debug::proto::XObject *object = 0,
ModuleType type = ModuleType_Kernel,
flatbuffers::Offset<flatbuffers::String> name = 0,
flatbuffers::Offset<flatbuffers::String> path = 0) {
ModuleBuilder builder_(_fbb);
builder_.add_path(path);
builder_.add_name(name);
@ -103,15 +123,16 @@ inline flatbuffers::Offset<Module> CreateModule(flatbuffers::FlatBufferBuilder &
struct ListModulesRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct ListModulesRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
ListModulesRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListModulesRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListModulesRequestBuilder &operator=(const ListModulesRequestBuilder &);
flatbuffers::Offset<ListModulesRequest> Finish() {
auto o = flatbuffers::Offset<ListModulesRequest>(fbb_.EndTable(start_, 0));
@ -119,26 +140,35 @@ struct ListModulesRequestBuilder {
}
};
inline flatbuffers::Offset<ListModulesRequest> CreateListModulesRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<ListModulesRequest> CreateListModulesRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
ListModulesRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct ListModulesResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<const ListModuleEntry *> *entry() const { return GetPointer<const flatbuffers::Vector<const ListModuleEntry *> *>(4); }
struct ListModulesResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<const ListModuleEntry *> *entry() const {
return GetPointer<const flatbuffers::Vector<const ListModuleEntry *> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* entry */) &&
verifier.Verify(entry()) &&
verifier.EndTable();
verifier.Verify(entry()) && verifier.EndTable();
}
};
struct ListModulesResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_entry(flatbuffers::Offset<flatbuffers::Vector<const ListModuleEntry *>> entry) { fbb_.AddOffset(4, entry); }
ListModulesResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_entry(
flatbuffers::Offset<flatbuffers::Vector<const ListModuleEntry *>> entry) {
fbb_.AddOffset(4, entry);
}
ListModulesResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListModulesResponseBuilder &operator=(const ListModulesResponseBuilder &);
flatbuffers::Offset<ListModulesResponse> Finish() {
auto o = flatbuffers::Offset<ListModulesResponse>(fbb_.EndTable(start_, 1));
@ -146,8 +176,10 @@ struct ListModulesResponseBuilder {
}
};
inline flatbuffers::Offset<ListModulesResponse> CreateListModulesResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const ListModuleEntry *>> entry = 0) {
inline flatbuffers::Offset<ListModulesResponse> CreateListModulesResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<const ListModuleEntry *>> entry =
0) {
ListModulesResponseBuilder builder_(_fbb);
builder_.add_entry(entry);
return builder_.Finish();
@ -165,8 +197,12 @@ struct GetModuleRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct GetModuleRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_module_id(uint32_t module_id) { fbb_.AddElement<uint32_t>(4, module_id, 0); }
GetModuleRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_module_id(uint32_t module_id) {
fbb_.AddElement<uint32_t>(4, module_id, 0);
}
GetModuleRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
GetModuleRequestBuilder &operator=(const GetModuleRequestBuilder &);
flatbuffers::Offset<GetModuleRequest> Finish() {
auto o = flatbuffers::Offset<GetModuleRequest>(fbb_.EndTable(start_, 1));
@ -174,8 +210,8 @@ struct GetModuleRequestBuilder {
}
};
inline flatbuffers::Offset<GetModuleRequest> CreateGetModuleRequest(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t module_id = 0) {
inline flatbuffers::Offset<GetModuleRequest> CreateGetModuleRequest(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t module_id = 0) {
GetModuleRequestBuilder builder_(_fbb);
builder_.add_module_id(module_id);
return builder_.Finish();
@ -186,16 +222,19 @@ struct GetModuleResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* module */) &&
verifier.VerifyTable(module()) &&
verifier.EndTable();
verifier.VerifyTable(module()) && verifier.EndTable();
}
};
struct GetModuleResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_module(flatbuffers::Offset<Module> module) { fbb_.AddOffset(4, module); }
GetModuleResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_module(flatbuffers::Offset<Module> module) {
fbb_.AddOffset(4, module);
}
GetModuleResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
GetModuleResponseBuilder &operator=(const GetModuleResponseBuilder &);
flatbuffers::Offset<GetModuleResponse> Finish() {
auto o = flatbuffers::Offset<GetModuleResponse>(fbb_.EndTable(start_, 1));
@ -203,8 +242,9 @@ struct GetModuleResponseBuilder {
}
};
inline flatbuffers::Offset<GetModuleResponse> CreateGetModuleResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Module> module = 0) {
inline flatbuffers::Offset<GetModuleResponse> CreateGetModuleResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Module> module = 0) {
GetModuleResponseBuilder builder_(_fbb);
builder_.add_module(module);
return builder_.Finish();
@ -214,26 +254,37 @@ struct FunctionEntry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint64_t identifier() const { return GetField<uint64_t>(4, 0); }
uint32_t address_start() const { return GetField<uint32_t>(6, 0); }
uint32_t address_end() const { return GetField<uint32_t>(8, 0); }
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(10); }
const flatbuffers::String *name() const {
return GetPointer<const flatbuffers::String *>(10);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint64_t>(verifier, 4 /* identifier */) &&
VerifyField<uint32_t>(verifier, 6 /* address_start */) &&
VerifyField<uint32_t>(verifier, 8 /* address_end */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* name */) &&
verifier.Verify(name()) &&
verifier.EndTable();
verifier.Verify(name()) && verifier.EndTable();
}
};
struct FunctionEntryBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_identifier(uint64_t identifier) { fbb_.AddElement<uint64_t>(4, identifier, 0); }
void add_address_start(uint32_t address_start) { fbb_.AddElement<uint32_t>(6, address_start, 0); }
void add_address_end(uint32_t address_end) { fbb_.AddElement<uint32_t>(8, address_end, 0); }
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(10, name); }
FunctionEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_identifier(uint64_t identifier) {
fbb_.AddElement<uint64_t>(4, identifier, 0);
}
void add_address_start(uint32_t address_start) {
fbb_.AddElement<uint32_t>(6, address_start, 0);
}
void add_address_end(uint32_t address_end) {
fbb_.AddElement<uint32_t>(8, address_end, 0);
}
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(10, name);
}
FunctionEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
FunctionEntryBuilder &operator=(const FunctionEntryBuilder &);
flatbuffers::Offset<FunctionEntry> Finish() {
auto o = flatbuffers::Offset<FunctionEntry>(fbb_.EndTable(start_, 4));
@ -241,11 +292,10 @@ struct FunctionEntryBuilder {
}
};
inline flatbuffers::Offset<FunctionEntry> CreateFunctionEntry(flatbuffers::FlatBufferBuilder &_fbb,
uint64_t identifier = 0,
uint32_t address_start = 0,
uint32_t address_end = 0,
flatbuffers::Offset<flatbuffers::String> name = 0) {
inline flatbuffers::Offset<FunctionEntry> CreateFunctionEntry(
flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0,
uint32_t address_start = 0, uint32_t address_end = 0,
flatbuffers::Offset<flatbuffers::String> name = 0) {
FunctionEntryBuilder builder_(_fbb);
builder_.add_identifier(identifier);
builder_.add_name(name);
@ -258,11 +308,17 @@ struct Function FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint64_t identifier() const { return GetField<uint64_t>(4, 0); }
uint32_t address_start() const { return GetField<uint32_t>(6, 0); }
uint32_t address_end() const { return GetField<uint32_t>(8, 0); }
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(10); }
const flatbuffers::String *name() const {
return GetPointer<const flatbuffers::String *>(10);
}
uint32_t machine_code_start() const { return GetField<uint32_t>(12, 0); }
uint32_t machine_code_end() const { return GetField<uint32_t>(14, 0); }
const flatbuffers::String *disasm_hir_raw() const { return GetPointer<const flatbuffers::String *>(16); }
const flatbuffers::String *disasm_hir_opt() const { return GetPointer<const flatbuffers::String *>(18); }
const flatbuffers::String *disasm_hir_raw() const {
return GetPointer<const flatbuffers::String *>(16);
}
const flatbuffers::String *disasm_hir_opt() const {
return GetPointer<const flatbuffers::String *>(18);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint64_t>(verifier, 4 /* identifier */) &&
@ -272,26 +328,47 @@ struct Function FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.Verify(name()) &&
VerifyField<uint32_t>(verifier, 12 /* machine_code_start */) &&
VerifyField<uint32_t>(verifier, 14 /* machine_code_end */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* disasm_hir_raw */) &&
VerifyField<flatbuffers::uoffset_t>(verifier,
16 /* disasm_hir_raw */) &&
verifier.Verify(disasm_hir_raw()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* disasm_hir_opt */) &&
verifier.Verify(disasm_hir_opt()) &&
verifier.EndTable();
VerifyField<flatbuffers::uoffset_t>(verifier,
18 /* disasm_hir_opt */) &&
verifier.Verify(disasm_hir_opt()) && verifier.EndTable();
}
};
struct FunctionBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_identifier(uint64_t identifier) { fbb_.AddElement<uint64_t>(4, identifier, 0); }
void add_address_start(uint32_t address_start) { fbb_.AddElement<uint32_t>(6, address_start, 0); }
void add_address_end(uint32_t address_end) { fbb_.AddElement<uint32_t>(8, address_end, 0); }
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(10, name); }
void add_machine_code_start(uint32_t machine_code_start) { fbb_.AddElement<uint32_t>(12, machine_code_start, 0); }
void add_machine_code_end(uint32_t machine_code_end) { fbb_.AddElement<uint32_t>(14, machine_code_end, 0); }
void add_disasm_hir_raw(flatbuffers::Offset<flatbuffers::String> disasm_hir_raw) { fbb_.AddOffset(16, disasm_hir_raw); }
void add_disasm_hir_opt(flatbuffers::Offset<flatbuffers::String> disasm_hir_opt) { fbb_.AddOffset(18, disasm_hir_opt); }
FunctionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_identifier(uint64_t identifier) {
fbb_.AddElement<uint64_t>(4, identifier, 0);
}
void add_address_start(uint32_t address_start) {
fbb_.AddElement<uint32_t>(6, address_start, 0);
}
void add_address_end(uint32_t address_end) {
fbb_.AddElement<uint32_t>(8, address_end, 0);
}
void add_name(flatbuffers::Offset<flatbuffers::String> name) {
fbb_.AddOffset(10, name);
}
void add_machine_code_start(uint32_t machine_code_start) {
fbb_.AddElement<uint32_t>(12, machine_code_start, 0);
}
void add_machine_code_end(uint32_t machine_code_end) {
fbb_.AddElement<uint32_t>(14, machine_code_end, 0);
}
void add_disasm_hir_raw(
flatbuffers::Offset<flatbuffers::String> disasm_hir_raw) {
fbb_.AddOffset(16, disasm_hir_raw);
}
void add_disasm_hir_opt(
flatbuffers::Offset<flatbuffers::String> disasm_hir_opt) {
fbb_.AddOffset(18, disasm_hir_opt);
}
FunctionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
FunctionBuilder &operator=(const FunctionBuilder &);
flatbuffers::Offset<Function> Finish() {
auto o = flatbuffers::Offset<Function>(fbb_.EndTable(start_, 8));
@ -299,15 +376,13 @@ struct FunctionBuilder {
}
};
inline flatbuffers::Offset<Function> CreateFunction(flatbuffers::FlatBufferBuilder &_fbb,
uint64_t identifier = 0,
uint32_t address_start = 0,
uint32_t address_end = 0,
flatbuffers::Offset<flatbuffers::String> name = 0,
uint32_t machine_code_start = 0,
uint32_t machine_code_end = 0,
flatbuffers::Offset<flatbuffers::String> disasm_hir_raw = 0,
flatbuffers::Offset<flatbuffers::String> disasm_hir_opt = 0) {
inline flatbuffers::Offset<Function> CreateFunction(
flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0,
uint32_t address_start = 0, uint32_t address_end = 0,
flatbuffers::Offset<flatbuffers::String> name = 0,
uint32_t machine_code_start = 0, uint32_t machine_code_end = 0,
flatbuffers::Offset<flatbuffers::String> disasm_hir_raw = 0,
flatbuffers::Offset<flatbuffers::String> disasm_hir_opt = 0) {
FunctionBuilder builder_(_fbb);
builder_.add_identifier(identifier);
builder_.add_disasm_hir_opt(disasm_hir_opt);
@ -320,7 +395,8 @@ inline flatbuffers::Offset<Function> CreateFunction(flatbuffers::FlatBufferBuild
return builder_.Finish();
}
struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
uint32_t module_id() const { return GetField<uint32_t>(4, 0); }
uint32_t function_index_start() const { return GetField<uint32_t>(6, 0); }
uint32_t function_index_end() const { return GetField<uint32_t>(8, 0); }
@ -336,21 +412,30 @@ struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
struct ListFunctionsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_module_id(uint32_t module_id) { fbb_.AddElement<uint32_t>(4, module_id, 0); }
void add_function_index_start(uint32_t function_index_start) { fbb_.AddElement<uint32_t>(6, function_index_start, 0); }
void add_function_index_end(uint32_t function_index_end) { fbb_.AddElement<uint32_t>(8, function_index_end, 0); }
ListFunctionsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_module_id(uint32_t module_id) {
fbb_.AddElement<uint32_t>(4, module_id, 0);
}
void add_function_index_start(uint32_t function_index_start) {
fbb_.AddElement<uint32_t>(6, function_index_start, 0);
}
void add_function_index_end(uint32_t function_index_end) {
fbb_.AddElement<uint32_t>(8, function_index_end, 0);
}
ListFunctionsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListFunctionsRequestBuilder &operator=(const ListFunctionsRequestBuilder &);
flatbuffers::Offset<ListFunctionsRequest> Finish() {
auto o = flatbuffers::Offset<ListFunctionsRequest>(fbb_.EndTable(start_, 3));
auto o =
flatbuffers::Offset<ListFunctionsRequest>(fbb_.EndTable(start_, 3));
return o;
}
};
inline flatbuffers::Offset<ListFunctionsRequest> CreateListFunctionsRequest(flatbuffers::FlatBufferBuilder &_fbb,
uint32_t module_id = 0,
uint32_t function_index_start = 0,
uint32_t function_index_end = 0) {
inline flatbuffers::Offset<ListFunctionsRequest> CreateListFunctionsRequest(
flatbuffers::FlatBufferBuilder &_fbb, uint32_t module_id = 0,
uint32_t function_index_start = 0, uint32_t function_index_end = 0) {
ListFunctionsRequestBuilder builder_(_fbb);
builder_.add_function_index_end(function_index_end);
builder_.add_function_index_start(function_index_start);
@ -358,13 +443,16 @@ inline flatbuffers::Offset<ListFunctionsRequest> CreateListFunctionsRequest(flat
return builder_.Finish();
}
struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>> *entry() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>> *>(4); }
struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>> *entry() const {
return GetPointer<
const flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>> *>(4);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* entry */) &&
verifier.Verify(entry()) &&
verifier.VerifyVectorOfTables(entry()) &&
verifier.Verify(entry()) && verifier.VerifyVectorOfTables(entry()) &&
verifier.EndTable();
}
};
@ -372,17 +460,26 @@ struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tabl
struct ListFunctionsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_entry(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>>> entry) { fbb_.AddOffset(4, entry); }
ListFunctionsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_entry(flatbuffers::Offset<
flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>>> entry) {
fbb_.AddOffset(4, entry);
}
ListFunctionsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListFunctionsResponseBuilder &operator=(const ListFunctionsResponseBuilder &);
flatbuffers::Offset<ListFunctionsResponse> Finish() {
auto o = flatbuffers::Offset<ListFunctionsResponse>(fbb_.EndTable(start_, 1));
auto o =
flatbuffers::Offset<ListFunctionsResponse>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<ListFunctionsResponse> CreateListFunctionsResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>>> entry = 0) {
inline flatbuffers::Offset<ListFunctionsResponse> CreateListFunctionsResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<FunctionEntry>>>
entry = 0) {
ListFunctionsResponseBuilder builder_(_fbb);
builder_.add_entry(entry);
return builder_.Finish();
@ -400,8 +497,12 @@ struct GetFunctionRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct GetFunctionRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_identifier(uint64_t identifier) { fbb_.AddElement<uint64_t>(4, identifier, 0); }
GetFunctionRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_identifier(uint64_t identifier) {
fbb_.AddElement<uint64_t>(4, identifier, 0);
}
GetFunctionRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
GetFunctionRequestBuilder &operator=(const GetFunctionRequestBuilder &);
flatbuffers::Offset<GetFunctionRequest> Finish() {
auto o = flatbuffers::Offset<GetFunctionRequest>(fbb_.EndTable(start_, 1));
@ -409,28 +510,33 @@ struct GetFunctionRequestBuilder {
}
};
inline flatbuffers::Offset<GetFunctionRequest> CreateGetFunctionRequest(flatbuffers::FlatBufferBuilder &_fbb,
uint64_t identifier = 0) {
inline flatbuffers::Offset<GetFunctionRequest> CreateGetFunctionRequest(
flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0) {
GetFunctionRequestBuilder builder_(_fbb);
builder_.add_identifier(identifier);
return builder_.Finish();
}
struct GetFunctionResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct GetFunctionResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const Function *function() const { return GetPointer<const Function *>(4); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* function */) &&
verifier.VerifyTable(function()) &&
verifier.EndTable();
verifier.VerifyTable(function()) && verifier.EndTable();
}
};
struct GetFunctionResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_function(flatbuffers::Offset<Function> function) { fbb_.AddOffset(4, function); }
GetFunctionResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
void add_function(flatbuffers::Offset<Function> function) {
fbb_.AddOffset(4, function);
}
GetFunctionResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
GetFunctionResponseBuilder &operator=(const GetFunctionResponseBuilder &);
flatbuffers::Offset<GetFunctionResponse> Finish() {
auto o = flatbuffers::Offset<GetFunctionResponse>(fbb_.EndTable(start_, 1));
@ -438,8 +544,9 @@ struct GetFunctionResponseBuilder {
}
};
inline flatbuffers::Offset<GetFunctionResponse> CreateGetFunctionResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Function> function = 0) {
inline flatbuffers::Offset<GetFunctionResponse> CreateGetFunctionResponse(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Function> function = 0) {
GetFunctionResponseBuilder builder_(_fbb);
builder_.add_function(function);
return builder_.Finish();

View File

@ -21,21 +21,24 @@ struct Thread;
struct ListThreadsRequest;
struct ListThreadsResponse;
enum ThreadType {
ThreadType_Kernel = 0,
ThreadType_User = 1
};
enum ThreadType { ThreadType_Kernel = 0, ThreadType_User = 1 };
inline const char **EnumNamesThreadType() {
static const char *names[] = { "Kernel", "User", nullptr };
static const char *names[] = {"Kernel", "User", nullptr};
return names;
}
inline const char *EnumNameThreadType(ThreadType e) { return EnumNamesThreadType()[e]; }
inline const char *EnumNameThreadType(ThreadType e) {
return EnumNamesThreadType()[e];
}
struct Thread FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const xe::debug::proto::XObject *object() const { return GetStruct<const xe::debug::proto::XObject *>(4); }
ThreadType type() const { return static_cast<ThreadType>(GetField<int8_t>(6, 0)); }
const xe::debug::proto::XObject *object() const {
return GetStruct<const xe::debug::proto::XObject *>(4);
}
ThreadType type() const {
return static_cast<ThreadType>(GetField<int8_t>(6, 0));
}
uint32_t stack_size() const { return GetField<uint32_t>(8, 0); }
uint32_t xapi_thread_startup() const { return GetField<uint32_t>(10, 0); }
uint32_t start_address() const { return GetField<uint32_t>(12, 0); }
@ -76,8 +79,12 @@ struct Thread FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct ThreadBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_object(const xe::debug::proto::XObject *object) { fbb_.AddStruct(4, object); }
void add_type(ThreadType type) { fbb_.AddElement<int8_t>(6, static_cast<int8_t>(type), 0); }
void add_object(const xe::debug::proto::XObject *object) {
fbb_.AddStruct(4, object);
}
void add_type(ThreadType type) {
fbb_.AddElement<int8_t>(6, static_cast<int8_t>(type), 0);
}
void add_stack_size(uint32_t stack_size) {
fbb_.AddElement<uint32_t>(8, stack_size, 0);
}
@ -115,7 +122,9 @@ struct ThreadBuilder {
fbb_.AddElement<uint32_t>(30, affinity, 0);
}
void add_state(uint32_t state) { fbb_.AddElement<uint32_t>(32, state, 0); }
ThreadBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ThreadBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ThreadBuilder &operator=(const ThreadBuilder &);
flatbuffers::Offset<Thread> Finish() {
auto o = flatbuffers::Offset<Thread>(fbb_.EndTable(start_, 15));
@ -154,15 +163,16 @@ inline flatbuffers::Offset<Thread> CreateThread(
struct ListThreadsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
verifier.EndTable();
return VerifyTableStart(verifier) && verifier.EndTable();
}
};
struct ListThreadsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
ListThreadsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListThreadsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListThreadsRequestBuilder &operator=(const ListThreadsRequestBuilder &);
flatbuffers::Offset<ListThreadsRequest> Finish() {
auto o = flatbuffers::Offset<ListThreadsRequest>(fbb_.EndTable(start_, 0));
@ -170,12 +180,14 @@ struct ListThreadsRequestBuilder {
}
};
inline flatbuffers::Offset<ListThreadsRequest> CreateListThreadsRequest(flatbuffers::FlatBufferBuilder &_fbb) {
inline flatbuffers::Offset<ListThreadsRequest> CreateListThreadsRequest(
flatbuffers::FlatBufferBuilder &_fbb) {
ListThreadsRequestBuilder builder_(_fbb);
return builder_.Finish();
}
struct ListThreadsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct ListThreadsResponse FLATBUFFERS_FINAL_CLASS
: private flatbuffers::Table {
const flatbuffers::Vector<flatbuffers::Offset<Thread>> *thread() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Thread>> *>(
4);
@ -195,7 +207,10 @@ struct ListThreadsResponseBuilder {
flatbuffers::Vector<flatbuffers::Offset<Thread>>> thread) {
fbb_.AddOffset(4, thread);
}
ListThreadsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListThreadsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
ListThreadsResponseBuilder &operator=(const ListThreadsResponseBuilder &);
flatbuffers::Offset<ListThreadsResponse> Finish() {
auto o = flatbuffers::Offset<ListThreadsResponse>(fbb_.EndTable(start_, 1));

View File

@ -92,9 +92,9 @@ bool CommandProcessor::Initialize(std::unique_ptr<GLContext> context) {
worker_thread_ = kernel::object_ref<kernel::XHostThread>(
new kernel::XHostThread(graphics_system_->emulator()->kernel_state(),
128 * 1024, 0, [this]() {
WorkerThreadMain();
return 0;
}));
WorkerThreadMain();
return 0;
}));
worker_thread_->set_name("GL4 Worker");
worker_thread_->Create();
@ -2881,10 +2881,10 @@ bool CommandProcessor::IssueCopy() {
/* glClearNamedFramebufferfi(source_framebuffer->framebuffer,
GL_DEPTH_STENCIL,
depth, stencil);*/
glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH,
0, &depth);
glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL,
0, &stencil);
glClearNamedFramebufferfv(source_framebuffer->framebuffer, GL_DEPTH, 0,
&depth);
glClearNamedFramebufferiv(source_framebuffer->framebuffer, GL_STENCIL, 0,
&stencil);
glDepthMask(old_depth_mask);
glStencilMask(old_stencil_mask);
}

View File

@ -209,7 +209,8 @@ void GL4ShaderTranslator::AppendSrcReg(const instr_alu_t& op, uint32_t num,
}
Append("state.float_consts[");
#if FLOW_CONTROL
// NOTE(dariosamo): Some games don't seem to take into account the relative a0
// NOTE(dariosamo): Some games don't seem to take into account the relative
// a0
// offset even when they should due to const_slot being a different value.
if (op.const_0_rel_abs || op.const_1_rel_abs) {
#else
@ -1528,22 +1529,22 @@ static const struct {
} cf_instructions[] = {
#define INSTR(opc, fxn) \
{ #opc }
INSTR(NOP, print_cf_nop),
INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec),
INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec),
INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec),
INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop),
INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call),
INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc),
INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec),
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
INSTR(NOP, print_cf_nop), //
INSTR(EXEC, print_cf_exec), //
INSTR(EXEC_END, print_cf_exec), //
INSTR(COND_EXEC, print_cf_exec), //
INSTR(COND_EXEC_END, print_cf_exec), //
INSTR(COND_PRED_EXEC, print_cf_exec), //
INSTR(COND_PRED_EXEC_END, print_cf_exec), //
INSTR(LOOP_START, print_cf_loop), //
INSTR(LOOP_END, print_cf_loop), //
INSTR(COND_CALL, print_cf_jmp_call), //
INSTR(RETURN, print_cf_jmp_call), //
INSTR(COND_JMP, print_cf_jmp_call), //
INSTR(ALLOC, print_cf_alloc), //
INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), //
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), //
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
#undef INSTR
};
@ -1699,7 +1700,8 @@ bool GL4ShaderTranslator::TranslateLoopEnd(const ucode::instr_cf_loop_t& cf) {
Append(" // %s", cf_instructions[cf.opc].name);
Append(" ADDR(0x%x) LOOP ID(%d)\n", cf.address, cf.loop_id);
Append(" i%d_cnt = i%d_cnt + 1;\n", cf.loop_id, cf.loop_id);
Append(" pc = (i%d_cnt < state.loop_consts[%d]) ? i%d_addr : pc;\n", cf.loop_id, cf.loop_id, cf.loop_id);
Append(" pc = (i%d_cnt < state.loop_consts[%d]) ? i%d_addr : pc;\n",
cf.loop_id, cf.loop_id, cf.loop_id);
return true;
}
@ -1710,66 +1712,66 @@ bool GL4ShaderTranslator::TranslateVertexFetch(const instr_fetch_vtx_t* vtx,
} fetch_types[0xff] = {
#define TYPE(id) \
{ #id }
TYPE(FMT_1_REVERSE), // 0
{0},
TYPE(FMT_8), // 2
{0},
{0},
{0},
TYPE(FMT_8_8_8_8), // 6
TYPE(FMT_2_10_10_10), // 7
{0},
{0},
TYPE(FMT_8_8), // 10
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_16), // 24
TYPE(FMT_16_16), // 25
TYPE(FMT_16_16_16_16), // 26
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_32), // 33
TYPE(FMT_32_32), // 34
TYPE(FMT_32_32_32_32), // 35
TYPE(FMT_32_FLOAT), // 36
TYPE(FMT_32_32_FLOAT), // 37
TYPE(FMT_32_32_32_32_FLOAT), // 38
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_32_32_32_FLOAT), // 57
TYPE(FMT_1_REVERSE), // 0
{0},
TYPE(FMT_8), // 2
{0},
{0},
{0},
TYPE(FMT_8_8_8_8), // 6
TYPE(FMT_2_10_10_10), // 7
{0},
{0},
TYPE(FMT_8_8), // 10
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_16), // 24
TYPE(FMT_16_16), // 25
TYPE(FMT_16_16_16_16), // 26
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_32), // 33
TYPE(FMT_32_32), // 34
TYPE(FMT_32_32_32_32), // 35
TYPE(FMT_32_FLOAT), // 36
TYPE(FMT_32_32_FLOAT), // 37
TYPE(FMT_32_32_32_32_FLOAT), // 38
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
{0},
TYPE(FMT_32_32_32_FLOAT), // 57
#undef TYPE
};
};
// Disassemble.
Append(" // %sFETCH:\t", sync ? "(S)" : " ");

View File

@ -96,10 +96,11 @@ bool GLContext::Initialize(HWND hwnd) {
int context_flags = 0;
#if DEBUG
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
#endif // DEBUG
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
#endif // DEBUG
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
0};
glrc_ = wglCreateContextAttribsARB(dc_, nullptr, attrib_list);
@ -151,11 +152,12 @@ std::unique_ptr<GLContext> GLContext::CreateShared() {
int profile = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
#if DEBUG
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
#endif // DEBUG
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
WGL_CONTEXT_PROFILE_MASK_ARB, profile, //
#endif // DEBUG
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
WGL_CONTEXT_FLAGS_ARB, context_flags, //
WGL_CONTEXT_PROFILE_MASK_ARB, profile, //
0};
new_glrc = wglCreateContextAttribsARB(dc_, glrc_, attrib_list);
if (!new_glrc) {
@ -280,9 +282,9 @@ void GLContext::DebugMessage(GLenum source, GLenum type, GLuint id,
}
void GLAPIENTRY
GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar* message, GLvoid* user_param) {
GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar* message, GLvoid* user_param) {
reinterpret_cast<GLContext*>(user_param)
->DebugMessage(source, type, id, severity, length, message);
}

View File

@ -43,9 +43,8 @@ class GLContext {
void DebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message);
static void GLAPIENTRY
DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message,
GLvoid* user_param);
DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message, GLvoid* user_param);
HWND hwnd_;
HDC dc_;

View File

@ -666,15 +666,22 @@ struct {
} cf_instructions[] = {
#define INSTR(opc, fxn) \
{ #opc, fxn }
INSTR(NOP, print_cf_nop), INSTR(EXEC, print_cf_exec),
INSTR(EXEC_END, print_cf_exec), INSTR(COND_EXEC, print_cf_exec),
INSTR(COND_EXEC_END, print_cf_exec), INSTR(COND_PRED_EXEC, print_cf_exec),
INSTR(COND_PRED_EXEC_END, print_cf_exec), INSTR(LOOP_START, print_cf_loop),
INSTR(LOOP_END, print_cf_loop), INSTR(COND_CALL, print_cf_jmp_call),
INSTR(RETURN, print_cf_jmp_call), INSTR(COND_JMP, print_cf_jmp_call),
INSTR(ALLOC, print_cf_alloc), INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec),
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec),
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
INSTR(NOP, print_cf_nop), //
INSTR(EXEC, print_cf_exec), //
INSTR(EXEC_END, print_cf_exec), //
INSTR(COND_EXEC, print_cf_exec), //
INSTR(COND_EXEC_END, print_cf_exec), //
INSTR(COND_PRED_EXEC, print_cf_exec), //
INSTR(COND_PRED_EXEC_END, print_cf_exec), //
INSTR(LOOP_START, print_cf_loop), //
INSTR(LOOP_END, print_cf_loop), //
INSTR(COND_CALL, print_cf_jmp_call), //
INSTR(RETURN, print_cf_jmp_call), //
INSTR(COND_JMP, print_cf_jmp_call), //
INSTR(ALLOC, print_cf_alloc), //
INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), //
INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), //
INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ??
#undef INSTR
};

View File

@ -1072,23 +1072,24 @@ void DrawShaderUI(xe::ui::MainWindow* window, TracePlayer& player,
// glBlendFuncSeparatei(i, src_blend, dest_blend, src_blend_alpha,
// dest_blend_alpha);
void DrawBlendMode(uint32_t src_blend, uint32_t dest_blend, uint32_t blend_op) {
static const char* kBlendNames[] = {/* 0 */ "ZERO",
/* 1 */ "ONE",
/* 2 */ "UNK2", // ?
/* 3 */ "UNK3", // ?
/* 4 */ "SRC_COLOR",
/* 5 */ "ONE_MINUS_SRC_COLOR",
/* 6 */ "SRC_ALPHA",
/* 7 */ "ONE_MINUS_SRC_ALPHA",
/* 8 */ "DST_COLOR",
/* 9 */ "ONE_MINUS_DST_COLOR",
/* 10 */ "DST_ALPHA",
/* 11 */ "ONE_MINUS_DST_ALPHA",
/* 12 */ "CONSTANT_COLOR",
/* 13 */ "ONE_MINUS_CONSTANT_COLOR",
/* 14 */ "CONSTANT_ALPHA",
/* 15 */ "ONE_MINUS_CONSTANT_ALPHA",
/* 16 */ "SRC_ALPHA_SATURATE",
static const char* kBlendNames[] = {
/* 0 */ "ZERO",
/* 1 */ "ONE",
/* 2 */ "UNK2", // ?
/* 3 */ "UNK3", // ?
/* 4 */ "SRC_COLOR",
/* 5 */ "ONE_MINUS_SRC_COLOR",
/* 6 */ "SRC_ALPHA",
/* 7 */ "ONE_MINUS_SRC_ALPHA",
/* 8 */ "DST_COLOR",
/* 9 */ "ONE_MINUS_DST_COLOR",
/* 10 */ "DST_ALPHA",
/* 11 */ "ONE_MINUS_DST_ALPHA",
/* 12 */ "CONSTANT_COLOR",
/* 13 */ "ONE_MINUS_CONSTANT_COLOR",
/* 14 */ "CONSTANT_ALPHA",
/* 15 */ "ONE_MINUS_CONSTANT_ALPHA",
/* 16 */ "SRC_ALPHA_SATURATE",
};
const char* src_str = kBlendNames[src_blend];
const char* dest_str = kBlendNames[dest_blend];
@ -2406,7 +2407,7 @@ void ImImpl_Setup() {
pixels);
// Store our identifier
io.Fonts->TexID = (void*)(intptr_t) tex_id;
io.Fonts->TexID = (void*)(intptr_t)tex_id;
io.DeltaTime = 1.0f / 60.0f;
io.RenderDrawListsFn = ImImpl_RenderDrawLists;
@ -2548,7 +2549,7 @@ void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count) {
for (const ImDrawCmd* pcmd = cmd_list->commands.begin(); pcmd != pcmd_end;
pcmd++) {
if (pcmd->texture_id != prev_texture_id) {
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t) pcmd->texture_id);
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->texture_id);
prev_texture_id = pcmd->texture_id;
}
glScissor((int)pcmd->clip_rect.x, (int)(height - pcmd->clip_rect.w),

View File

@ -265,33 +265,31 @@ inline uint32_t CpuToGpu(uint32_t p) { return p & 0x1FFFFFFF; }
// XE_GPU_REG_SQ_PROGRAM_CNTL
typedef union {
XEPACKEDSTRUCTANONYMOUS({
uint32_t vs_regs : 6;
uint32_t : 2;
uint32_t ps_regs : 6;
uint32_t : 2;
uint32_t vs_resource : 1;
uint32_t ps_resource : 1;
uint32_t param_gen : 1;
uint32_t unknown0 : 1;
uint32_t vs_export_count : 4;
uint32_t vs_export_mode : 3;
uint32_t ps_export_depth : 1;
uint32_t ps_export_count : 3;
uint32_t gen_index_vtx : 1;
});
XEPACKEDSTRUCTANONYMOUS({
uint32_t dword_0;
uint32_t vs_regs : 6;
uint32_t unk_0 : 2;
uint32_t ps_regs : 6;
uint32_t unk_1 : 2;
uint32_t vs_resource : 1;
uint32_t ps_resource : 1;
uint32_t param_gen : 1;
uint32_t unknown0 : 1;
uint32_t vs_export_count : 4;
uint32_t vs_export_mode : 3;
uint32_t ps_export_depth : 1;
uint32_t ps_export_count : 3;
uint32_t gen_index_vtx : 1;
});
XEPACKEDSTRUCTANONYMOUS({ uint32_t dword_0; });
} xe_gpu_program_cntl_t;
// XE_GPU_REG_SHADER_CONSTANT_FETCH_*
XEPACKEDUNION(xe_gpu_vertex_fetch_t, {
XEPACKEDSTRUCTANONYMOUS({
uint32_t type : 2;
uint32_t address : 30;
uint32_t endian : 2;
uint32_t size : 24;
uint32_t unk1 : 6;
uint32_t type : 2;
uint32_t address : 30;
uint32_t endian : 2;
uint32_t size : 24;
uint32_t unk1 : 6;
});
XEPACKEDSTRUCTANONYMOUS({
uint32_t dword_0;
@ -302,57 +300,57 @@ XEPACKEDUNION(xe_gpu_vertex_fetch_t, {
// XE_GPU_REG_SHADER_CONSTANT_FETCH_*
XEPACKEDUNION(xe_gpu_texture_fetch_t, {
XEPACKEDSTRUCTANONYMOUS({
uint32_t type : 2; // dword_0
uint32_t sign_x : 2;
uint32_t sign_y : 2;
uint32_t sign_z : 2;
uint32_t sign_w : 2;
uint32_t clamp_x : 3;
uint32_t clamp_y : 3;
uint32_t clamp_z : 3;
uint32_t unk0 : 3;
uint32_t pitch : 9;
uint32_t tiled : 1;
uint32_t format : 6; // dword_1
uint32_t endianness : 2;
uint32_t unk1 : 4;
uint32_t address : 20;
union { // dword_2
uint32_t type : 2; // dword_0
uint32_t sign_x : 2;
uint32_t sign_y : 2;
uint32_t sign_z : 2;
uint32_t sign_w : 2;
uint32_t clamp_x : 3;
uint32_t clamp_y : 3;
uint32_t clamp_z : 3;
uint32_t unk0 : 3;
uint32_t pitch : 9;
uint32_t tiled : 1;
uint32_t format : 6; // dword_1
uint32_t endianness : 2;
uint32_t unk1 : 4;
uint32_t address : 20;
union { // dword_2
struct {
uint32_t width : 24;
uint32_t unused : 8;
uint32_t width : 24;
uint32_t unused : 8;
} size_1d;
struct {
uint32_t width : 13;
uint32_t height : 13;
uint32_t unused : 6;
uint32_t width : 13;
uint32_t height : 13;
uint32_t unused : 6;
} size_2d;
struct {
uint32_t width : 13;
uint32_t height : 13;
uint32_t depth : 6;
uint32_t width : 13;
uint32_t height : 13;
uint32_t depth : 6;
} size_stack;
struct {
uint32_t width : 11;
uint32_t height : 11;
uint32_t depth : 10;
uint32_t width : 11;
uint32_t height : 11;
uint32_t depth : 10;
} size_3d;
};
uint32_t unk3_0 : 1; // dword_3
uint32_t swizzle : 12; // xyzw, 3b each (XE_GPU_SWIZZLE)
uint32_t unk3_1 : 6;
uint32_t mag_filter : 2;
uint32_t min_filter : 2;
uint32_t mip_filter : 2;
uint32_t unk3_2 : 6;
uint32_t border : 1;
uint32_t unk4_0 : 2; // dword_4
uint32_t mip_min_level : 4;
uint32_t mip_max_level : 4;
uint32_t unk4_1 : 22;
uint32_t unk5 : 9; // dword_5
uint32_t dimension : 2;
uint32_t unk5b : 21;
uint32_t unk3_0 : 1; // dword_3
uint32_t swizzle : 12; // xyzw, 3b each (XE_GPU_SWIZZLE)
uint32_t unk3_1 : 6;
uint32_t mag_filter : 2;
uint32_t min_filter : 2;
uint32_t mip_filter : 2;
uint32_t unk3_2 : 6;
uint32_t border : 1;
uint32_t unk4_0 : 2; // dword_4
uint32_t mip_min_level : 4;
uint32_t mip_max_level : 4;
uint32_t unk4_1 : 22;
uint32_t unk5 : 9; // dword_5
uint32_t dimension : 2;
uint32_t unk5b : 21;
});
XEPACKEDSTRUCTANONYMOUS({
uint32_t dword_0;
@ -382,20 +380,21 @@ XEPACKEDUNION(xe_gpu_fetch_group_t, {
});
XEPACKEDSTRUCTANONYMOUS({
uint32_t type_0 : 2;
uint32_t : 30;
uint32_t : 32;
uint32_t data_0_a : 30;
uint32_t data_0_b : 32;
uint32_t type_1 : 2;
uint32_t : 30;
uint32_t : 32;
uint32_t data_1_a : 30;
uint32_t data_1_b : 32;
uint32_t type_2 : 2;
uint32_t : 30;
uint32_t : 32;
uint32_t data_2_a : 30;
uint32_t data_2_b : 32;
});
});
// Opcodes (IT_OPCODE) for Type-3 commands in the ringbuffer.
// https://github.com/freedreno/amd-gpu/blob/master/include/api/gsl_pm4types.h
// Not sure if all of these are used.
// clang-format off
enum Type3Opcode {
PM4_ME_INIT = 0x48, // initialize CP's micro-engine
@ -459,16 +458,18 @@ enum Type3Opcode {
PM4_SET_BIN_SELECT_LO = 0x62,
PM4_SET_BIN_SELECT_HI = 0x63,
};
// clang-format on
template<uint16_t index, uint16_t count, bool one_reg = false>
template <uint16_t index, uint16_t count, bool one_reg = false>
constexpr inline uint32_t MakePacketType0() {
// ttcccccc cccccccc oiiiiiii iiiiiiii
static_assert(index <= 0x7FFF, "index must be <= 0x7FFF");
static_assert(count >= 1 && count <= 0x4000, "count must be >= 1 and <= 0x4000");
static_assert(count >= 1 && count <= 0x4000,
"count must be >= 1 and <= 0x4000");
return (0u << 30) | (((count - 1) & 0x3FFF) << 16) | (index & 0x7FFF);
}
template<uint16_t index_1, uint16_t index_2>
template <uint16_t index_1, uint16_t index_2>
constexpr inline uint32_t MakePacketType1() {
// tt?????? ??222222 22222111 11111111
static_assert(index_1 <= 0x7FF, "index_1 must be <= 0x7FF");
@ -481,12 +482,14 @@ constexpr inline uint32_t MakePacketType2() {
return (2u << 30);
}
template<Type3Opcode opcode, uint16_t count, bool predicate = false>
template <Type3Opcode opcode, uint16_t count, bool predicate = false>
constexpr inline uint32_t MakePacketType3() {
// ttcccccc cccccccc ?ooooooo ???????p
static_assert(opcode <= 0x7F, "opcode must be <= 0x7F");
static_assert(count >= 1 && count <= 0x4000, "count must be >= 1 and <= 0x4000");
return (3u << 30) | (((count - 1) & 0x3FFF) << 16) | ((opcode & 0x7F) << 8) | (predicate ? 1 : 0);
static_assert(count >= 1 && count <= 0x4000,
"count must be >= 1 and <= 0x4000");
return (3u << 30) | (((count - 1) & 0x3FFF) << 16) | ((opcode & 0x7F) << 8) |
(predicate ? 1 : 0);
}
} // namespace xenos

View File

@ -302,7 +302,7 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
playlist_name = L"";
} else {
playlist_name = xe::load_and_swap<std::wstring>(
memory_->TranslateVirtual(playlist_name_ptr));
memory_->TranslateVirtual(playlist_name_ptr));
}
// dummy_alloc_ptr is the result of a XamAlloc of storage_size.
assert_true(storage_size == 4 + song_count * 128);

View File

@ -20,7 +20,8 @@ Device::Device(const std::string& path) : path_(path) {}
Device::~Device() = default;
// TODO(gibbed): make virtual + move implementation into HostPathDevice/etc.
X_STATUS Device::QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info, size_t length) {
X_STATUS Device::QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info,
size_t length) {
assert_not_null(out_info);
const char* name = "test"; // TODO(gibbed): actual value
@ -39,17 +40,19 @@ X_STATUS Device::QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info, size_t
}
// TODO(gibbed): make virtual + move implementation into HostPathDevice/etc.
X_STATUS Device::QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info, size_t length) {
X_STATUS Device::QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info,
size_t length) {
assert_not_null(out_info);
out_info->total_allocation_units = 1234; // TODO(gibbed): actual value
out_info->available_allocation_units = 0; // TODO(gibbed): actual value
out_info->total_allocation_units = 1234; // TODO(gibbed): actual value
out_info->available_allocation_units = 0; // TODO(gibbed): actual value
out_info->sectors_per_allocation_unit = 1; // TODO(gibbed): actual value
out_info->bytes_per_sector = 1024; // TODO(gibbed): actual value
out_info->bytes_per_sector = 1024; // TODO(gibbed): actual value
return X_STATUS_SUCCESS;
}
// TODO(gibbed): make virtual + move implementation into HostPathDevice/etc.
X_STATUS Device::QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info, size_t length) {
X_STATUS Device::QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info,
size_t length) {
assert_not_null(out_info);
const char* name = "test"; // TODO(gibbed): actual value

View File

@ -30,9 +30,12 @@ class Device {
virtual std::unique_ptr<Entry> ResolvePath(const char* path) = 0;
virtual X_STATUS QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info, size_t length);
virtual X_STATUS QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info, size_t length);
virtual X_STATUS QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info, size_t length);
virtual X_STATUS QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info,
size_t length);
virtual X_STATUS QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info,
size_t length);
virtual X_STATUS QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info,
size_t length);
protected:
std::string path_;

View File

@ -47,8 +47,9 @@ X_STATUS DiscImageEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
return X_STATUS_SUCCESS;
}
X_STATUS DiscImageEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
X_STATUS DiscImageEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) {
assert_not_null(out_info);
GDFXEntry* entry(nullptr);

View File

@ -35,8 +35,9 @@ X_STATUS DiscImageFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS DiscImageFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
X_STATUS DiscImageFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}

View File

@ -61,8 +61,9 @@ X_STATUS HostPathEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
return X_STATUS_SUCCESS;
}
X_STATUS HostPathEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
X_STATUS HostPathEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) {
assert_not_null(out_info);
WIN32_FIND_DATA ffd;

View File

@ -35,8 +35,9 @@ X_STATUS HostPathFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS HostPathFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
X_STATUS HostPathFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}

View File

@ -26,7 +26,8 @@ STFSContainerEntry::STFSContainerEntry(Device* device, const char* path,
STFSContainerEntry::~STFSContainerEntry() = default;
X_STATUS STFSContainerEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
X_STATUS STFSContainerEntry::QueryInfo(
X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
assert_not_null(out_info);
out_info->creation_time = stfs_entry_->update_timestamp;
out_info->last_access_time = stfs_entry_->access_timestamp;
@ -38,10 +39,9 @@ X_STATUS STFSContainerEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info
return X_STATUS_SUCCESS;
}
X_STATUS STFSContainerEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length,
const char* file_name,
bool restart) {
X_STATUS STFSContainerEntry::QueryDirectory(
X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
assert_not_null(out_info);
STFSEntry* entry(nullptr);

View File

@ -31,13 +31,14 @@ const std::string& STFSContainerFile::name() const { return entry_->name(); }
Device* STFSContainerFile::device() const { return entry_->device(); }
X_STATUS STFSContainerFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
X_STATUS STFSContainerFile::QueryInfo(
X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS STFSContainerFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) {
X_STATUS STFSContainerFile::QueryDirectory(
X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}

View File

@ -65,8 +65,9 @@ class Entry {
bool is_read_only() const;
virtual X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) = 0;
virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) = 0;
virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) = 0;
virtual bool can_map() { return false; }

View File

@ -187,7 +187,8 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
}
}
XELOGE("ResolvePath(%s) failed - device not found (%s)", path.c_str(), device_path.c_str());
XELOGE("ResolvePath(%s) failed - device not found (%s)", path.c_str(),
device_path.c_str());
return nullptr;
}

View File

@ -19,14 +19,14 @@ namespace xe {
namespace kernel {
namespace fs {
#define XEGETUINT24BE(p) \
(((uint32_t)xe::load_and_swap<uint8_t>((p)+0) << 16) | \
((uint32_t)xe::load_and_swap<uint8_t>((p)+1) << 8) | \
(uint32_t)xe::load_and_swap<uint8_t>((p)+2))
#define XEGETUINT24LE(p) \
(((uint32_t)xe::load<uint8_t>((p)+2) << 16) | \
((uint32_t)xe::load<uint8_t>((p)+1) << 8) | \
(uint32_t)xe::load<uint8_t>((p)+0))
#define XEGETUINT24BE(p) \
(((uint32_t)xe::load_and_swap<uint8_t>((p) + 0) << 16) | \
((uint32_t)xe::load_and_swap<uint8_t>((p) + 1) << 8) | \
(uint32_t)xe::load_and_swap<uint8_t>((p) + 2))
#define XEGETUINT24LE(p) \
(((uint32_t)xe::load<uint8_t>((p) + 2) << 16) | \
((uint32_t)xe::load<uint8_t>((p) + 1) << 8) | \
(uint32_t)xe::load<uint8_t>((p) + 0))
bool STFSVolumeDescriptor::Read(const uint8_t* p) {
descriptor_size = xe::load_and_swap<uint8_t>(p + 0x00);

View File

@ -70,7 +70,7 @@ X_STATUS ObjectTable::FindFreeSlot(uint32_t* out_slot) {
// Zero out new memory.
if (new_table_size > old_table_size) {
std::memset(reinterpret_cast<uint8_t*>(new_table) + old_table_size, 0,
new_table_size - old_table_size);
new_table_size - old_table_size);
}
last_free_entry_ = table_capacity_;
table_capacity_ = new_table_capacity;
@ -120,7 +120,7 @@ X_STATUS ObjectTable::DuplicateHandle(X_HANDLE handle, X_HANDLE* out_handle) {
XObject* object = LookupObject(handle, false);
if (object) {
result = AddHandle(object, out_handle);
object->Release(); // Release the ref that LookupObject took
object->Release(); // Release the ref that LookupObject took
} else {
result = X_STATUS_INVALID_HANDLE;
}

View File

@ -145,8 +145,9 @@ class XFile : public XObject {
void set_position(size_t value) { position_ = value; }
virtual X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) = 0;
virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length,
const char* file_name, bool restart) = 0;
virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
size_t length, const char* file_name,
bool restart) = 0;
X_STATUS Read(void* buffer, size_t buffer_length, size_t byte_offset,
size_t* out_bytes_read);

View File

@ -169,7 +169,8 @@ X_STATUS XThread::Create() {
uint32_t tls_extended_size = 0;
if (module && module->xex_header()) {
const xe_xex2_header_t* header = module->xex_header();
tls_slots = header->tls_info.slot_count ? header->tls_info.slot_count : kDefaultTlsSlotCount;
tls_slots = header->tls_info.slot_count ? header->tls_info.slot_count
: kDefaultTlsSlotCount;
tls_extended_size = header->tls_info.data_size;
} else {
tls_slots = kDefaultTlsSlotCount;
@ -179,7 +180,7 @@ X_STATUS XThread::Create() {
// HACK: we're currently not using the extra memory allocated for TLS slots
// and instead relying on native TLS slots, so don't allocate anything for
// the slots.
uint32_t tls_slot_size = 0; // tls_slots * 4;
uint32_t tls_slot_size = 0; // tls_slots * 4;
uint32_t tls_total_size = tls_slot_size + tls_extended_size;
tls_address_ = memory()->SystemHeapAlloc(tls_total_size);
if (!tls_address_) {
@ -193,8 +194,7 @@ X_STATUS XThread::Create() {
// If game has extended data, copy in the default values.
const xe_xex2_header_t* header = module->xex_header();
assert_not_zero(header->tls_info.raw_data_address);
memory()->Copy(tls_address_,
header->tls_info.raw_data_address,
memory()->Copy(tls_address_, header->tls_info.raw_data_address,
header->tls_info.raw_data_size);
}
@ -271,8 +271,8 @@ X_STATUS XThread::Create() {
struct XTEB {
xe::be<uint32_t> unk_00; // 0x0
xe::be<uint32_t> unk_04; // 0x4
X_LIST_ENTRY unk_08; // 0x8
X_LIST_ENTRY unk_10; // 0x10
X_LIST_ENTRY unk_08; // 0x8
X_LIST_ENTRY unk_10; // 0x10
};
// Setup the thread state block (last error/etc)
@ -373,11 +373,10 @@ static uint32_t __stdcall XThreadStartCallbackWin32(void* param) {
X_STATUS XThread::PlatformCreate() {
Retain();
bool suspended = creation_params_.creation_flags & 0x1;
const size_t kStackSize = 16 * 1024 * 1024; // let's do the stupid thing
thread_handle_ =
CreateThread(NULL, kStackSize,
(LPTHREAD_START_ROUTINE)XThreadStartCallbackWin32,
this, suspended ? CREATE_SUSPENDED : 0, NULL);
const size_t kStackSize = 16 * 1024 * 1024; // let's do the stupid thing
thread_handle_ = CreateThread(
NULL, kStackSize, (LPTHREAD_START_ROUTINE)XThreadStartCallbackWin32, this,
suspended ? CREATE_SUSPENDED : 0, NULL);
if (!thread_handle_) {
uint32_t last_error = GetLastError();
// TODO(benvanik): translate?

View File

@ -64,7 +64,7 @@ struct XAPC {
struct X_THREAD {
X_DISPATCH_HEADER header;
xe::be<uint64_t> cycle_time;
xe::be<uint32_t> high_cycle_time; // FIXME: Needed?
xe::be<uint32_t> high_cycle_time; // FIXME: Needed?
xe::be<uint64_t> quantum_target;
xe::be<uint32_t> initial_stack_ptr;
xe::be<uint32_t> stack_limit_ptr;
@ -166,14 +166,14 @@ class XThread : public XObject {
};
class XHostThread : public XThread {
public:
XHostThread(KernelState* kernel_state, uint32_t stack_size,
uint32_t creation_flags, std::function<int()> host_fn);
public:
XHostThread(KernelState* kernel_state, uint32_t stack_size,
uint32_t creation_flags, std::function<int()> host_fn);
virtual void Execute();
virtual void Execute();
private:
std::function<int()> host_fn_;
private:
std::function<int()> host_fn_;
};
} // namespace kernel

View File

@ -66,9 +66,10 @@ class UserProfile {
Int32Setting(uint32_t setting_id, int32_t value)
: Setting(setting_id, Type::INT32, 4), value(value) {}
int32_t value;
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
xe::store_and_swap<int32_t>(user_data + kValueOffset, value);
return buffer_offset;
}
@ -77,9 +78,10 @@ class UserProfile {
Int64Setting(uint32_t setting_id, int64_t value)
: Setting(setting_id, Type::INT64, 8), value(value) {}
int64_t value;
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
xe::store_and_swap<int64_t>(user_data + kValueOffset, value);
return buffer_offset;
}
@ -88,9 +90,10 @@ class UserProfile {
DoubleSetting(uint32_t setting_id, double value)
: Setting(setting_id, Type::DOUBLE, 8), value(value) {}
double value;
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
xe::store_and_swap<double>(user_data + kValueOffset, value);
return buffer_offset;
}
@ -102,9 +105,10 @@ class UserProfile {
size_t extra_size() const override {
return value.empty() ? 0 : 2 * (static_cast<int32_t>(value.size()) + 1);
}
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
int32_t length;
if (value.empty()) {
length = 0;
@ -113,8 +117,9 @@ class UserProfile {
} else {
length = 2 * (static_cast<int32_t>(value.size()) + 1);
xe::store_and_swap<int32_t>(user_data + kValueOffset, length);
xe::store_and_swap<uint32_t>(user_data + kPointerOffset,
buffer_ptr + static_cast<uint32_t>(buffer_offset));
xe::store_and_swap<uint32_t>(
user_data + kPointerOffset,
buffer_ptr + static_cast<uint32_t>(buffer_offset));
memcpy(buffer + buffer_offset, value.data(), length);
}
return buffer_offset + length;
@ -124,9 +129,10 @@ class UserProfile {
FloatSetting(uint32_t setting_id, float value)
: Setting(setting_id, Type::FLOAT, 4), value(value) {}
float value;
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
xe::store_and_swap<float>(user_data + kValueOffset, value);
return buffer_offset;
}
@ -138,9 +144,10 @@ class UserProfile {
size_t extra_size() const override {
return static_cast<int32_t>(value.size());
}
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
int32_t length;
if (value.empty()) {
length = 0;
@ -149,8 +156,9 @@ class UserProfile {
} else {
length = static_cast<int32_t>(value.size());
xe::store_and_swap<int32_t>(user_data + kValueOffset, length);
xe::store_and_swap<uint32_t>(user_data + kPointerOffset,
buffer_ptr + static_cast<uint32_t>(buffer_offset));
xe::store_and_swap<uint32_t>(
user_data + kPointerOffset,
buffer_ptr + static_cast<uint32_t>(buffer_offset));
memcpy(buffer + buffer_offset, value.data(), length);
}
return buffer_offset + length;
@ -160,9 +168,10 @@ class UserProfile {
DateTimeSetting(uint32_t setting_id, int64_t value)
: Setting(setting_id, Type::DATETIME, 8), value(value) {}
int64_t value;
size_t Append(uint8_t* user_data, uint8_t* buffer,
uint32_t buffer_ptr, size_t buffer_offset) override {
buffer_offset = Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
size_t Append(uint8_t* user_data, uint8_t* buffer, uint32_t buffer_ptr,
size_t buffer_offset) override {
buffer_offset =
Setting::Append(user_data, buffer, buffer_ptr, buffer_offset);
xe::store_and_swap<int64_t>(user_data + kValueOffset, value);
return buffer_offset;
}

View File

@ -611,7 +611,7 @@ int xe_xex2_read_image_basic_compressed(const xe_xex2_header_t *header,
return 1;
}
uint8_t *buffer = memory->TranslateVirtual(header->exe_address);
std::memset(buffer, 0, total_size); // Quickly zero the contents.
std::memset(buffer, 0, total_size); // Quickly zero the contents.
uint8_t *d = buffer;
uint32_t rk[4 * (MAXNR + 1)];

View File

@ -13,82 +13,82 @@
#include <cstdint>
typedef enum {
XEX_HEADER_RESOURCE_INFO = 0x000002FF,
XEX_HEADER_FILE_FORMAT_INFO = 0x000003FF,
XEX_HEADER_DELTA_PATCH_DESCRIPTOR = 0x000005FF,
XEX_HEADER_BASE_REFERENCE = 0x00000405,
XEX_HEADER_BOUNDING_PATH = 0x000080FF,
XEX_HEADER_DEVICE_ID = 0x00008105,
XEX_HEADER_ORIGINAL_BASE_ADDRESS = 0x00010001,
XEX_HEADER_ENTRY_POINT = 0x00010100,
XEX_HEADER_IMAGE_BASE_ADDRESS = 0x00010201,
XEX_HEADER_IMPORT_LIBRARIES = 0x000103FF,
XEX_HEADER_CHECKSUM_TIMESTAMP = 0x00018002,
XEX_HEADER_ENABLED_FOR_CALLCAP = 0x00018102,
XEX_HEADER_ENABLED_FOR_FASTCAP = 0x00018200,
XEX_HEADER_ORIGINAL_PE_NAME = 0x000183FF,
XEX_HEADER_STATIC_LIBRARIES = 0x000200FF,
XEX_HEADER_TLS_INFO = 0x00020104,
XEX_HEADER_DEFAULT_STACK_SIZE = 0x00020200,
XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE = 0x00020301,
XEX_HEADER_DEFAULT_HEAP_SIZE = 0x00020401,
XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS = 0x00028002,
XEX_HEADER_SYSTEM_FLAGS = 0x00030000,
XEX_HEADER_EXECUTION_INFO = 0x00040006,
XEX_HEADER_TITLE_WORKSPACE_SIZE = 0x00040201,
XEX_HEADER_GAME_RATINGS = 0x00040310,
XEX_HEADER_LAN_KEY = 0x00040404,
XEX_HEADER_XBOX360_LOGO = 0x000405FF,
XEX_HEADER_MULTIDISC_MEDIA_IDS = 0x000406FF,
XEX_HEADER_ALTERNATE_TITLE_IDS = 0x000407FF,
XEX_HEADER_ADDITIONAL_TITLE_MEMORY = 0x00040801,
XEX_HEADER_EXPORTS_BY_NAME = 0x00E10402,
XEX_HEADER_RESOURCE_INFO = 0x000002FF,
XEX_HEADER_FILE_FORMAT_INFO = 0x000003FF,
XEX_HEADER_DELTA_PATCH_DESCRIPTOR = 0x000005FF,
XEX_HEADER_BASE_REFERENCE = 0x00000405,
XEX_HEADER_BOUNDING_PATH = 0x000080FF,
XEX_HEADER_DEVICE_ID = 0x00008105,
XEX_HEADER_ORIGINAL_BASE_ADDRESS = 0x00010001,
XEX_HEADER_ENTRY_POINT = 0x00010100,
XEX_HEADER_IMAGE_BASE_ADDRESS = 0x00010201,
XEX_HEADER_IMPORT_LIBRARIES = 0x000103FF,
XEX_HEADER_CHECKSUM_TIMESTAMP = 0x00018002,
XEX_HEADER_ENABLED_FOR_CALLCAP = 0x00018102,
XEX_HEADER_ENABLED_FOR_FASTCAP = 0x00018200,
XEX_HEADER_ORIGINAL_PE_NAME = 0x000183FF,
XEX_HEADER_STATIC_LIBRARIES = 0x000200FF,
XEX_HEADER_TLS_INFO = 0x00020104,
XEX_HEADER_DEFAULT_STACK_SIZE = 0x00020200,
XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE = 0x00020301,
XEX_HEADER_DEFAULT_HEAP_SIZE = 0x00020401,
XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS = 0x00028002,
XEX_HEADER_SYSTEM_FLAGS = 0x00030000,
XEX_HEADER_EXECUTION_INFO = 0x00040006,
XEX_HEADER_TITLE_WORKSPACE_SIZE = 0x00040201,
XEX_HEADER_GAME_RATINGS = 0x00040310,
XEX_HEADER_LAN_KEY = 0x00040404,
XEX_HEADER_XBOX360_LOGO = 0x000405FF,
XEX_HEADER_MULTIDISC_MEDIA_IDS = 0x000406FF,
XEX_HEADER_ALTERNATE_TITLE_IDS = 0x000407FF,
XEX_HEADER_ADDITIONAL_TITLE_MEMORY = 0x00040801,
XEX_HEADER_EXPORTS_BY_NAME = 0x00E10402,
} xe_xex2_header_keys;
typedef enum {
XEX_MODULE_TITLE = 0x00000001,
XEX_MODULE_EXPORTS_TO_TITLE = 0x00000002,
XEX_MODULE_SYSTEM_DEBUGGER = 0x00000004,
XEX_MODULE_DLL_MODULE = 0x00000008,
XEX_MODULE_MODULE_PATCH = 0x00000010,
XEX_MODULE_PATCH_FULL = 0x00000020,
XEX_MODULE_PATCH_DELTA = 0x00000040,
XEX_MODULE_USER_MODE = 0x00000080,
XEX_MODULE_TITLE = 0x00000001,
XEX_MODULE_EXPORTS_TO_TITLE = 0x00000002,
XEX_MODULE_SYSTEM_DEBUGGER = 0x00000004,
XEX_MODULE_DLL_MODULE = 0x00000008,
XEX_MODULE_MODULE_PATCH = 0x00000010,
XEX_MODULE_PATCH_FULL = 0x00000020,
XEX_MODULE_PATCH_DELTA = 0x00000040,
XEX_MODULE_USER_MODE = 0x00000080,
} xe_xex2_module_flags;
typedef enum {
XEX_SYSTEM_NO_FORCED_REBOOT = 0x00000001,
XEX_SYSTEM_FOREGROUND_TASKS = 0x00000002,
XEX_SYSTEM_NO_ODD_MAPPING = 0x00000004,
XEX_SYSTEM_HANDLE_MCE_INPUT = 0x00000008,
XEX_SYSTEM_RESTRICTED_HUD_FEATURES = 0x00000010,
XEX_SYSTEM_HANDLE_GAMEPAD_DISCONNECT = 0x00000020,
XEX_SYSTEM_INSECURE_SOCKETS = 0x00000040,
XEX_SYSTEM_XBOX1_INTEROPERABILITY = 0x00000080,
XEX_SYSTEM_DASH_CONTEXT = 0x00000100,
XEX_SYSTEM_USES_GAME_VOICE_CHANNEL = 0x00000200,
XEX_SYSTEM_PAL50_INCOMPATIBLE = 0x00000400,
XEX_SYSTEM_INSECURE_UTILITY_DRIVE = 0x00000800,
XEX_SYSTEM_XAM_HOOKS = 0x00001000,
XEX_SYSTEM_ACCESS_PII = 0x00002000,
XEX_SYSTEM_CROSS_PLATFORM_SYSTEM_LINK = 0x00004000,
XEX_SYSTEM_MULTIDISC_SWAP = 0x00008000,
XEX_SYSTEM_MULTIDISC_INSECURE_MEDIA = 0x00010000,
XEX_SYSTEM_AP25_MEDIA = 0x00020000,
XEX_SYSTEM_NO_CONFIRM_EXIT = 0x00040000,
XEX_SYSTEM_ALLOW_BACKGROUND_DOWNLOAD = 0x00080000,
XEX_SYSTEM_CREATE_PERSISTABLE_RAMDRIVE = 0x00100000,
XEX_SYSTEM_INHERIT_PERSISTENT_RAMDRIVE = 0x00200000,
XEX_SYSTEM_ALLOW_HUD_VIBRATION = 0x00400000,
XEX_SYSTEM_ACCESS_UTILITY_PARTITIONS = 0x00800000,
XEX_SYSTEM_IPTV_INPUT_SUPPORTED = 0x01000000,
XEX_SYSTEM_PREFER_BIG_BUTTON_INPUT = 0x02000000,
XEX_SYSTEM_ALLOW_EXTENDED_SYSTEM_RESERVATION = 0x04000000,
XEX_SYSTEM_MULTIDISC_CROSS_TITLE = 0x08000000,
XEX_SYSTEM_INSTALL_INCOMPATIBLE = 0x10000000,
XEX_SYSTEM_ALLOW_AVATAR_GET_METADATA_BY_XUID = 0x20000000,
XEX_SYSTEM_ALLOW_CONTROLLER_SWAPPING = 0x40000000,
XEX_SYSTEM_DASH_EXTENSIBILITY_MODULE = 0x80000000,
XEX_SYSTEM_NO_FORCED_REBOOT = 0x00000001,
XEX_SYSTEM_FOREGROUND_TASKS = 0x00000002,
XEX_SYSTEM_NO_ODD_MAPPING = 0x00000004,
XEX_SYSTEM_HANDLE_MCE_INPUT = 0x00000008,
XEX_SYSTEM_RESTRICTED_HUD_FEATURES = 0x00000010,
XEX_SYSTEM_HANDLE_GAMEPAD_DISCONNECT = 0x00000020,
XEX_SYSTEM_INSECURE_SOCKETS = 0x00000040,
XEX_SYSTEM_XBOX1_INTEROPERABILITY = 0x00000080,
XEX_SYSTEM_DASH_CONTEXT = 0x00000100,
XEX_SYSTEM_USES_GAME_VOICE_CHANNEL = 0x00000200,
XEX_SYSTEM_PAL50_INCOMPATIBLE = 0x00000400,
XEX_SYSTEM_INSECURE_UTILITY_DRIVE = 0x00000800,
XEX_SYSTEM_XAM_HOOKS = 0x00001000,
XEX_SYSTEM_ACCESS_PII = 0x00002000,
XEX_SYSTEM_CROSS_PLATFORM_SYSTEM_LINK = 0x00004000,
XEX_SYSTEM_MULTIDISC_SWAP = 0x00008000,
XEX_SYSTEM_MULTIDISC_INSECURE_MEDIA = 0x00010000,
XEX_SYSTEM_AP25_MEDIA = 0x00020000,
XEX_SYSTEM_NO_CONFIRM_EXIT = 0x00040000,
XEX_SYSTEM_ALLOW_BACKGROUND_DOWNLOAD = 0x00080000,
XEX_SYSTEM_CREATE_PERSISTABLE_RAMDRIVE = 0x00100000,
XEX_SYSTEM_INHERIT_PERSISTENT_RAMDRIVE = 0x00200000,
XEX_SYSTEM_ALLOW_HUD_VIBRATION = 0x00400000,
XEX_SYSTEM_ACCESS_UTILITY_PARTITIONS = 0x00800000,
XEX_SYSTEM_IPTV_INPUT_SUPPORTED = 0x01000000,
XEX_SYSTEM_PREFER_BIG_BUTTON_INPUT = 0x02000000,
XEX_SYSTEM_ALLOW_EXTENDED_SYSTEM_RESERVATION = 0x04000000,
XEX_SYSTEM_MULTIDISC_CROSS_TITLE = 0x08000000,
XEX_SYSTEM_INSTALL_INCOMPATIBLE = 0x10000000,
XEX_SYSTEM_ALLOW_AVATAR_GET_METADATA_BY_XUID = 0x20000000,
XEX_SYSTEM_ALLOW_CONTROLLER_SWAPPING = 0x40000000,
XEX_SYSTEM_DASH_EXTENSIBILITY_MODULE = 0x80000000,
// TODO: figure out how stored
/*XEX_SYSTEM_ALLOW_NETWORK_READ_CANCEL = 0x0,
XEX_SYSTEM_UNINTERRUPTABLE_READS = 0x0,
@ -101,198 +101,198 @@ typedef enum {
// ESRB (Entertainment Software Rating Board)
typedef enum {
XEX_RATING_ESRB_eC = 0x00,
XEX_RATING_ESRB_E = 0x02,
XEX_RATING_ESRB_E10 = 0x04,
XEX_RATING_ESRB_T = 0x06,
XEX_RATING_ESRB_M = 0x08,
XEX_RATING_ESRB_AO = 0x0E,
XEX_RATING_ESRB_UNRATED = 0xFF,
XEX_RATING_ESRB_eC = 0x00,
XEX_RATING_ESRB_E = 0x02,
XEX_RATING_ESRB_E10 = 0x04,
XEX_RATING_ESRB_T = 0x06,
XEX_RATING_ESRB_M = 0x08,
XEX_RATING_ESRB_AO = 0x0E,
XEX_RATING_ESRB_UNRATED = 0xFF,
} xe_xex2_rating_esrb_value;
// PEGI (Pan European Game Information)
typedef enum {
XEX_RATING_PEGI_3_PLUS = 0,
XEX_RATING_PEGI_7_PLUS = 4,
XEX_RATING_PEGI_12_PLUS = 9,
XEX_RATING_PEGI_16_PLUS = 13,
XEX_RATING_PEGI_18_PLUS = 14,
XEX_RATING_PEGI_UNRATED = 0xFF,
XEX_RATING_PEGI_3_PLUS = 0,
XEX_RATING_PEGI_7_PLUS = 4,
XEX_RATING_PEGI_12_PLUS = 9,
XEX_RATING_PEGI_16_PLUS = 13,
XEX_RATING_PEGI_18_PLUS = 14,
XEX_RATING_PEGI_UNRATED = 0xFF,
} xe_xex2_rating_pegi_value;
// PEGI (Pan European Game Information) - Finland
typedef enum {
XEX_RATING_PEGI_FI_3_PLUS = 0,
XEX_RATING_PEGI_FI_7_PLUS = 4,
XEX_RATING_PEGI_FI_11_PLUS = 8,
XEX_RATING_PEGI_FI_15_PLUS = 12,
XEX_RATING_PEGI_FI_18_PLUS = 14,
XEX_RATING_PEGI_FI_UNRATED = 0xFF,
XEX_RATING_PEGI_FI_3_PLUS = 0,
XEX_RATING_PEGI_FI_7_PLUS = 4,
XEX_RATING_PEGI_FI_11_PLUS = 8,
XEX_RATING_PEGI_FI_15_PLUS = 12,
XEX_RATING_PEGI_FI_18_PLUS = 14,
XEX_RATING_PEGI_FI_UNRATED = 0xFF,
} xe_xex2_rating_pegi_fi_value;
// PEGI (Pan European Game Information) - Portugal
typedef enum {
XEX_RATING_PEGI_PT_4_PLUS = 1,
XEX_RATING_PEGI_PT_6_PLUS = 3,
XEX_RATING_PEGI_PT_12_PLUS = 9,
XEX_RATING_PEGI_PT_16_PLUS = 13,
XEX_RATING_PEGI_PT_18_PLUS = 14,
XEX_RATING_PEGI_PT_UNRATED = 0xFF,
XEX_RATING_PEGI_PT_4_PLUS = 1,
XEX_RATING_PEGI_PT_6_PLUS = 3,
XEX_RATING_PEGI_PT_12_PLUS = 9,
XEX_RATING_PEGI_PT_16_PLUS = 13,
XEX_RATING_PEGI_PT_18_PLUS = 14,
XEX_RATING_PEGI_PT_UNRATED = 0xFF,
} xe_xex2_rating_pegi_pt_value;
// BBFC (British Board of Film Classification) - UK/Ireland
typedef enum {
XEX_RATING_BBFC_UNIVERSAL = 1,
XEX_RATING_BBFC_PG = 5,
XEX_RATING_BBFC_3_PLUS = 0,
XEX_RATING_BBFC_7_PLUS = 4,
XEX_RATING_BBFC_12_PLUS = 9,
XEX_RATING_BBFC_15_PLUS = 12,
XEX_RATING_BBFC_16_PLUS = 13,
XEX_RATING_BBFC_18_PLUS = 14,
XEX_RATING_BBFC_UNRATED = 0xFF,
XEX_RATING_BBFC_UNIVERSAL = 1,
XEX_RATING_BBFC_PG = 5,
XEX_RATING_BBFC_3_PLUS = 0,
XEX_RATING_BBFC_7_PLUS = 4,
XEX_RATING_BBFC_12_PLUS = 9,
XEX_RATING_BBFC_15_PLUS = 12,
XEX_RATING_BBFC_16_PLUS = 13,
XEX_RATING_BBFC_18_PLUS = 14,
XEX_RATING_BBFC_UNRATED = 0xFF,
} xe_xex2_rating_bbfc_value;
// CERO (Computer Entertainment Rating Organization)
typedef enum {
XEX_RATING_CERO_A = 0,
XEX_RATING_CERO_B = 2,
XEX_RATING_CERO_C = 4,
XEX_RATING_CERO_D = 6,
XEX_RATING_CERO_Z = 8,
XEX_RATING_CERO_UNRATED = 0xFF,
XEX_RATING_CERO_A = 0,
XEX_RATING_CERO_B = 2,
XEX_RATING_CERO_C = 4,
XEX_RATING_CERO_D = 6,
XEX_RATING_CERO_Z = 8,
XEX_RATING_CERO_UNRATED = 0xFF,
} xe_xex2_rating_cero_value;
// USK (Unterhaltungssoftware SelbstKontrolle)
typedef enum {
XEX_RATING_USK_ALL = 0,
XEX_RATING_USK_6_PLUS = 2,
XEX_RATING_USK_12_PLUS = 4,
XEX_RATING_USK_16_PLUS = 6,
XEX_RATING_USK_18_PLUS = 8,
XEX_RATING_USK_UNRATED = 0xFF,
XEX_RATING_USK_ALL = 0,
XEX_RATING_USK_6_PLUS = 2,
XEX_RATING_USK_12_PLUS = 4,
XEX_RATING_USK_16_PLUS = 6,
XEX_RATING_USK_18_PLUS = 8,
XEX_RATING_USK_UNRATED = 0xFF,
} xe_xex2_rating_usk_value;
// OFLC (Office of Film and Literature Classification) - Australia
typedef enum {
XEX_RATING_OFLC_AU_G = 0,
XEX_RATING_OFLC_AU_PG = 2,
XEX_RATING_OFLC_AU_M = 4,
XEX_RATING_OFLC_AU_MA15_PLUS = 6,
XEX_RATING_OFLC_AU_UNRATED = 0xFF,
XEX_RATING_OFLC_AU_G = 0,
XEX_RATING_OFLC_AU_PG = 2,
XEX_RATING_OFLC_AU_M = 4,
XEX_RATING_OFLC_AU_MA15_PLUS = 6,
XEX_RATING_OFLC_AU_UNRATED = 0xFF,
} xe_xex2_rating_oflc_au_value;
// OFLC (Office of Film and Literature Classification) - New Zealand
typedef enum {
XEX_RATING_OFLC_NZ_G = 0,
XEX_RATING_OFLC_NZ_PG = 2,
XEX_RATING_OFLC_NZ_M = 4,
XEX_RATING_OFLC_NZ_MA15_PLUS = 6,
XEX_RATING_OFLC_NZ_UNRATED = 0xFF,
XEX_RATING_OFLC_NZ_G = 0,
XEX_RATING_OFLC_NZ_PG = 2,
XEX_RATING_OFLC_NZ_M = 4,
XEX_RATING_OFLC_NZ_MA15_PLUS = 6,
XEX_RATING_OFLC_NZ_UNRATED = 0xFF,
} xe_xex2_rating_oflc_nz_value;
// KMRB (Korea Media Rating Board)
typedef enum {
XEX_RATING_KMRB_ALL = 0,
XEX_RATING_KMRB_12_PLUS = 2,
XEX_RATING_KMRB_15_PLUS = 4,
XEX_RATING_KMRB_18_PLUS = 6,
XEX_RATING_KMRB_UNRATED = 0xFF,
XEX_RATING_KMRB_ALL = 0,
XEX_RATING_KMRB_12_PLUS = 2,
XEX_RATING_KMRB_15_PLUS = 4,
XEX_RATING_KMRB_18_PLUS = 6,
XEX_RATING_KMRB_UNRATED = 0xFF,
} xe_xex2_rating_kmrb_value;
// Brazil
typedef enum {
XEX_RATING_BRAZIL_ALL = 0,
XEX_RATING_BRAZIL_12_PLUS = 2,
XEX_RATING_BRAZIL_14_PLUS = 4,
XEX_RATING_BRAZIL_16_PLUS = 5,
XEX_RATING_BRAZIL_18_PLUS = 8,
XEX_RATING_BRAZIL_UNRATED = 0xFF,
XEX_RATING_BRAZIL_ALL = 0,
XEX_RATING_BRAZIL_12_PLUS = 2,
XEX_RATING_BRAZIL_14_PLUS = 4,
XEX_RATING_BRAZIL_16_PLUS = 5,
XEX_RATING_BRAZIL_18_PLUS = 8,
XEX_RATING_BRAZIL_UNRATED = 0xFF,
} xe_xex2_rating_brazil_value;
// FPB (Film and Publication Board)
typedef enum {
XEX_RATING_FPB_ALL = 0,
XEX_RATING_FPB_PG = 6,
XEX_RATING_FPB_10_PLUS = 7,
XEX_RATING_FPB_13_PLUS = 10,
XEX_RATING_FPB_16_PLUS = 13,
XEX_RATING_FPB_18_PLUS = 14,
XEX_RATING_FPB_UNRATED = 0xFF,
XEX_RATING_FPB_ALL = 0,
XEX_RATING_FPB_PG = 6,
XEX_RATING_FPB_10_PLUS = 7,
XEX_RATING_FPB_13_PLUS = 10,
XEX_RATING_FPB_16_PLUS = 13,
XEX_RATING_FPB_18_PLUS = 14,
XEX_RATING_FPB_UNRATED = 0xFF,
} xe_xex2_rating_fpb_value;
typedef struct {
xe_xex2_rating_esrb_value esrb;
xe_xex2_rating_pegi_value pegi;
xe_xex2_rating_pegi_fi_value pegifi;
xe_xex2_rating_pegi_pt_value pegipt;
xe_xex2_rating_bbfc_value bbfc;
xe_xex2_rating_cero_value cero;
xe_xex2_rating_usk_value usk;
xe_xex2_rating_oflc_au_value oflcau;
xe_xex2_rating_oflc_nz_value oflcnz;
xe_xex2_rating_kmrb_value kmrb;
xe_xex2_rating_brazil_value brazil;
xe_xex2_rating_fpb_value fpb;
xe_xex2_rating_esrb_value esrb;
xe_xex2_rating_pegi_value pegi;
xe_xex2_rating_pegi_fi_value pegifi;
xe_xex2_rating_pegi_pt_value pegipt;
xe_xex2_rating_bbfc_value bbfc;
xe_xex2_rating_cero_value cero;
xe_xex2_rating_usk_value usk;
xe_xex2_rating_oflc_au_value oflcau;
xe_xex2_rating_oflc_nz_value oflcnz;
xe_xex2_rating_kmrb_value kmrb;
xe_xex2_rating_brazil_value brazil;
xe_xex2_rating_fpb_value fpb;
} xe_xex2_game_ratings_t;
typedef union {
uint32_t value;
uint32_t value;
struct {
uint32_t major : 4;
uint32_t minor : 4;
uint32_t build : 16;
uint32_t qfe : 8;
uint32_t major : 4;
uint32_t minor : 4;
uint32_t build : 16;
uint32_t qfe : 8;
};
} xe_xex2_version_t;
typedef struct {
uint32_t key;
uint32_t length;
uint32_t key;
uint32_t length;
union {
uint32_t value;
uint32_t offset;
uint32_t value;
uint32_t offset;
};
} xe_xex2_opt_header_t;
typedef struct {
char name[9];
uint32_t address;
uint32_t size;
char name[9];
uint32_t address;
uint32_t size;
} xe_xex2_resource_info_t;
typedef struct {
uint32_t media_id;
xe_xex2_version_t version;
xe_xex2_version_t base_version;
uint32_t title_id;
uint8_t platform;
uint8_t executable_table;
uint8_t disc_number;
uint8_t disc_count;
uint32_t savegame_id;
uint32_t media_id;
xe_xex2_version_t version;
xe_xex2_version_t base_version;
uint32_t title_id;
uint8_t platform;
uint8_t executable_table;
uint8_t disc_number;
uint8_t disc_count;
uint32_t savegame_id;
} xe_xex2_execution_info_t;
typedef struct {
uint32_t slot_count;
uint32_t raw_data_address;
uint32_t data_size;
uint32_t raw_data_size;
uint32_t slot_count;
uint32_t raw_data_address;
uint32_t data_size;
uint32_t raw_data_size;
} xe_xex2_tls_info_t;
typedef struct {
char name[32];
uint8_t digest[20];
uint32_t import_id;
xe_xex2_version_t version;
xe_xex2_version_t min_version;
size_t record_count;
uint32_t *records;
char name[32];
uint8_t digest[20];
uint32_t import_id;
xe_xex2_version_t version;
xe_xex2_version_t min_version;
size_t record_count;
uint32_t* records;
} xe_xex2_import_library_t;
typedef enum {
XEX_APPROVAL_UNAPPROVED = 0,
XEX_APPROVAL_POSSIBLE = 1,
XEX_APPROVAL_APPROVED = 2,
XEX_APPROVAL_EXPIRED = 3,
XEX_APPROVAL_UNAPPROVED = 0,
XEX_APPROVAL_POSSIBLE = 1,
XEX_APPROVAL_APPROVED = 2,
XEX_APPROVAL_EXPIRED = 3,
} xe_xex2_approval_type;
typedef struct {
char name[9]; // 8 + 1 for \0
uint16_t major;
uint16_t minor;
uint16_t build;
uint16_t qfe;
xe_xex2_approval_type approval;
char name[9]; // 8 + 1 for \0
uint16_t major;
uint16_t minor;
uint16_t build;
uint16_t qfe;
xe_xex2_approval_type approval;
} xe_xex2_static_library_t;
// credits: some obscure pastebin (http://pastebin.com/ZRvr3Sgj)
@ -300,170 +300,171 @@ typedef struct {
uint32_t magic[3];
uint32_t modulenumber[2];
uint32_t version[3];
uint32_t imagebaseaddr; // must be <<16 to be accurate
uint32_t imagebaseaddr; // must be <<16 to be accurate
uint32_t count;
uint32_t base;
uint32_t ordOffset[1]; // ordOffset[0] + (imagebaseaddr << 16) = function offset of ordinal 1
uint32_t ordOffset[1]; // ordOffset[0] + (imagebaseaddr << 16) = function
// offset of ordinal 1
} xe_xex2_export_table;
typedef enum {
XEX_ENCRYPTION_NONE = 0,
XEX_ENCRYPTION_NORMAL = 1,
XEX_ENCRYPTION_NONE = 0,
XEX_ENCRYPTION_NORMAL = 1,
} xe_xex2_encryption_type;
typedef enum {
XEX_COMPRESSION_NONE = 0,
XEX_COMPRESSION_BASIC = 1,
XEX_COMPRESSION_NORMAL = 2,
XEX_COMPRESSION_DELTA = 3,
XEX_COMPRESSION_NONE = 0,
XEX_COMPRESSION_BASIC = 1,
XEX_COMPRESSION_NORMAL = 2,
XEX_COMPRESSION_DELTA = 3,
} xe_xex2_compression_type;
typedef struct {
uint32_t data_size;
uint32_t zero_size;
uint32_t data_size;
uint32_t zero_size;
} xe_xex2_file_basic_compression_block_t;
typedef struct {
uint32_t block_count;
xe_xex2_file_basic_compression_block_t *blocks;
uint32_t block_count;
xe_xex2_file_basic_compression_block_t* blocks;
} xe_xex2_file_basic_compression_info_t;
typedef struct {
uint32_t window_size;
uint32_t window_bits;
uint32_t block_size;
uint8_t block_hash[20];
uint32_t window_size;
uint32_t window_bits;
uint32_t block_size;
uint8_t block_hash[20];
} xe_xex2_file_normal_compression_info_t;
typedef struct {
xe_xex2_encryption_type encryption_type;
xe_xex2_compression_type compression_type;
xe_xex2_encryption_type encryption_type;
xe_xex2_compression_type compression_type;
union {
xe_xex2_file_basic_compression_info_t basic;
xe_xex2_file_normal_compression_info_t normal;
xe_xex2_file_basic_compression_info_t basic;
xe_xex2_file_normal_compression_info_t normal;
} compression_info;
} xe_xex2_file_format_info_t;
typedef enum {
XEX_IMAGE_MANUFACTURING_UTILITY = 0x00000002,
XEX_IMAGE_MANUFACTURING_SUPPORT_TOOLS = 0x00000004,
XEX_IMAGE_XGD2_MEDIA_ONLY = 0x00000008,
XEX_IMAGE_CARDEA_KEY = 0x00000100,
XEX_IMAGE_XEIKA_KEY = 0x00000200,
XEX_IMAGE_USERMODE_TITLE = 0x00000400,
XEX_IMAGE_USERMODE_SYSTEM = 0x00000800,
XEX_IMAGE_ORANGE0 = 0x00001000,
XEX_IMAGE_ORANGE1 = 0x00002000,
XEX_IMAGE_ORANGE2 = 0x00004000,
XEX_IMAGE_IPTV_SIGNUP_APPLICATION = 0x00010000,
XEX_IMAGE_IPTV_TITLE_APPLICATION = 0x00020000,
XEX_IMAGE_KEYVAULT_PRIVILEGES_REQUIRED = 0x04000000,
XEX_IMAGE_ONLINE_ACTIVATION_REQUIRED = 0x08000000,
XEX_IMAGE_PAGE_SIZE_4KB = 0x10000000, // else 64KB
XEX_IMAGE_REGION_FREE = 0x20000000,
XEX_IMAGE_REVOCATION_CHECK_OPTIONAL = 0x40000000,
XEX_IMAGE_REVOCATION_CHECK_REQUIRED = 0x80000000,
XEX_IMAGE_MANUFACTURING_UTILITY = 0x00000002,
XEX_IMAGE_MANUFACTURING_SUPPORT_TOOLS = 0x00000004,
XEX_IMAGE_XGD2_MEDIA_ONLY = 0x00000008,
XEX_IMAGE_CARDEA_KEY = 0x00000100,
XEX_IMAGE_XEIKA_KEY = 0x00000200,
XEX_IMAGE_USERMODE_TITLE = 0x00000400,
XEX_IMAGE_USERMODE_SYSTEM = 0x00000800,
XEX_IMAGE_ORANGE0 = 0x00001000,
XEX_IMAGE_ORANGE1 = 0x00002000,
XEX_IMAGE_ORANGE2 = 0x00004000,
XEX_IMAGE_IPTV_SIGNUP_APPLICATION = 0x00010000,
XEX_IMAGE_IPTV_TITLE_APPLICATION = 0x00020000,
XEX_IMAGE_KEYVAULT_PRIVILEGES_REQUIRED = 0x04000000,
XEX_IMAGE_ONLINE_ACTIVATION_REQUIRED = 0x08000000,
XEX_IMAGE_PAGE_SIZE_4KB = 0x10000000, // else 64KB
XEX_IMAGE_REGION_FREE = 0x20000000,
XEX_IMAGE_REVOCATION_CHECK_OPTIONAL = 0x40000000,
XEX_IMAGE_REVOCATION_CHECK_REQUIRED = 0x80000000,
} xe_xex2_image_flags;
typedef enum {
XEX_MEDIA_HARDDISK = 0x00000001,
XEX_MEDIA_DVD_X2 = 0x00000002,
XEX_MEDIA_DVD_CD = 0x00000004,
XEX_MEDIA_DVD_5 = 0x00000008,
XEX_MEDIA_DVD_9 = 0x00000010,
XEX_MEDIA_SYSTEM_FLASH = 0x00000020,
XEX_MEDIA_MEMORY_UNIT = 0x00000080,
XEX_MEDIA_USB_MASS_STORAGE_DEVICE = 0x00000100,
XEX_MEDIA_NETWORK = 0x00000200,
XEX_MEDIA_DIRECT_FROM_MEMORY = 0x00000400,
XEX_MEDIA_RAM_DRIVE = 0x00000800,
XEX_MEDIA_SVOD = 0x00001000,
XEX_MEDIA_INSECURE_PACKAGE = 0x01000000,
XEX_MEDIA_SAVEGAME_PACKAGE = 0x02000000,
XEX_MEDIA_LOCALLY_SIGNED_PACKAGE = 0x04000000,
XEX_MEDIA_LIVE_SIGNED_PACKAGE = 0x08000000,
XEX_MEDIA_XBOX_PACKAGE = 0x10000000,
XEX_MEDIA_HARDDISK = 0x00000001,
XEX_MEDIA_DVD_X2 = 0x00000002,
XEX_MEDIA_DVD_CD = 0x00000004,
XEX_MEDIA_DVD_5 = 0x00000008,
XEX_MEDIA_DVD_9 = 0x00000010,
XEX_MEDIA_SYSTEM_FLASH = 0x00000020,
XEX_MEDIA_MEMORY_UNIT = 0x00000080,
XEX_MEDIA_USB_MASS_STORAGE_DEVICE = 0x00000100,
XEX_MEDIA_NETWORK = 0x00000200,
XEX_MEDIA_DIRECT_FROM_MEMORY = 0x00000400,
XEX_MEDIA_RAM_DRIVE = 0x00000800,
XEX_MEDIA_SVOD = 0x00001000,
XEX_MEDIA_INSECURE_PACKAGE = 0x01000000,
XEX_MEDIA_SAVEGAME_PACKAGE = 0x02000000,
XEX_MEDIA_LOCALLY_SIGNED_PACKAGE = 0x04000000,
XEX_MEDIA_LIVE_SIGNED_PACKAGE = 0x08000000,
XEX_MEDIA_XBOX_PACKAGE = 0x10000000,
} xe_xex2_media_flags;
typedef enum {
XEX_REGION_NTSCU = 0x000000FF,
XEX_REGION_NTSCJ = 0x0000FF00,
XEX_REGION_NTSCJ_JAPAN = 0x00000100,
XEX_REGION_NTSCJ_CHINA = 0x00000200,
XEX_REGION_PAL = 0x00FF0000,
XEX_REGION_PAL_AU_NZ = 0x00010000,
XEX_REGION_OTHER = 0xFF000000,
XEX_REGION_ALL = 0xFFFFFFFF,
XEX_REGION_NTSCU = 0x000000FF,
XEX_REGION_NTSCJ = 0x0000FF00,
XEX_REGION_NTSCJ_JAPAN = 0x00000100,
XEX_REGION_NTSCJ_CHINA = 0x00000200,
XEX_REGION_PAL = 0x00FF0000,
XEX_REGION_PAL_AU_NZ = 0x00010000,
XEX_REGION_OTHER = 0xFF000000,
XEX_REGION_ALL = 0xFFFFFFFF,
} xe_xex2_region_flags;
typedef struct {
uint32_t header_size;
uint32_t image_size;
uint8_t rsa_signature[256];
uint32_t unklength;
xe_xex2_image_flags image_flags;
uint32_t load_address;
uint8_t section_digest[20];
uint32_t import_table_count;
uint8_t import_table_digest[20];
uint8_t media_id[16];
uint8_t file_key[16];
uint32_t export_table; // address of the export table
uint8_t header_digest[20];
xe_xex2_region_flags game_regions;
xe_xex2_media_flags media_flags;
uint32_t header_size;
uint32_t image_size;
uint8_t rsa_signature[256];
uint32_t unklength;
xe_xex2_image_flags image_flags;
uint32_t load_address;
uint8_t section_digest[20];
uint32_t import_table_count;
uint8_t import_table_digest[20];
uint8_t media_id[16];
uint8_t file_key[16];
uint32_t export_table; // address of the export table
uint8_t header_digest[20];
xe_xex2_region_flags game_regions;
xe_xex2_media_flags media_flags;
} xe_xex2_loader_info_t;
typedef enum {
XEX_SECTION_CODE = 1,
XEX_SECTION_DATA = 2,
XEX_SECTION_READONLY_DATA = 3,
XEX_SECTION_CODE = 1,
XEX_SECTION_DATA = 2,
XEX_SECTION_READONLY_DATA = 3,
} xe_xex2_section_type;
typedef struct {
uint32_t page_size;
union {
struct {
xe_xex2_section_type type : 4;
uint32_t page_count : 28; // # of pages
xe_xex2_section_type type : 4;
uint32_t page_count : 28; // # of pages
};
uint32_t value; // To make uint8_t swapping easier
uint32_t value; // To make uint8_t swapping easier
} info;
uint8_t digest[20];
} xe_xex2_section_t;
typedef struct {
uint32_t xex2;
xe_xex2_module_flags module_flags;
uint32_t exe_offset;
uint32_t unknown0;
uint32_t certificate_offset;
uint32_t xex2;
xe_xex2_module_flags module_flags;
uint32_t exe_offset;
uint32_t unknown0;
uint32_t certificate_offset;
xe_xex2_system_flags system_flags;
xe_xex2_execution_info_t execution_info;
xe_xex2_game_ratings_t game_ratings;
xe_xex2_tls_info_t tls_info;
size_t import_library_count;
xe_xex2_import_library_t import_libraries[32];
uint32_t pe_export_table_offset; // PE Export Directory
size_t static_library_count;
xe_xex2_static_library_t static_libraries[32];
xe_xex2_file_format_info_t file_format_info;
xe_xex2_loader_info_t loader_info;
uint8_t session_key[16];
xe_xex2_system_flags system_flags;
xe_xex2_execution_info_t execution_info;
xe_xex2_game_ratings_t game_ratings;
xe_xex2_tls_info_t tls_info;
size_t import_library_count;
xe_xex2_import_library_t import_libraries[32];
uint32_t pe_export_table_offset; // PE Export Directory
size_t static_library_count;
xe_xex2_static_library_t static_libraries[32];
xe_xex2_file_format_info_t file_format_info;
xe_xex2_loader_info_t loader_info;
uint8_t session_key[16];
uint32_t exe_address;
uint32_t exe_entry_point;
uint32_t exe_stack_size;
uint32_t exe_heap_size;
uint32_t exe_address;
uint32_t exe_entry_point;
uint32_t exe_stack_size;
uint32_t exe_heap_size;
size_t header_count;
xe_xex2_opt_header_t headers[64];
size_t header_count;
xe_xex2_opt_header_t headers[64];
size_t resource_info_count;
xe_xex2_resource_info_t* resource_infos;
size_t section_count;
xe_xex2_section_t* sections;
size_t resource_info_count;
xe_xex2_resource_info_t* resource_infos;
size_t section_count;
xe_xex2_section_t* sections;
} xe_xex2_header_t;
#endif // XENIA_KERNEL_XEX2_INFO_H_

View File

@ -35,11 +35,11 @@ enum {
// https://github.com/pmrowla/hl2sdk-csgo/blob/master/common/xbox/xboxstubs.h
typedef struct {
// FYI: IN_ADDR should be in network-byte order.
IN_ADDR ina; // IP address (zero if not static/DHCP)
IN_ADDR inaOnline; // Online IP address (zero if not online)
xe::be<uint16_t> wPortOnline; // Online port
uint8_t abEnet[6]; // Ethernet MAC address
uint8_t abOnline[20]; // Online identification
IN_ADDR ina; // IP address (zero if not static/DHCP)
IN_ADDR inaOnline; // Online IP address (zero if not online)
xe::be<uint16_t> wPortOnline; // Online port
uint8_t abEnet[6]; // Ethernet MAC address
uint8_t abOnline[20]; // Online identification
} XNADDR;
void LoadSockaddr(const uint8_t* ptr, sockaddr* out_addr) {
@ -208,23 +208,23 @@ SHIM_CALL NetDll_WSAGetLastError_shim(PPCContext* ppc_context,
struct XnAddrStatus {
// Address acquisition is not yet complete
const static uint32_t XNET_GET_XNADDR_PENDING = 0x00000000;
const static uint32_t XNET_GET_XNADDR_PENDING = 0x00000000;
// XNet is uninitialized or no debugger found
const static uint32_t XNET_GET_XNADDR_NONE = 0x00000001;
const static uint32_t XNET_GET_XNADDR_NONE = 0x00000001;
// Host has ethernet address (no IP address)
const static uint32_t XNET_GET_XNADDR_ETHERNET = 0x00000002;
const static uint32_t XNET_GET_XNADDR_ETHERNET = 0x00000002;
// Host has statically assigned IP address
const static uint32_t XNET_GET_XNADDR_STATIC = 0x00000004;
const static uint32_t XNET_GET_XNADDR_STATIC = 0x00000004;
// Host has DHCP assigned IP address
const static uint32_t XNET_GET_XNADDR_DHCP = 0x00000008;
const static uint32_t XNET_GET_XNADDR_DHCP = 0x00000008;
// Host has PPPoE assigned IP address
const static uint32_t XNET_GET_XNADDR_PPPOE = 0x00000010;
const static uint32_t XNET_GET_XNADDR_PPPOE = 0x00000010;
// Host has one or more gateways configured
const static uint32_t XNET_GET_XNADDR_GATEWAY = 0x00000020;
const static uint32_t XNET_GET_XNADDR_GATEWAY = 0x00000020;
// Host has one or more DNS servers configured
const static uint32_t XNET_GET_XNADDR_DNS = 0x00000040;
const static uint32_t XNET_GET_XNADDR_DNS = 0x00000040;
// Host is currently connected to online service
const static uint32_t XNET_GET_XNADDR_ONLINE = 0x00000080;
const static uint32_t XNET_GET_XNADDR_ONLINE = 0x00000080;
// Network configuration requires troubleshooting
const static uint32_t XNET_GET_XNADDR_TROUBLESHOOT = 0x00008000;
};
@ -563,8 +563,8 @@ SHIM_CALL NetDll_sendto_shim(PPCContext* ppc_context,
uint32_t to_ptr = SHIM_GET_ARG_32(5);
uint32_t tolen = SHIM_GET_ARG_32(6);
XELOGD("NetDll_sendto(%d, %.8X, %.8X, %d, %d, %.8X, %d)", caller, socket_handle,
buf_ptr, len, flags, to_ptr, tolen);
XELOGD("NetDll_sendto(%d, %.8X, %.8X, %d, %d, %.8X, %d)", caller,
socket_handle, buf_ptr, len, flags, to_ptr, tolen);
sockaddr to;
LoadSockaddr(SHIM_MEM_ADDR(to_ptr), &to);

View File

@ -214,7 +214,8 @@ SHIM_CALL XamUserReadProfileSettings_shim(PPCContext* ppc_context,
out_header->setting_count = setting_count;
out_header->settings_ptr = buffer_ptr + 8;
auto out_setting = (X_USER_READ_PROFILE_SETTING*)SHIM_MEM_ADDR(out_header->settings_ptr);
auto out_setting =
(X_USER_READ_PROFILE_SETTING*)SHIM_MEM_ADDR(out_header->settings_ptr);
size_t buffer_offset = base_size_needed;
for (uint32_t n = 0; n < setting_count; ++n) {
@ -227,10 +228,12 @@ SHIM_CALL XamUserReadProfileSettings_shim(PPCContext* ppc_context,
out_setting->setting_id = setting_id;
if (setting) {
buffer_offset = setting->Append(&out_setting->setting_data[0],
SHIM_MEM_ADDR(buffer_ptr), buffer_ptr, buffer_offset);
buffer_offset =
setting->Append(&out_setting->setting_data[0],
SHIM_MEM_ADDR(buffer_ptr), buffer_ptr, buffer_offset);
} /*else {
std::memset(&out_setting->setting_data[0], 0, sizeof(out_setting->setting_data));
std::memset(&out_setting->setting_data[0], 0,
sizeof(out_setting->setting_data));
}*/
++out_setting;
}

View File

@ -132,9 +132,11 @@ SHIM_CALL XMAInitializeContext_shim(PPCContext* ppc_context,
auto context_init = (XMA_CONTEXT_INIT*)SHIM_MEM_ADDR(context_init_ptr);
context.input_buffer_0_ptr = context_init->input_buffer_0_ptr;
context.input_buffer_0_packet_count = context_init->input_buffer_0_packet_count;
context.input_buffer_0_packet_count =
context_init->input_buffer_0_packet_count;
context.input_buffer_1_ptr = context_init->input_buffer_1_ptr;
context.input_buffer_1_packet_count = context_init->input_buffer_1_packet_count;
context.input_buffer_1_packet_count =
context_init->input_buffer_1_packet_count;
context.input_buffer_read_offset = context_init->input_buffer_read_offset;
context.output_buffer_ptr = context_init->output_buffer_ptr;
context.output_buffer_block_count = context_init->output_buffer_block_count;

View File

@ -17,9 +17,9 @@ namespace xe {
namespace kernel {
typedef struct {
xe::be<DWORD> count;
xe::be<DWORD> state[5];
xe::be<BYTE> buffer[64];
xe::be<DWORD> count;
xe::be<DWORD> state[5];
xe::be<BYTE> buffer[64];
} XECRYPT_SHA_STATE;
void XeCryptShaInit(pointer_t<XECRYPT_SHA_STATE> sha_state) {
@ -27,20 +27,16 @@ void XeCryptShaInit(pointer_t<XECRYPT_SHA_STATE> sha_state) {
}
DECLARE_XBOXKRNL_EXPORT(XeCryptShaInit, ExportTag::kStub);
void XeCryptShaUpdate(pointer_t<XECRYPT_SHA_STATE> sha_state,
lpvoid_t input, dword_t input_size) {
}
void XeCryptShaUpdate(pointer_t<XECRYPT_SHA_STATE> sha_state, lpvoid_t input,
dword_t input_size) {}
DECLARE_XBOXKRNL_EXPORT(XeCryptShaUpdate, ExportTag::kStub);
void XeCryptShaFinal(pointer_t<XECRYPT_SHA_STATE> sha_state, lpvoid_t out,
dword_t out_size) {
}
dword_t out_size) {}
DECLARE_XBOXKRNL_EXPORT(XeCryptShaFinal, ExportTag::kStub);
void xe::kernel::xboxkrnl::RegisterCryptExports(
xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {}
} // namespace kernel
} // namespace xe
} // namespace kernel
} // namespace xe

View File

@ -477,11 +477,9 @@ struct X_IO_STATUS_BLOCK {
xe::be<uint32_t> information;
};
dword_result_t NtQueryInformationFile(dword_t file_handle,
pointer_t<X_IO_STATUS_BLOCK>
io_status_block_ptr,
lpvoid_t file_info_ptr, dword_t length,
dword_t file_info_class) {
dword_result_t NtQueryInformationFile(
dword_t file_handle, pointer_t<X_IO_STATUS_BLOCK> io_status_block_ptr,
lpvoid_t file_info_ptr, dword_t length, dword_t file_info_class) {
X_STATUS result = X_STATUS_SUCCESS;
uint32_t info = 0;
@ -567,13 +565,13 @@ dword_result_t NtQueryInformationFile(dword_t file_handle,
if (io_status_block_ptr) {
io_status_block_ptr->status = result;
io_status_block_ptr->information = info; // # bytes written
io_status_block_ptr->information = info; // # bytes written
}
return result;
}
DECLARE_XBOXKRNL_EXPORT(NtQueryInformationFile, ExportTag::kImplemented |
ExportTag::kFileSystem);
DECLARE_XBOXKRNL_EXPORT(NtQueryInformationFile,
ExportTag::kImplemented | ExportTag::kFileSystem);
SHIM_CALL NtQueryFullAttributesFile_shim(PPCContext* ppc_context,
KernelState* kernel_state) {

View File

@ -549,7 +549,8 @@ SHIM_CALL KeUnlockL2_shim(PPCContext* ppc_context, KernelState* kernel_state) {
XELOGD("KeUnlockL2(?)");
}
SHIM_CALL MmCreateKernelStack_shim(PPCContext* ppc_context, KernelState* kernel_state) {
SHIM_CALL MmCreateKernelStack_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
auto stack_size = SHIM_GET_ARG_32(0);
auto unk1 = SHIM_GET_ARG_32(1);
@ -562,13 +563,14 @@ SHIM_CALL MmCreateKernelStack_shim(PPCContext* ppc_context, KernelState* kernel_
kernel_state->memory()
->LookupHeap(0x70000000)
->AllocRange(0x70000000, 0x7FFFFFFF, stack_size, stack_alignment,
kMemoryAllocationReserve | kMemoryAllocationCommit,
kMemoryProtectRead | kMemoryProtectWrite, false,
&stack_address);
kMemoryAllocationReserve | kMemoryAllocationCommit,
kMemoryProtectRead | kMemoryProtectWrite, false,
&stack_address);
SHIM_SET_RETURN_32(stack_address + stack_size);
}
SHIM_CALL MmDeleteKernelStack_shim(PPCContext* ppc_context, KernelState* kernel_state) {
SHIM_CALL MmDeleteKernelStack_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
auto unk0 = SHIM_GET_ARG_32(0);
auto unk1 = SHIM_GET_ARG_32(1);

View File

@ -486,12 +486,14 @@ SHIM_CALL NtCreateEvent_shim(PPCContext* ppc_context,
SHIM_SET_RETURN_32(X_STATUS_SUCCESS);
}
SHIM_CALL KeInitializeEvent_shim(PPCContext* ppc_context, KernelState* kernel_state) {
SHIM_CALL KeInitializeEvent_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
uint32_t handle_ptr = SHIM_GET_ARG_32(0);
uint32_t event_type = SHIM_GET_ARG_32(1);
uint32_t initial_state = SHIM_GET_ARG_32(2);
XELOGD("KeInitializeEvent(%.8X, %.8X, %.8X)", handle_ptr, event_type, initial_state);
XELOGD("KeInitializeEvent(%.8X, %.8X, %.8X)", handle_ptr, event_type,
initial_state);
XEvent* ev = new XEvent(kernel_state);
ev->Initialize(!event_type, !!initial_state);
@ -876,13 +878,12 @@ SHIM_CALL KeWaitForSingleObject_shim(PPCContext* ppc_context,
object_ref<XObject> object;
if (object_ptr < 0x1000) {
// They passed in a handle (for some reason)
object = kernel_state->object_table()->LookupObject<XObject>(object_ptr);
// They passed in a handle (for some reason)
object = kernel_state->object_table()->LookupObject<XObject>(object_ptr);
// Log it in case this is the source of any problems in the future
XELOGD("KeWaitForSingleObject - Interpreting object ptr as handle!");
}
else {
// Log it in case this is the source of any problems in the future
XELOGD("KeWaitForSingleObject - Interpreting object ptr as handle!");
} else {
object = XObject::GetNativeObject<XObject>(kernel_state,
SHIM_MEM_ADDR(object_ptr));
}

View File

@ -83,20 +83,22 @@ void VdGetCurrentDisplayInformation(pointer_t<X_DISPLAY_INFO> display_info) {
display_info->unk02 = (xe::be<uint16_t>)mode.display_height;
display_info->unk08 = 0;
display_info->unk0C = 0;
display_info->unk10 = mode.display_width; // backbuffer width?
display_info->unk14 = mode.display_height; // backbuffer height?
display_info->unk10 = mode.display_width; // backbuffer width?
display_info->unk14 = mode.display_height; // backbuffer height?
display_info->unk18 = mode.display_width;
display_info->unk1C = mode.display_height;
display_info->unk20 = 1;
display_info->unk30 = 1;
display_info->unk40 = 320; // display_width / 4?
display_info->unk42 = 180; // display_height / 4?
display_info->unk40 = 320; // display_width / 4?
display_info->unk42 = 180; // display_height / 4?
display_info->unk44 = 320;
display_info->unk46 = 180;
display_info->unk48 = (xe::be<uint16_t>)mode.display_width; // actual display size?
display_info->unk4A = (xe::be<uint16_t>)mode.display_height; // actual display size?
display_info->unk48 =
(xe::be<uint16_t>)mode.display_width; // actual display size?
display_info->unk4A =
(xe::be<uint16_t>)mode.display_height; // actual display size?
display_info->unk4C = mode.refresh_rate;
display_info->unk56 = (xe::be<uint16_t>)mode.display_width; // display width
display_info->unk56 = (xe::be<uint16_t>)mode.display_width; // display width
}
DECLARE_XBOXKRNL_EXPORT(VdGetCurrentDisplayInformation, ExportTag::kVideo);
@ -324,10 +326,8 @@ void VdSwap(lpvoid_t buffer_ptr, // ptr into primary ringbuffer
lpunknown_t unk3, // buffer from VdGetSystemCommandBuffer
lpunknown_t unk4, // from VdGetSystemCommandBuffer (0xBEEF0001)
lpdword_t frontbuffer_ptr, // ptr to frontbuffer address
lpdword_t color_format_ptr,
lpdword_t color_space_ptr,
lpunknown_t unk8,
unknown_t unk9) {
lpdword_t color_format_ptr, lpdword_t color_space_ptr,
lpunknown_t unk8, unknown_t unk9) {
gpu::xenos::xe_gpu_texture_fetch_t fetch;
xe::copy_and_swap_32_unaligned(
reinterpret_cast<uint32_t*>(&fetch),

View File

@ -67,7 +67,7 @@ struct X_OBJECT_HEADER {
uint8_t quota_info_offset;
uint8_t flags;
union {
xe::be<uint32_t> object_create_info; // X_OBJECT_CREATE_INFORMATION
xe::be<uint32_t> object_create_info; // X_OBJECT_CREATE_INFORMATION
xe::be<uint32_t> quota_block_charged;
};
xe::be<uint32_t> security_descriptor;

View File

@ -182,7 +182,8 @@ int Memory::Initialize() {
heaps_.v00000000.AllocFixed(
0x00000000, 4096, 4096,
kMemoryAllocationReserve | kMemoryAllocationCommit,
!FLAGS_protect_zero ? kMemoryProtectRead | kMemoryProtectWrite : kMemoryProtectNoAccess);
!FLAGS_protect_zero ? kMemoryProtectRead | kMemoryProtectWrite
: kMemoryProtectNoAccess);
// GPU writeback.
// 0xC... is physical, 0x7F... is virtual. We may need to overlay these.
@ -771,7 +772,7 @@ bool BaseHeap::AllocRange(uint32_t low_address, uint32_t high_address,
page_entry.state = kMemoryAllocationReserve | allocation_type;
}
*out_address = heap_base_ + start_page_number * page_size_;
*out_address = heap_base_ + start_page_number* page_size_;
return true;
}
@ -818,7 +819,7 @@ bool BaseHeap::Release(uint32_t base_address, uint32_t* out_region_size) {
}
if (out_region_size) {
*out_region_size = base_page_entry.region_page_count * page_size_;
*out_region_size = base_page_entry.region_page_count* page_size_;
}
// Release from host not needed as mapping reserves the range for us.
@ -968,7 +969,7 @@ bool BaseHeap::QuerySize(uint32_t address, uint32_t* out_size) {
}
std::lock_guard<xe::recursive_mutex> lock(heap_mutex_);
auto page_entry = page_table_[page_number];
*out_size = page_entry.region_page_count * page_size_;
*out_size = page_entry.region_page_count* page_size_;
return true;
}

View File

@ -51,7 +51,7 @@ bool MainWindow::Initialize() {
if (!PlatformWindow::Initialize()) {
return false;
}
UpdateTitle();
on_key_down.AddListener([this](KeyEvent& e) {
bool handled = true;
@ -64,11 +64,11 @@ bool MainWindow::Initialize() {
emulator()->graphics_system()->ClearCaches();
break;
}
case 0x7A: { // VK_F11
case 0x7A: { // VK_F11
ToggleFullscreen();
break;
}
case 0x1B: { // VK_ESCAPE
case 0x1B: { // VK_ESCAPE
// Allow users to escape fullscreen (but not enter it)
if (fullscreen_) {
ToggleFullscreen();

View File

@ -14,6 +14,9 @@
#include "xenia/base/memory.h"
// TODO(benvanik): split this header, cleanup, etc.
// clang-format off
namespace xe {
#pragma pack(push, 4)
@ -134,27 +137,23 @@ typedef uint32_t X_HRESULT;
// (?), used by KeGetCurrentProcessType
#define X_PROCTYPE_IDLE 0
#define X_PROCTYPE_USER 1
#define X_PROCTYPE_IDLE 0
#define X_PROCTYPE_USER 1
#define X_PROCTYPE_SYSTEM 2
// Sockets/networking.
#define X_INVALID_SOCKET (uint32_t)(~0)
#define X_SOCKET_ERROR (uint32_t)(-1)
#define X_INVALID_SOCKET (uint32_t)(~0)
#define X_SOCKET_ERROR (uint32_t)(-1)
// Thread enums.
#define X_CREATE_SUSPENDED 0x00000004
#define X_CREATE_SUSPENDED 0x00000004
// TLS specials.
#define X_TLS_OUT_OF_INDEXES UINT32_MAX // (-1)
#define X_TLS_OUT_OF_INDEXES UINT32_MAX // (-1)
// Languages.
#define X_LANGUAGE_ENGLISH 1
#define X_LANGUAGE_JAPANESE 2
#define X_LANGUAGE_ENGLISH 1
#define X_LANGUAGE_JAPANESE 2
enum X_FILE_ATTRIBUTES : uint32_t {
X_FILE_ATTRIBUTE_NONE = 0x0000,
@ -375,8 +374,8 @@ struct X_INPUT_KEYSTROKE {
static_assert_size(X_INPUT_KEYSTROKE, 8);
struct X_LIST_ENTRY {
be<uint32_t> flink_ptr; // next entry / head
be<uint32_t> blink_ptr; // previous entry / head
be<uint32_t> flink_ptr; // next entry / head
be<uint32_t> blink_ptr; // previous entry / head
};
static_assert_size(X_LIST_ENTRY, 8);
@ -384,4 +383,6 @@ static_assert_size(X_LIST_ENTRY, 8);
} // namespace xe
// clang-format on
#endif // XENIA_XBOX_H_