Clang fixes.
This commit is contained in:
parent
baa86fcd1b
commit
12a29371e3
|
@ -48,10 +48,10 @@ using namespace Xbyak;
|
|||
using xe::cpu::hir::HIRBuilder;
|
||||
using xe::cpu::hir::Instr;
|
||||
|
||||
static const size_t MAX_CODE_SIZE = 1 * 1024 * 1024;
|
||||
static const size_t kMaxCodeSize = 1 * 1024 * 1024;
|
||||
|
||||
static const size_t STASH_OFFSET = 32;
|
||||
static const size_t STASH_OFFSET_HIGH = 32 + 32;
|
||||
static const size_t kStashOffset = 32;
|
||||
// static const size_t kStashOffsetHigh = 32 + 32;
|
||||
|
||||
const uint32_t X64Emitter::gpr_reg_map_[X64Emitter::GPR_COUNT] = {
|
||||
Operand::RBX, Operand::R12, Operand::R13, Operand::R14, Operand::R15,
|
||||
|
@ -62,7 +62,7 @@ const uint32_t X64Emitter::xmm_reg_map_[X64Emitter::XMM_COUNT] = {
|
|||
};
|
||||
|
||||
X64Emitter::X64Emitter(X64Backend* backend, XbyakAllocator* allocator)
|
||||
: CodeGenerator(MAX_CODE_SIZE, AutoGrow, allocator),
|
||||
: CodeGenerator(kMaxCodeSize, AutoGrow, allocator),
|
||||
processor_(backend->processor()),
|
||||
backend_(backend),
|
||||
code_cache_(backend->code_cache()),
|
||||
|
@ -292,7 +292,7 @@ void X64Emitter::DebugBreak() {
|
|||
uint64_t TrapDebugPrint(void* raw_context, uint64_t address) {
|
||||
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
|
||||
uint32_t str_ptr = uint32_t(thread_state->context()->r[3]);
|
||||
uint16_t str_len = uint16_t(thread_state->context()->r[4]);
|
||||
// uint16_t str_len = uint16_t(thread_state->context()->r[4]);
|
||||
auto str = thread_state->memory()->TranslateVirtual<const char*>(str_ptr);
|
||||
// TODO(benvanik): truncate to length?
|
||||
XELOGD("(DebugPrint) %s", str);
|
||||
|
@ -663,9 +663,9 @@ void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, const vec128_t& v) {
|
|||
} else {
|
||||
// TODO(benvanik): see what other common values are.
|
||||
// TODO(benvanik): build constant table - 99% are reused.
|
||||
MovMem64(rsp + STASH_OFFSET, v.low);
|
||||
MovMem64(rsp + STASH_OFFSET + 8, v.high);
|
||||
vmovdqa(dest, ptr[rsp + STASH_OFFSET]);
|
||||
MovMem64(rsp + kStashOffset, v.low);
|
||||
MovMem64(rsp + kStashOffset + 8, v.high);
|
||||
vmovdqa(dest, ptr[rsp + kStashOffset]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,7 +708,7 @@ void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, double v) {
|
|||
}
|
||||
|
||||
Address X64Emitter::StashXmm(int index, const Xmm& r) {
|
||||
auto addr = ptr[rsp + STASH_OFFSET + (index * 16)];
|
||||
auto addr = ptr[rsp + kStashOffset + (index * 16)];
|
||||
vmovups(addr, r);
|
||||
return addr;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
ExportResolver::ExportResolver() {}
|
||||
ExportResolver::ExportResolver() = default;
|
||||
|
||||
ExportResolver::~ExportResolver() {}
|
||||
ExportResolver::~ExportResolver() = default;
|
||||
|
||||
void ExportResolver::RegisterTable(
|
||||
const std::string& library_name,
|
||||
|
@ -40,28 +40,28 @@ Export* ExportResolver::GetExportByOrdinal(const std::string& library_name,
|
|||
|
||||
void ExportResolver::SetVariableMapping(const std::string& library_name,
|
||||
uint16_t ordinal, uint32_t value) {
|
||||
auto export = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export);
|
||||
export->tags |= ExportTag::kImplemented;
|
||||
export->variable_ptr = value;
|
||||
auto export_entry = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export_entry);
|
||||
export_entry->tags |= ExportTag::kImplemented;
|
||||
export_entry->variable_ptr = value;
|
||||
}
|
||||
|
||||
void ExportResolver::SetFunctionMapping(const std::string& library_name,
|
||||
uint16_t ordinal,
|
||||
xe_kernel_export_shim_fn shim) {
|
||||
auto export = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export);
|
||||
export->tags |= ExportTag::kImplemented;
|
||||
export->function_data.shim = shim;
|
||||
auto export_entry = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export_entry);
|
||||
export_entry->tags |= ExportTag::kImplemented;
|
||||
export_entry->function_data.shim = shim;
|
||||
}
|
||||
|
||||
void ExportResolver::SetFunctionMapping(const std::string& library_name,
|
||||
uint16_t ordinal,
|
||||
ExportTrampoline trampoline) {
|
||||
auto export = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export);
|
||||
export->tags |= ExportTag::kImplemented;
|
||||
export->function_data.trampoline = trampoline;
|
||||
auto export_entry = GetExportByOrdinal(library_name, ordinal);
|
||||
assert_not_null(export_entry);
|
||||
export_entry->tags |= ExportTag::kImplemented;
|
||||
export_entry->function_data.trampoline = trampoline;
|
||||
}
|
||||
|
||||
} // namespace cpu
|
||||
|
|
|
@ -475,8 +475,8 @@ XEEMITTER(mtfsfx, 0xFC00058E, XFL)(PPCHIRBuilder& f, InstrData& i) {
|
|||
} else {
|
||||
// Directly store.
|
||||
// TODO(benvanik): use w/field mask to select bits.
|
||||
i.XFL.W;
|
||||
i.XFL.FM;
|
||||
// i.XFL.W;
|
||||
// i.XFL.FM;
|
||||
f.StoreFPSCR(f.Cast(f.LoadFPR(i.XFL.RB), INT64_TYPE));
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -32,7 +32,7 @@ void DumpAllInstrCounts() {
|
|||
instr_type->name);
|
||||
}
|
||||
}
|
||||
fprintf(stdout, sb.GetString());
|
||||
fprintf(stdout, "%s", sb.GetString());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) {
|
|||
scanner_.reset(new PPCScanner(frontend));
|
||||
builder_.reset(new PPCHIRBuilder(frontend));
|
||||
compiler_.reset(new Compiler(frontend->processor()));
|
||||
assembler_ = std::move(backend->CreateAssembler());
|
||||
assembler_ = backend->CreateAssembler();
|
||||
assembler_->Initialize();
|
||||
|
||||
bool validate = FLAGS_validate_hir;
|
||||
|
|
|
@ -35,14 +35,7 @@ void UndefinedImport(PPCContext* ppc_context, KernelState* kernel_state) {
|
|||
}
|
||||
|
||||
XexModule::XexModule(Processor* processor, KernelState* kernel_state)
|
||||
: Module(processor),
|
||||
processor_(processor),
|
||||
kernel_state_(kernel_state),
|
||||
xex_(nullptr),
|
||||
base_address_(0),
|
||||
low_address_(0),
|
||||
high_address_(0),
|
||||
loaded_(false) {}
|
||||
: Module(processor), processor_(processor), kernel_state_(kernel_state) {}
|
||||
|
||||
XexModule::~XexModule() { xe_xex2_dealloc(xex_); }
|
||||
|
||||
|
@ -150,8 +143,6 @@ uint32_t XexModule::GetProcAddress(const char* name) const {
|
|||
// Table of ordinals (by name)
|
||||
uint16_t* ordinal_table = (uint16_t*)((uint64_t)e + e->AddressOfNameOrdinals);
|
||||
|
||||
const char* mod_name = (const char*)((uint64_t)e + e->Name);
|
||||
|
||||
for (uint32_t i = 0; i < e->NumberOfNames; i++) {
|
||||
const char* fn_name = (const char*)((uint64_t)e + name_table[i]);
|
||||
uint16_t ordinal = ordinal_table[i];
|
||||
|
@ -210,7 +201,6 @@ bool XexModule::Load(const std::string& name, const std::string& path,
|
|||
loaded_ = true;
|
||||
xex_ = xex;
|
||||
|
||||
auto header = xex_header();
|
||||
auto old_header = xe_xex2_get_header(xex_);
|
||||
|
||||
// Setup debug info.
|
||||
|
|
|
@ -83,17 +83,17 @@ class XexModule : public xe::cpu::Module {
|
|||
bool FindSaveRest();
|
||||
|
||||
private:
|
||||
Processor* processor_;
|
||||
kernel::KernelState* kernel_state_;
|
||||
Processor* processor_ = nullptr;
|
||||
kernel::KernelState* kernel_state_ = nullptr;
|
||||
std::string name_;
|
||||
std::string path_;
|
||||
xe_xex2_ref xex_;
|
||||
xe_xex2_ref xex_ = nullptr;
|
||||
std::vector<uint8_t> xex_header_mem_; // Holds the xex header
|
||||
bool loaded_; // Loaded into memory?
|
||||
bool loaded_ = false; // Loaded into memory?
|
||||
|
||||
uint32_t base_address_;
|
||||
uint32_t low_address_;
|
||||
uint32_t high_address_;
|
||||
uint32_t base_address_ = 0;
|
||||
uint32_t low_address_ = 0;
|
||||
uint32_t high_address_ = 0;
|
||||
};
|
||||
|
||||
} // namespace cpu
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace hid {
|
|||
namespace winkey {
|
||||
|
||||
WinKeyInputDriver::WinKeyInputDriver(InputSystem* input_system)
|
||||
: packet_number_(1), InputDriver(input_system) {}
|
||||
: InputDriver(input_system), packet_number_(1) {}
|
||||
|
||||
WinKeyInputDriver::~WinKeyInputDriver() {}
|
||||
WinKeyInputDriver::~WinKeyInputDriver() = default;
|
||||
|
||||
X_STATUS WinKeyInputDriver::Setup() { return X_STATUS_SUCCESS; }
|
||||
|
||||
|
|
|
@ -34,7 +34,9 @@ class XNotifyListener : public XObject {
|
|||
bool DequeueNotification(XNotificationID* out_id, uint32_t* out_data);
|
||||
bool DequeueNotification(XNotificationID id, uint32_t* out_data);
|
||||
|
||||
xe::threading::WaitHandle* GetWaitHandle() { return wait_handle_.get(); }
|
||||
xe::threading::WaitHandle* GetWaitHandle() override {
|
||||
return wait_handle_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<xe::threading::Event> wait_handle_;
|
||||
|
|
|
@ -198,23 +198,41 @@ const static struct {
|
|||
uint64_t target_address;
|
||||
} map_info[] = {
|
||||
// (1024mb) - virtual 4k pages
|
||||
{
|
||||
0x00000000, 0x3FFFFFFF, 0x0000000000000000ull,
|
||||
},
|
||||
// (1024mb) - virtual 64k pages (cont)
|
||||
{
|
||||
0x40000000, 0x7EFFFFFF, 0x0000000040000000ull,
|
||||
},
|
||||
// (16mb) - GPU writeback + 15mb of XPS?
|
||||
{
|
||||
0x7F000000, 0x7FFFFFFF, 0x0000000100000000ull,
|
||||
},
|
||||
// (256mb) - xex 64k pages
|
||||
{
|
||||
0x80000000, 0x8FFFFFFF, 0x0000000080000000ull,
|
||||
},
|
||||
// (256mb) - xex 4k pages
|
||||
{
|
||||
0x90000000, 0x9FFFFFFF, 0x0000000080000000ull,
|
||||
},
|
||||
// (512mb) - physical 64k pages
|
||||
{
|
||||
0xA0000000, 0xBFFFFFFF, 0x0000000100000000ull,
|
||||
},
|
||||
// - physical 16mb pages
|
||||
{
|
||||
0xC0000000, 0xDFFFFFFF, 0x0000000100000000ull,
|
||||
},
|
||||
// - physical 4k pages
|
||||
{
|
||||
0xE0000000, 0xFFFFFFFF, 0x0000000100000000ull,
|
||||
},
|
||||
// - physical raw
|
||||
{
|
||||
0x100000000, 0x11FFFFFFF, 0x0000000100000000ull,
|
||||
},
|
||||
};
|
||||
int Memory::MapViews(uint8_t* mapping_base) {
|
||||
assert_true(xe::countof(map_info) == xe::countof(views_.all_views));
|
||||
|
@ -772,8 +790,8 @@ bool BaseHeap::Release(uint32_t base_address, uint32_t* out_region_size) {
|
|||
if (page_size_ == xe::memory::page_size() ||
|
||||
((base_page_entry.region_page_count * page_size_) %
|
||||
xe::memory::page_size() ==
|
||||
0) &&
|
||||
((base_page_number * page_size_) % xe::memory::page_size() == 0)) {
|
||||
0 &&
|
||||
((base_page_number * page_size_) % xe::memory::page_size() == 0))) {
|
||||
if (!xe::memory::Protect(
|
||||
membase_ + heap_base_ + base_page_number * page_size_,
|
||||
base_page_entry.region_page_count * page_size_,
|
||||
|
@ -824,8 +842,8 @@ bool BaseHeap::Protect(uint32_t address, uint32_t size, uint32_t protect) {
|
|||
// Attempt host change (hopefully won't fail).
|
||||
// We can only do this if our size matches system page granularity.
|
||||
if (page_size_ == xe::memory::page_size() ||
|
||||
((page_count * page_size_) % xe::memory::page_size() == 0) &&
|
||||
((start_page_number * page_size_) % xe::memory::page_size() == 0)) {
|
||||
(((page_count * page_size_) % xe::memory::page_size() == 0) &&
|
||||
((start_page_number * page_size_) % xe::memory::page_size() == 0))) {
|
||||
if (!xe::memory::Protect(
|
||||
membase_ + heap_base_ + start_page_number * page_size_,
|
||||
page_count * page_size_, ToPageAccess(protect), nullptr)) {
|
||||
|
|
|
@ -81,10 +81,10 @@ class CDialogEventHandler : public IFileDialogEvents,
|
|||
return S_OK;
|
||||
};
|
||||
|
||||
CDialogEventHandler() : _cRef(1){};
|
||||
CDialogEventHandler() : _cRef(1) {}
|
||||
|
||||
private:
|
||||
~CDialogEventHandler(){};
|
||||
virtual ~CDialogEventHandler() = default;
|
||||
long _cRef;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class GL4ElementalRenderer : public el::graphics::Renderer {
|
|||
GLenum prim_type;
|
||||
size_t vertex_offset;
|
||||
size_t vertex_count;
|
||||
} draw_commands_[kMaxCommands] = {0};
|
||||
} draw_commands_[kMaxCommands] = {{0}};
|
||||
uint32_t draw_command_count_ = 0;
|
||||
GL4Bitmap* current_bitmap_ = nullptr;
|
||||
Vertex vertices_[kMaxVertexBatchSize];
|
||||
|
|
|
@ -72,7 +72,7 @@ class GLProfilerDisplay : public ProfilerDisplay {
|
|||
|
||||
struct {
|
||||
uint16_t char_offsets[256];
|
||||
} font_description_ = {0};
|
||||
} font_description_ = {{0}};
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
|
|
|
@ -121,6 +121,7 @@ bool Window::InitializeElemental(Loop* loop, el::graphics::Renderer* renderer) {
|
|||
// Create the font now.
|
||||
auto font =
|
||||
font_manager->CreateFontFace(font_manager->default_font_description());
|
||||
assert(font != nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -521,6 +521,9 @@ Win32MenuItem::Win32MenuItem(Type type, const std::wstring& text,
|
|||
case MenuItem::Type::kPopup:
|
||||
handle_ = CreatePopupMenu();
|
||||
break;
|
||||
default:
|
||||
// May just be a placeholder.
|
||||
break;
|
||||
}
|
||||
if (handle_) {
|
||||
MENUINFO menu_info = {0};
|
||||
|
@ -542,6 +545,9 @@ void Win32MenuItem::OnChildAdded(MenuItem* generic_child_item) {
|
|||
auto child_item = static_cast<Win32MenuItem*>(generic_child_item);
|
||||
|
||||
switch (child_item->type()) {
|
||||
case MenuItem::Type::kNormal:
|
||||
// Nothing special.
|
||||
break;
|
||||
case MenuItem::Type::kPopup:
|
||||
AppendMenuW(handle_, MF_POPUP,
|
||||
reinterpret_cast<UINT_PTR>(child_item->handle()),
|
||||
|
@ -561,10 +567,7 @@ void Win32MenuItem::OnChildAdded(MenuItem* generic_child_item) {
|
|||
}
|
||||
}
|
||||
|
||||
void Win32MenuItem::OnChildRemoved(MenuItem* generic_child_item) {
|
||||
auto child_item = static_cast<Win32MenuItem*>(generic_child_item);
|
||||
//
|
||||
}
|
||||
void Win32MenuItem::OnChildRemoved(MenuItem* generic_child_item) {}
|
||||
|
||||
} // namespace ui
|
||||
} // namespace xe
|
||||
|
|
|
@ -64,7 +64,6 @@ class Win32Window : public Window {
|
|||
bool HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
HWND hwnd_ = nullptr;
|
||||
bool invalidated_ = true;
|
||||
bool closing_ = false;
|
||||
|
||||
WINDOWPLACEMENT windowed_pos_;
|
||||
|
|
|
@ -18,7 +18,6 @@ HostPathFile::HostPathFile(
|
|||
KernelState* kernel_state, uint32_t file_access, HostPathEntry* entry,
|
||||
std::unique_ptr<xe::filesystem::FileHandle> file_handle)
|
||||
: XFile(kernel_state, file_access, entry),
|
||||
entry_(entry),
|
||||
file_handle_(std::move(file_handle)) {}
|
||||
|
||||
HostPathFile::~HostPathFile() = default;
|
||||
|
@ -39,8 +38,8 @@ X_STATUS HostPathFile::ReadSync(void* buffer, size_t buffer_length,
|
|||
X_STATUS HostPathFile::WriteSync(const void* buffer, size_t buffer_length,
|
||||
size_t byte_offset,
|
||||
size_t* out_bytes_written) {
|
||||
if (!(file_access() & FileAccess::kFileWriteData |
|
||||
FileAccess::kFileAppendData)) {
|
||||
if (!(file_access() &
|
||||
(FileAccess::kFileWriteData | FileAccess::kFileAppendData))) {
|
||||
return X_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ class HostPathFile : public XFile {
|
|||
size_t byte_offset, size_t* out_bytes_written) override;
|
||||
|
||||
private:
|
||||
HostPathEntry* entry_;
|
||||
std::unique_ptr<xe::filesystem::FileHandle> file_handle_;
|
||||
};
|
||||
|
||||
|
|
|
@ -149,7 +149,8 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries(
|
|||
break;
|
||||
}
|
||||
uint8_t filename_length_flags = xe::load_and_swap<uint8_t>(p + 0x28);
|
||||
uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29);
|
||||
// TODO(benvanik): use for allocation_size_?
|
||||
// uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29);
|
||||
uint32_t start_block_index = XEGETUINT24LE(p + 0x2F);
|
||||
uint16_t path_indicator = xe::load_and_swap<uint16_t>(p + 0x32);
|
||||
uint32_t file_size = xe::load_and_swap<uint32_t>(p + 0x34);
|
||||
|
|
|
@ -218,6 +218,10 @@ X_STATUS VirtualFileSystem::OpenFile(KernelState* kernel_state,
|
|||
} else {
|
||||
// May need to delete, if it exists.
|
||||
switch (creation_disposition) {
|
||||
case FileDisposition::kCreate:
|
||||
// Shouldn't be possible to hit this.
|
||||
assert_always();
|
||||
return X_STATUS_ACCESS_DENIED;
|
||||
case FileDisposition::kSuperscede:
|
||||
// Replace (by delete + recreate).
|
||||
if (!entry->Delete()) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b0ecdb343c06c157c44acbcc8d140c88ab1568f3
|
||||
Subproject commit 69a8854210fb6eefc91ebe238ada625fe1c4627d
|
|
@ -2068,7 +2068,7 @@ bool MicroProfileWebServerUpdate()
|
|||
#include <strsafe.h>
|
||||
|
||||
|
||||
static GUID g_MicroProfileThreadClassGuid = { 0x3d6fa8d1, 0xfe05, 0x11d0, 0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c };
|
||||
static GUID g_MicroProfileThreadClassGuid = { 0x3d6fa8d1, 0xfe05, 0x11d0, {0x9d, 0xda, 0x00, 0xc0, 0x4f, 0xd7, 0xba, 0x7c } };
|
||||
|
||||
struct MicroProfileSCSwitch
|
||||
{
|
||||
|
@ -2138,7 +2138,7 @@ void MicroProfileContextSwitchStopTrace()
|
|||
|
||||
EVENT_TRACE_LOGFILE log;
|
||||
ZeroMemory(&log, sizeof(log));
|
||||
log.LoggerName = KERNEL_LOGGER_NAME;
|
||||
log.LoggerName = (LPWSTR)KERNEL_LOGGER_NAME;
|
||||
log.ProcessTraceMode = 0;
|
||||
TRACEHANDLE hLog = OpenTrace(&log);
|
||||
if (hLog)
|
||||
|
@ -2183,7 +2183,7 @@ void MicroProfileTraceThread(int unused)
|
|||
EVENT_TRACE_LOGFILE log;
|
||||
ZeroMemory(&log, sizeof(log));
|
||||
|
||||
log.LoggerName = KERNEL_LOGGER_NAME;
|
||||
log.LoggerName = (LPWSTR)KERNEL_LOGGER_NAME;
|
||||
log.ProcessTraceMode = PROCESS_TRACE_MODE_REAL_TIME | PROCESS_TRACE_MODE_RAW_TIMESTAMP;
|
||||
log.EventCallback = MicroProfileContextSwitchCallback;
|
||||
log.BufferCallback = MicroProfileBufferCallback;
|
||||
|
|
|
@ -2706,7 +2706,7 @@ void MicroProfileLoadPreset(const char* pSuffix)
|
|||
const char* pGroupName = pBuffer + Header.nGroups[i];
|
||||
for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
|
||||
{
|
||||
if(S.GroupInfo[j].pName && 0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName))
|
||||
if(0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName))
|
||||
{
|
||||
S.nActiveGroupWanted |= (1ll << j);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue