Fixing some clang warnings/errors.

This commit is contained in:
Ben Vanik 2015-07-15 23:26:58 -07:00
parent 74d2df2004
commit ecd4af10c9
27 changed files with 180 additions and 153 deletions

View File

@ -5,6 +5,10 @@
<Configuration>Checked</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Clang|x64">
<Configuration>Clang</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
@ -192,56 +196,67 @@
<ClCompile Include="third_party\beaengine\beaengineSources\BeaEngine.c" />
<ClCompile Include="third_party\capstone\arch\X86\X86Disassembler.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\arch\X86\X86DisassemblerDecoder.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\arch\X86\X86IntelInstPrinter.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\arch\X86\X86Mapping.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\arch\X86\X86Module.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\cs.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\MCInst.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\MCInstrDesc.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\MCRegisterInfo.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\SStream.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="third_party\capstone\utils.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Checked|x64'">CompileAsCpp</CompileAs>
</ClCompile>
@ -491,6 +506,7 @@
<ProjectGuid>{0CE149F6-41C3-4224-9E57-C02E8C7CD312}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libxenia</RootNamespace>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@ -499,6 +515,12 @@
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Clang|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>LLVM-vs2014</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Checked|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
@ -522,6 +544,12 @@
<Import Project="build\Xenia.Cpp.$(Platform).Common.props" />
<Import Project="build\Xenia.Cpp.$(Platform).$(Configuration).props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Clang|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="build\Xenia.Cpp.$(Platform).Common.props" />
<Import Project="build\Xenia.Cpp.x64.Debug.props" />
<Import Project="build\Xenia.Cpp.$(Platform).$(Configuration).props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Checked|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="build\Xenia.Cpp.$(Platform).Common.props" />
@ -535,6 +563,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Clang|x64'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Checked|x64'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -543,7 +572,24 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>BEA_ENGINE_STATIC=1;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include\;$(SolutionDir)\third_party\beaengine\include\;$(SolutionDir)\third_party\llvm\include\;$(SolutionDir)\third_party\capstone\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include;$(SolutionDir)\third_party\beaengine\include;$(SolutionDir)\third_party\llvm\include;$(SolutionDir)\third_party\capstone\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalDependencies>libelemental.lib;libxenia-base.lib;libavcodec.a;libavutil.a;libgflags.lib;libglew.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)third_party\libav-xma-bin\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Clang|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>BEA_ENGINE_STATIC=1;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include;$(SolutionDir)\third_party\beaengine\include;$(SolutionDir)\third_party\llvm\include;$(SolutionDir)\third_party\capstone\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -560,7 +606,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>BEA_ENGINE_STATIC=1;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include\;$(SolutionDir)\third_party\beaengine\include\;$(SolutionDir)\third_party\llvm\include\;$(SolutionDir)\third_party\capstone\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include;$(SolutionDir)\third_party\beaengine\include;$(SolutionDir)\third_party\llvm\include;$(SolutionDir)\third_party\capstone\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -577,7 +623,7 @@
</PrecompiledHeader>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>BEA_ENGINE_STATIC=1;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include\;$(SolutionDir)\third_party\beaengine\include\;$(SolutionDir)\third_party\llvm\include\;$(SolutionDir)\third_party\capstone\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)\third_party\libav-xma-bin\include;$(SolutionDir)\third_party\beaengine\include;$(SolutionDir)\third_party\llvm\include;$(SolutionDir)\third_party\capstone\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -28,7 +28,7 @@ class XAudio2AudioSystem : public AudioSystem {
void DestroyDriver(AudioDriver* driver) override;
protected:
virtual void Initialize();
void Initialize() override;
};
} // namespace xaudio2

View File

@ -26,16 +26,7 @@ extern "C" {
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) {}
XmaContext::XmaContext() = default;
XmaContext::~XmaContext() {
if (context_) {

View File

@ -175,24 +175,22 @@ class XmaContext {
Memory* memory_;
uint32_t id_;
uint32_t guest_ptr_;
uint32_t id_ = 0;
uint32_t guest_ptr_ = 0;
xe::mutex lock_;
bool is_allocated_;
bool is_enabled_;
bool decoding_packet_;
bool is_allocated_ = false;
bool is_enabled_ = false;
// libav structures
AVCodec* codec_;
AVCodecContext* context_;
AVFrame* decoded_frame_;
AVPacket* packet_;
AVCodec* codec_ = nullptr;
AVCodecContext* context_ = nullptr;
AVFrame* decoded_frame_ = nullptr;
AVPacket* packet_ = nullptr;
WmaProExtraData extra_data_;
size_t current_frame_pos_;
uint8_t* current_frame_;
uint32_t frame_samples_size_;
size_t current_frame_pos_ = 0;
uint8_t* current_frame_ = nullptr;
uint32_t frame_samples_size_ = 0;
uint8_t packet_data_[kBytesPerPacket];
};

View File

@ -255,8 +255,6 @@ void XmaDecoder::WriteRegister(uint32_t addr, uint64_t value) {
context.Clear();
}
}
} else {
value = value;
}
}

View File

@ -372,7 +372,6 @@ uint32_t X64CodeCache::PlaceData(const void* data, size_t length) {
// Hold a lock while we bump the pointers up.
size_t high_mark;
uint8_t* data_address = nullptr;
size_t unwind_table_slot = 0;
{
std::lock_guard<xe::mutex> allocation_lock(allocation_mutex_);

View File

@ -81,14 +81,14 @@ class X64CodeCache : public CodeCache {
// Current offset to empty space in generated code.
size_t generated_code_offset_ = 0;
// Current high water mark of COMMITTED code.
std::atomic<size_t> generated_code_commit_mark_ = 0;
std::atomic<size_t> generated_code_commit_mark_ = {0};
// Growable function table system handle.
void* unwind_table_handle_ = nullptr;
// Actual unwind table entries.
std::vector<RUNTIME_FUNCTION> unwind_table_;
// Current number of entries in the table.
std::atomic<uint32_t> unwind_table_count_ = 0;
std::atomic<uint32_t> unwind_table_count_ = {0};
};
} // namespace x64

View File

@ -30,9 +30,9 @@ class X64Function : public Function {
void Setup(uint8_t* machine_code, size_t machine_code_length);
protected:
virtual bool AddBreakpointImpl(debug::Breakpoint* breakpoint);
virtual bool RemoveBreakpointImpl(debug::Breakpoint* breakpoint);
virtual bool CallImpl(ThreadState* thread_state, uint32_t return_address);
bool AddBreakpointImpl(debug::Breakpoint* breakpoint) override;
bool RemoveBreakpointImpl(debug::Breakpoint* breakpoint) override;
bool CallImpl(ThreadState* thread_state, uint32_t return_address) override;
private:
uint8_t* machine_code_;

View File

@ -330,7 +330,7 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
case OPCODE_ADD:
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
v->set_from(i->src1.value);
bool did_carry = v->Add(i->src2.value);
v->Add(i->src2.value);
i->Remove();
}
break;
@ -357,7 +357,7 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
case OPCODE_SUB:
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
v->set_from(i->src1.value);
bool did_carry = v->Sub(i->src2.value);
v->Sub(i->src2.value);
i->Remove();
}
break;

View File

@ -18,7 +18,7 @@
namespace xe {
namespace cpu {
enum DebugInfoFlags {
enum DebugInfoFlags : uint32_t {
kDebugInfoNone = 0,
kDebugInfoDisasmSource = (1 << 1),
kDebugInfoDisasmRawHir = (1 << 2),

View File

@ -66,7 +66,6 @@ class Export {
: ordinal(ordinal),
type(type),
tags(tags),
variable_ptr(0),
function_data({nullptr, nullptr, 0}) {
std::strncpy(this->name, name, xe::countof(this->name));
}

View File

@ -71,12 +71,7 @@ class BuiltinModule : public Module {
Processor::Processor(xe::Memory* memory, ExportResolver* export_resolver,
debug::Debugger* debugger)
: memory_(memory),
debugger_(debugger),
debug_info_flags_(0),
builtin_module_(nullptr),
next_builtin_address_(0xFFFF0000ul),
export_resolver_(export_resolver) {
: memory_(memory), debugger_(debugger), export_resolver_(export_resolver) {
InitializeIfNeeded();
}

View File

@ -83,20 +83,20 @@ class Processor {
private:
bool DemandFunction(FunctionInfo* symbol_info, Function** out_function);
Memory* memory_;
debug::Debugger* debugger_;
Memory* memory_ = nullptr;
debug::Debugger* debugger_ = nullptr;
uint32_t debug_info_flags_;
uint32_t debug_info_flags_ = 0;
std::unique_ptr<frontend::PPCFrontend> frontend_;
std::unique_ptr<backend::Backend> backend_;
ExportResolver* export_resolver_;
ExportResolver* export_resolver_ = nullptr;
EntryTable entry_table_;
xe::mutex modules_lock_;
std::vector<std::unique_ptr<Module>> modules_;
Module* builtin_module_;
uint32_t next_builtin_address_;
Module* builtin_module_ = nullptr;
uint32_t next_builtin_address_ = 0xFFFF0000u;
Irql irql_;
};

View File

@ -33,7 +33,7 @@ TestModule::TestModule(Processor* processor, const std::string& name,
generate_(generate) {
builder_.reset(new HIRBuilder());
compiler_.reset(new Compiler(processor));
assembler_ = std::move(processor->backend()->CreateAssembler());
assembler_ = processor->backend()->CreateAssembler();
assembler_->Initialize();
// Merge blocks early. This will let us use more context in other passes.

View File

@ -61,8 +61,7 @@ Breakpoint::~Breakpoint() = default;
Debugger::Debugger(Emulator* emulator)
: emulator_(emulator),
listen_socket_(INVALID_SOCKET),
client_socket_(INVALID_SOCKET),
accept_thread_running_(false) {
client_socket_(INVALID_SOCKET) {
WSADATA wsa_data;
WSAStartup(MAKEWORD(2, 2), &wsa_data);
}
@ -114,7 +113,7 @@ bool Debugger::StartSession() {
if (bind(listen_socket_, reinterpret_cast<sockaddr*>(&socket_addr),
sizeof(socket_addr)) == SOCKET_ERROR) {
int e = WSAGetLastError();
XELOGE("Unable to bind debug socket");
XELOGE("Unable to bind debug socket: %d", e);
return false;
}
if (listen(listen_socket_, 5) == SOCKET_ERROR) {
@ -300,11 +299,12 @@ void Debugger::OnMessage(std::vector<uint8_t> buffer) {
module_builder.add_path(module_path_offset);
switch (module->module_type()) {
case XModule::ModuleType::kKernelModule: {
auto kernel_module = reinterpret_cast<XKernelModule*>(module.get());
// auto kernel_module =
// reinterpret_cast<XKernelModule*>(module.get());
break;
}
case XModule::ModuleType::kUserModule: {
auto user_module = reinterpret_cast<XUserModule*>(module.get());
// auto user_module = reinterpret_cast<XUserModule*>(module.get());
// user_module->xex?
break;
}
@ -475,8 +475,8 @@ void Debugger::OnMessage(std::vector<uint8_t> buffer) {
break;
}
SendResponse(client_socket_, std::move(fbb), request->id(),
response_data_type, response_data_offset);
SendResponse(client_socket_, fbb, request->id(), response_data_type,
response_data_offset);
}
void Debugger::StopSession() {

View File

@ -108,13 +108,13 @@ class Debugger {
private:
void OnMessage(std::vector<uint8_t> buffer);
Emulator* emulator_;
Emulator* emulator_ = nullptr;
uintptr_t listen_socket_;
bool accept_thread_running_;
uintptr_t listen_socket_ = ~0;
bool accept_thread_running_ = false;
std::thread accept_thread_;
xe::threading::Fence accept_fence_;
uintptr_t client_socket_;
uintptr_t client_socket_ = ~0;
std::thread receive_thread_;
std::wstring functions_path_;

View File

@ -125,7 +125,7 @@ X_STATUS Emulator::Setup(ui::Window* display_window) {
});
// Initialize the HID.
input_system_ = std::move(xe::hid::InputSystem::Create(this));
input_system_ = xe::hid::InputSystem::Create(this);
if (!input_system_) {
return X_STATUS_NOT_IMPLEMENTED;
}

View File

@ -19,7 +19,7 @@ namespace gpu {
namespace ucode {
#if XE_COMPILER_MSVC
#if XE_PLATFORM_WIN32
#define XEPACKEDSTRUCT(name, value) \
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
typedef struct name##_s name;
@ -32,7 +32,7 @@ namespace ucode {
#define XEPACKEDSTRUCT(name, value) struct __attribute__((packed)) name
#define XEPACKEDSTRUCTANONYMOUS(value) struct __attribute__((packed))
#define XEPACKEDUNION(name, value) union __attribute__((packed)) name
#endif // MSVC
#endif // XE_PLATFORM_WIN32
// Closest AMD doc:
// http://developer.amd.com/wordpress/media/2012/10/R600_Instruction_Set_Architecture.pdf

View File

@ -51,7 +51,8 @@ KernelState::KernelState(Emulator* emulator)
object_table_(nullptr),
has_notified_startup_(false),
process_type_(X_PROCTYPE_USER),
process_info_block_address_(0) {
process_info_block_address_(0),
dispatch_thread_running_(false) {
processor_ = emulator->processor();
file_system_ = emulator->file_system();

View File

@ -182,7 +182,7 @@ class KernelState {
uint32_t process_info_block_address_;
std::atomic<bool> dispatch_thread_running_ = false;
std::atomic<bool> dispatch_thread_running_;
object_ref<XHostThread> dispatch_thread_;
std::mutex dispatch_mutex_;
std::condition_variable dispatch_cond_;

View File

@ -26,7 +26,7 @@ typedef struct {
uint32_t thunk_address; // NULL or address of thunk
} xe_xex2_import_info_t;
enum xe_pe_section_flags_e {
enum xe_pe_section_flags_e : uint32_t {
kXEPESectionContainsCode = 0x00000020,
kXEPESectionContainsDataInit = 0x00000040,
kXEPESectionContainsDataUninit = 0x00000080,

View File

@ -14,7 +14,7 @@
#include "xenia/base/byte_order.h"
typedef enum {
enum xe_xex2_header_keys : uint32_t {
XEX_HEADER_RESOURCE_INFO = 0x000002FF,
XEX_HEADER_FILE_FORMAT_INFO = 0x000003FF,
XEX_HEADER_DELTA_PATCH_DESCRIPTOR = 0x000005FF,
@ -45,9 +45,9 @@ typedef enum {
XEX_HEADER_ALTERNATE_TITLE_IDS = 0x000407FF,
XEX_HEADER_ADDITIONAL_TITLE_MEMORY = 0x00040801,
XEX_HEADER_EXPORTS_BY_NAME = 0x00E10402,
} xe_xex2_header_keys;
};
typedef enum {
enum xe_xex2_module_flags : uint32_t {
XEX_MODULE_TITLE = 0x00000001,
XEX_MODULE_EXPORTS_TO_TITLE = 0x00000002,
XEX_MODULE_SYSTEM_DEBUGGER = 0x00000004,
@ -56,9 +56,9 @@ typedef enum {
XEX_MODULE_PATCH_FULL = 0x00000020,
XEX_MODULE_PATCH_DELTA = 0x00000040,
XEX_MODULE_USER_MODE = 0x00000080,
} xe_xex2_module_flags;
};
typedef enum {
enum xe_xex2_system_flags : uint32_t {
XEX_SYSTEM_NO_FORCED_REBOOT = 0x00000001,
XEX_SYSTEM_FOREGROUND_TASKS = 0x00000002,
XEX_SYSTEM_NO_ODD_MAPPING = 0x00000004,
@ -99,10 +99,10 @@ typedef enum {
XEX_SYSTEM_CAMERA_ANGLE = 0x0,
XEX_SYSTEM_SKELETAL_TRACKING_REQUIRED = 0x0,
XEX_SYSTEM_SKELETAL_TRACKING_SUPPORTED = 0x0,*/
} xe_xex2_system_flags;
};
// ESRB (Entertainment Software Rating Board)
typedef enum {
enum xe_xex2_rating_esrb_value : uint32_t {
XEX_RATING_ESRB_eC = 0x00,
XEX_RATING_ESRB_E = 0x02,
XEX_RATING_ESRB_E10 = 0x04,
@ -110,36 +110,36 @@ typedef enum {
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 {
enum xe_xex2_rating_pegi_value : uint32_t {
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 {
enum xe_xex2_rating_pegi_fi_value : uint32_t {
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 {
enum xe_xex2_rating_pegi_pt_value : uint32_t {
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 {
enum xe_xex2_rating_bbfc_value : uint32_t {
XEX_RATING_BBFC_UNIVERSAL = 1,
XEX_RATING_BBFC_PG = 5,
XEX_RATING_BBFC_3_PLUS = 0,
@ -149,60 +149,60 @@ typedef enum {
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 {
enum xe_xex2_rating_cero_value : uint32_t {
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 {
enum xe_xex2_rating_usk_value : uint32_t {
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 {
enum xe_xex2_rating_oflc_au_value : uint32_t {
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 {
enum xe_xex2_rating_oflc_nz_value : uint32_t {
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 {
enum xe_xex2_rating_kmrb_value : uint32_t {
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 {
enum xe_xex2_rating_brazil_value : uint32_t {
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 {
enum xe_xex2_rating_fpb_value : uint32_t {
XEX_RATING_FPB_ALL = 0,
XEX_RATING_FPB_PG = 6,
XEX_RATING_FPB_10_PLUS = 7,
@ -210,9 +210,9 @@ typedef enum {
XEX_RATING_FPB_16_PLUS = 13,
XEX_RATING_FPB_18_PLUS = 14,
XEX_RATING_FPB_UNRATED = 0xFF,
} xe_xex2_rating_fpb_value;
};
typedef struct {
struct xe_xex2_game_ratings_t {
xe_xex2_rating_esrb_value esrb;
xe_xex2_rating_pegi_value pegi;
xe_xex2_rating_pegi_fi_value pegifi;
@ -225,9 +225,9 @@ typedef struct {
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 {
union xe_xex2_version_t {
uint32_t value;
struct {
uint32_t major : 4;
@ -235,24 +235,24 @@ typedef union {
uint32_t build : 16;
uint32_t qfe : 8;
};
} xe_xex2_version_t;
};
typedef struct {
struct xe_xex2_opt_header_t {
uint32_t key;
uint32_t length;
union {
uint32_t value;
uint32_t offset;
};
} xe_xex2_opt_header_t;
};
typedef struct {
struct xe_xex2_resource_info_t {
char name[9];
uint32_t address;
uint32_t size;
} xe_xex2_resource_info_t;
};
typedef struct {
struct xe_xex2_execution_info_t {
uint32_t media_id;
xe_xex2_version_t version;
xe_xex2_version_t base_version;
@ -262,16 +262,16 @@ typedef struct {
uint8_t disc_number;
uint8_t disc_count;
uint32_t savegame_id;
} xe_xex2_execution_info_t;
};
typedef struct {
struct xe_xex2_tls_info_t {
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 {
struct xe_xex2_import_library_t {
char name[32];
uint8_t digest[20];
uint32_t import_id;
@ -279,63 +279,63 @@ typedef struct {
xe_xex2_version_t min_version;
size_t record_count;
uint32_t* records;
} xe_xex2_import_library_t;
};
typedef enum {
enum xe_xex2_approval_type : uint32_t {
XEX_APPROVAL_UNAPPROVED = 0,
XEX_APPROVAL_POSSIBLE = 1,
XEX_APPROVAL_APPROVED = 2,
XEX_APPROVAL_EXPIRED = 3,
} xe_xex2_approval_type;
};
typedef struct {
struct xe_xex2_static_library_t {
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;
};
typedef enum {
enum xe_xex2_encryption_type : uint32_t {
XEX_ENCRYPTION_NONE = 0,
XEX_ENCRYPTION_NORMAL = 1,
} xe_xex2_encryption_type;
};
typedef enum {
enum xe_xex2_compression_type : uint32_t {
XEX_COMPRESSION_NONE = 0,
XEX_COMPRESSION_BASIC = 1,
XEX_COMPRESSION_NORMAL = 2,
XEX_COMPRESSION_DELTA = 3,
} xe_xex2_compression_type;
};
typedef struct {
struct xe_xex2_file_basic_compression_block_t {
uint32_t data_size;
uint32_t zero_size;
} xe_xex2_file_basic_compression_block_t;
};
typedef struct {
struct xe_xex2_file_basic_compression_info_t {
uint32_t block_count;
xe_xex2_file_basic_compression_block_t* blocks;
} xe_xex2_file_basic_compression_info_t;
};
typedef struct {
struct xe_xex2_file_normal_compression_info_t {
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 {
struct xe_xex2_file_format_info_t {
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;
} compression_info;
} xe_xex2_file_format_info_t;
};
typedef enum {
enum xe_xex2_image_flags : uint32_t {
XEX_IMAGE_MANUFACTURING_UTILITY = 0x00000002,
XEX_IMAGE_MANUFACTURING_SUPPORT_TOOLS = 0x00000004,
XEX_IMAGE_XGD2_MEDIA_ONLY = 0x00000008,
@ -354,9 +354,9 @@ typedef enum {
XEX_IMAGE_REGION_FREE = 0x20000000,
XEX_IMAGE_REVOCATION_CHECK_OPTIONAL = 0x40000000,
XEX_IMAGE_REVOCATION_CHECK_REQUIRED = 0x80000000,
} xe_xex2_image_flags;
};
typedef enum {
enum xe_xex2_media_flags : uint32_t {
XEX_MEDIA_HARDDISK = 0x00000001,
XEX_MEDIA_DVD_X2 = 0x00000002,
XEX_MEDIA_DVD_CD = 0x00000004,
@ -374,9 +374,9 @@ typedef enum {
XEX_MEDIA_LOCALLY_SIGNED_PACKAGE = 0x04000000,
XEX_MEDIA_LIVE_SIGNED_PACKAGE = 0x08000000,
XEX_MEDIA_XBOX_PACKAGE = 0x10000000,
} xe_xex2_media_flags;
};
typedef enum {
enum xe_xex2_region_flags : uint32_t {
XEX_REGION_NTSCU = 0x000000FF,
XEX_REGION_NTSCJ = 0x0000FF00,
XEX_REGION_NTSCJ_JAPAN = 0x00000100,
@ -385,9 +385,9 @@ typedef enum {
XEX_REGION_PAL_AU_NZ = 0x00010000,
XEX_REGION_OTHER = 0xFF000000,
XEX_REGION_ALL = 0xFFFFFFFF,
} xe_xex2_region_flags;
};
typedef struct {
struct xe_xex2_loader_info_t {
uint32_t header_size;
uint32_t image_size;
uint8_t rsa_signature[256];
@ -403,15 +403,15 @@ typedef struct {
uint8_t header_digest[20];
xe_xex2_region_flags game_regions;
xe_xex2_media_flags media_flags;
} xe_xex2_loader_info_t;
};
typedef enum {
enum xe_xex2_section_type : uint32_t {
XEX_SECTION_CODE = 1,
XEX_SECTION_DATA = 2,
XEX_SECTION_READONLY_DATA = 3,
} xe_xex2_section_type;
};
typedef struct {
struct xe_xex2_section_t {
uint32_t page_size;
union {
struct {
@ -421,9 +421,9 @@ typedef struct {
uint32_t value; // To make uint8_t swapping easier
} info;
uint8_t digest[20];
} xe_xex2_section_t;
};
typedef struct {
struct xe_xex2_header_t {
uint32_t xex2;
xe_xex2_module_flags module_flags;
uint32_t exe_offset;
@ -455,7 +455,7 @@ typedef struct {
xe_xex2_resource_info_t* resource_infos;
size_t section_count;
xe_xex2_section_t* sections;
} xe_xex2_header_t;
};
namespace xe {
union xex2_version {

View File

@ -236,7 +236,7 @@ class Memory {
uint8_t* physical;
};
uint8_t* all_views[9];
} views_ = {0};
} views_ = {{0}};
std::unique_ptr<cpu::MMIOHandler> mmio_handler_;

View File

@ -27,7 +27,7 @@ class HostPathDevice : public Device {
bool Initialize() override;
bool is_read_only() const { return read_only_; }
bool is_read_only() const override { return read_only_; }
uint32_t total_allocation_units() const override { return 128 * 1024; }
uint32_t available_allocation_units() const override { return 128 * 1024; }

@ -1 +1 @@
Subproject commit 3b5df11e07ed160410f39d105eca88d773b7b385
Subproject commit 275ad4155a436883964f16b64c6b32b11fbb027a

View File

@ -469,7 +469,7 @@ enum MicroProfileDrawMask
MP_DRAW_HIDDEN = 0x3,
};
enum MicroProfileDrawBarsMask
enum MicroProfileDrawBarsMask : uint32_t
{
MP_DRAW_TIMERS = 0x1,
MP_DRAW_AVERAGE = 0x2,

View File

@ -85,8 +85,8 @@ Global
{88F908AF-79A3-4ED4-87C7-A76368205264}.Release|x64.Build.0 = Release|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Checked|x64.ActiveCfg = Checked|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Checked|x64.Build.0 = Checked|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Clang|x64.ActiveCfg = Debug|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Clang|x64.Build.0 = Debug|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Clang|x64.ActiveCfg = Clang|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Clang|x64.Build.0 = Clang|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Debug|x64.ActiveCfg = Debug|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Debug|x64.Build.0 = Debug|x64
{0CE149F6-41C3-4224-9E57-C02E8C7CD312}.Release|x64.ActiveCfg = Release|x64
@ -165,16 +165,16 @@ Global
{93533067-6449-4691-88A8-026EBCFDCA97}.Release|x64.Build.0 = Release|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Checked|x64.ActiveCfg = Checked|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Checked|x64.Build.0 = Checked|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Clang|x64.ActiveCfg = Debug|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Clang|x64.Build.0 = Debug|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Clang|x64.ActiveCfg = Clang|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Clang|x64.Build.0 = Clang|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Debug|x64.ActiveCfg = Debug|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Debug|x64.Build.0 = Debug|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Release|x64.ActiveCfg = Release|x64
{156102D7-F2DD-4618-B2EB-2DFE607EE6DD}.Release|x64.Build.0 = Release|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Checked|x64.ActiveCfg = Checked|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Checked|x64.Build.0 = Checked|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Clang|x64.ActiveCfg = Debug|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Clang|x64.Build.0 = Debug|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Clang|x64.ActiveCfg = Clang|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Clang|x64.Build.0 = Clang|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Debug|x64.ActiveCfg = Debug|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Debug|x64.Build.0 = Debug|x64
{C3FDE1FE-1FCB-4156-BB37-2E38F5C2DFE7}.Release|x64.ActiveCfg = Release|x64