mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 09:32:42 +00:00
fix some more warnings
This commit is contained in:
parent
3059570404
commit
7a02787bee
@ -73,7 +73,7 @@ void pad_info::save(utils::serial& ar)
|
||||
|
||||
extern void send_sys_io_connect_event(usz index, u32 state);
|
||||
|
||||
void cellPad_NotifyStateChange(usz index, u32 /*state*/)
|
||||
void cellPad_NotifyStateChange(usz index, u64 /*state*/)
|
||||
{
|
||||
auto info = g_fxo->try_get<pad_info>();
|
||||
|
||||
|
@ -36,7 +36,7 @@ extern void sys_io_serialize(utils::serial& ar)
|
||||
g_fxo->get<libio_sys_config>().save_or_load(ar);
|
||||
}
|
||||
|
||||
extern void cellPad_NotifyStateChange(usz index, u32 state);
|
||||
extern void cellPad_NotifyStateChange(usz index, u64 state);
|
||||
|
||||
void config_event_entry(ppu_thread& ppu)
|
||||
{
|
||||
|
@ -1624,7 +1624,7 @@ std::vector<std::pair<u32, u32>> ppu_thread::dump_callstack_list() const
|
||||
|
||||
inst_neg.resize(new_size);
|
||||
|
||||
if (!vm::try_access(inst_bound, &inst_neg[old_size], (new_size - old_size) * sizeof(be_t<u32>), false))
|
||||
if (!vm::try_access(inst_bound, &inst_neg[old_size], ::narrow<u32>((new_size - old_size) * sizeof(be_t<u32>)), false))
|
||||
{
|
||||
// Failure (this would be detected as failure by zeroes)
|
||||
}
|
||||
@ -1657,7 +1657,7 @@ std::vector<std::pair<u32, u32>> ppu_thread::dump_callstack_list() const
|
||||
|
||||
inst_pos.resize(new_size);
|
||||
|
||||
if (!vm::try_access(pos, &inst_pos[old_size], (new_size - old_size) * sizeof(be_t<u32>), false))
|
||||
if (!vm::try_access(pos, &inst_pos[old_size], ::narrow<u32>((new_size - old_size) * sizeof(be_t<u32>)), false))
|
||||
{
|
||||
// Failure (this would be detected as failure by zeroes)
|
||||
}
|
||||
@ -3830,7 +3830,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
||||
}
|
||||
}
|
||||
|
||||
g_progr_ftotal += file_queue.size();
|
||||
g_progr_ftotal += ::size32(file_queue);
|
||||
|
||||
u64 total_files_size = 0;
|
||||
|
||||
@ -3856,8 +3856,9 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
||||
#endif
|
||||
// Set low priority
|
||||
thread_ctrl::scoped_priority low_prio(-1);
|
||||
u32 inc_fdone = 1;
|
||||
|
||||
for (usz func_i = fnext++, inc_fdone = 1; func_i < file_queue.size(); func_i = fnext++, g_progr_fdone += std::exchange(inc_fdone, 1))
|
||||
for (usz func_i = fnext++; func_i < file_queue.size(); func_i = fnext++, g_progr_fdone += std::exchange(inc_fdone, 1))
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
@ -4838,8 +4839,8 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
|
||||
jit->fin();
|
||||
}
|
||||
|
||||
usz index = 0;
|
||||
usz max_count = 0;
|
||||
u32 index = 0;
|
||||
u32 max_count = 0;
|
||||
|
||||
for (const auto& func : info.funcs)
|
||||
{
|
||||
@ -4849,7 +4850,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
|
||||
}
|
||||
}
|
||||
|
||||
usz pending_progress = umax;
|
||||
u32 pending_progress = umax;
|
||||
|
||||
bool early_exit = false;
|
||||
|
||||
|
@ -152,9 +152,9 @@ Function* PPUTranslator::Translate(const ppu_function& info)
|
||||
// Don't emit check in small blocks without terminator
|
||||
bool need_check = info.size >= 16;
|
||||
|
||||
for (u32 addr = m_addr; addr < m_addr + info.size; addr += 4)
|
||||
for (u64 addr = m_addr; addr < m_addr + info.size; addr += 4)
|
||||
{
|
||||
const u32 op = *ensure(m_info.get_ptr<u32>(addr + base));
|
||||
const u32 op = *ensure(m_info.get_ptr<u32>(::narrow<u32>(addr + base)));
|
||||
|
||||
switch (g_ppu_itype.decode(op))
|
||||
{
|
||||
@ -250,7 +250,7 @@ Function* PPUTranslator::Translate(const ppu_function& info)
|
||||
// Reset MMIO hint
|
||||
m_may_be_mmio = true;
|
||||
|
||||
const u32 op = *ensure(m_info.get_ptr<u32>(m_addr + base));
|
||||
const u32 op = *ensure(m_info.get_ptr<u32>(::narrow<u32>(m_addr + base)));
|
||||
|
||||
(this->*(s_ppu_decoder.decode(op)))({op});
|
||||
|
||||
@ -368,11 +368,11 @@ void PPUTranslator::CallFunction(u64 target, Value* indirect)
|
||||
const u64 base = m_reloc ? m_reloc->addr : 0;
|
||||
const u32 caddr = m_info.segs[0].addr;
|
||||
const u32 cend = caddr + m_info.segs[0].size - 1;
|
||||
const u64 _target = target + base;
|
||||
const u32 _target = ::narrow<u32>(target + base);
|
||||
|
||||
if (_target >= caddr && _target <= cend)
|
||||
{
|
||||
std::unordered_set<u64> passed_targets{_target};
|
||||
std::unordered_set<u32> passed_targets{_target};
|
||||
|
||||
u32 target_last = _target;
|
||||
|
||||
@ -663,7 +663,7 @@ Value* PPUTranslator::ReadMemory(Value* addr, Type* type, bool is_be, u32 align)
|
||||
|
||||
m_may_be_mmio = false;
|
||||
|
||||
if (auto ptr = m_info.get_ptr<instructions_to_test>(std::max<u32>(m_info.segs[0].addr, (m_reloc ? m_reloc->addr : 0) + utils::sub_saturate<u32>(m_addr, sizeof(instructions_to_test) / 2))))
|
||||
if (auto ptr = m_info.get_ptr<instructions_to_test>(std::max<u32>(m_info.segs[0].addr, (m_reloc ? m_reloc->addr : 0) + utils::sub_saturate<u32>(::narrow<u32>(m_addr), sizeof(instructions_to_test) / 2))))
|
||||
{
|
||||
if (ppu_test_address_may_be_mmio(std::span(ptr->insts)))
|
||||
{
|
||||
@ -726,11 +726,11 @@ void PPUTranslator::WriteMemory(Value* addr, Value* value, bool is_be, u32 align
|
||||
be_t<u32> insts[128];
|
||||
};
|
||||
|
||||
if (auto ptr = m_info.get_ptr<instructions_to_test>(std::max<u32>(m_info.segs[0].addr, (m_reloc ? m_reloc->addr : 0) + utils::sub_saturate<u32>(m_addr, sizeof(instructions_to_test) / 2))))
|
||||
if (auto ptr = m_info.get_ptr<instructions_to_test>(std::max<u32>(m_info.segs[0].addr, (m_reloc ? m_reloc->addr : 0) + utils::sub_saturate<u32>(::narrow<u32>(m_addr), sizeof(instructions_to_test) / 2))))
|
||||
{
|
||||
if (ppu_test_address_may_be_mmio(std::span(ptr->insts)))
|
||||
{
|
||||
ppu_log.notice("LLVM: Detected potential MMIO32 write at [0x%08x]", m_addr + (m_reloc ? m_reloc->addr : 0));
|
||||
ppu_log.notice("LLVM: Detected potential MMIO32 write at [0x%08x]", m_addr + m_reloc ? m_reloc->addr : 0);
|
||||
Call(GetType<void>(), "__write_maybe_mmio32", m_base, addr, value);
|
||||
return;
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ void PPUTranslator::VMADDFP(ppu_opcode_t op)
|
||||
auto [a, b, c] = get_vrs<f32[4]>(op.va, op.vb, op.vc);
|
||||
|
||||
// Optimization: Emit only a floating multiply if the addend is zero
|
||||
if (auto [ok, data] = get_const_vector(b.value, m_addr); ok)
|
||||
if (auto [ok, data] = get_const_vector(b.value, ::narrow<u32>(m_addr)); ok)
|
||||
{
|
||||
if (data == v128::from32p(1u << 31))
|
||||
{
|
||||
@ -1348,7 +1348,7 @@ void PPUTranslator::VNMSUBFP(ppu_opcode_t op)
|
||||
auto [a, b, c] = get_vrs<f32[4]>(op.va, op.vb, op.vc);
|
||||
|
||||
// Optimization: Emit only a floating multiply if the addend is zero
|
||||
if (const auto [ok, data] = get_const_vector(b.value, m_addr); ok)
|
||||
if (const auto [ok, data] = get_const_vector(b.value, ::narrow<u32>(m_addr)); ok)
|
||||
{
|
||||
if (data == v128{})
|
||||
{
|
||||
@ -1552,7 +1552,7 @@ void PPUTranslator::VSEL(ppu_opcode_t op)
|
||||
const auto c = get_vr<u32[4]>(op.vc);
|
||||
|
||||
// Check if the constant mask doesn't require bit granularity
|
||||
if (auto [ok, mask] = get_const_vector(c.value, m_addr); ok)
|
||||
if (auto [ok, mask] = get_const_vector(c.value, ::narrow<u32>(m_addr)); ok)
|
||||
{
|
||||
bool sel_32 = true;
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
@ -3671,7 +3671,7 @@ void PPUTranslator::LWZ(ppu_opcode_t op)
|
||||
};
|
||||
|
||||
// Quick invalidation: expect exact MMIO address, so if the register is being reused with different offset than it's likely not MMIO
|
||||
if (auto ptr = m_info.get_ptr<instructions_data>(m_addr + 4 + (m_reloc ? m_reloc->addr : 0)))
|
||||
if (auto ptr = m_info.get_ptr<instructions_data>(::narrow<u32>(m_addr + 4 + (m_reloc ? m_reloc->addr : 0))))
|
||||
{
|
||||
for (u32 inst : ptr->insts)
|
||||
{
|
||||
@ -3774,7 +3774,7 @@ void PPUTranslator::STW(ppu_opcode_t op)
|
||||
};
|
||||
|
||||
// Quick invalidation: expect exact MMIO address, so if the register is being reused with different offset than it's likely not MMIO
|
||||
if (auto ptr = m_info.get_ptr<instructions_data>(m_addr + 4 + (m_reloc ? m_reloc->addr : 0)))
|
||||
if (auto ptr = m_info.get_ptr<instructions_data>(::narrow<u32>(m_addr + 4 + (m_reloc ? m_reloc->addr : 0))))
|
||||
{
|
||||
for (u32 inst : ptr->insts)
|
||||
{
|
||||
|
@ -6193,7 +6193,7 @@ spu_exec_object spu_thread::capture_memory_as_elf(std::span<spu_memory_segment_d
|
||||
|
||||
if (auto [vm_addr, ok] = vm::try_get_addr(seg.src_addr); ok)
|
||||
{
|
||||
if (!vm::try_access(vm_addr, data.data(), data.size(), false))
|
||||
if (!vm::try_access(vm_addr, data.data(), ::size32(data), false))
|
||||
{
|
||||
spu_log.error("capture_memory_as_elf(): Failed to read {0x%x..0x%x}, aborting capture.", +vm_addr, vm_addr + seg.segment_size - 1);
|
||||
spu_exec.set_error(elf_error::stream_data);
|
||||
|
@ -308,9 +308,9 @@ error_code sys_ss_secure_rtc(u64 cmd, u64 a2, u64 a3, u64 a4)
|
||||
return 0x80010500; // bad packet id
|
||||
|
||||
// a3 is actual output, not 100% sure, but best guess is its tb val
|
||||
vm::write64(a3, get_timebased_time());
|
||||
vm::write64(::narrow<u32>(a3), get_timebased_time());
|
||||
// a4 is a pointer to status, non 0 on error
|
||||
vm::write64(a4, 0);
|
||||
vm::write64(::narrow<u32>(a4), 0);
|
||||
return CELL_OK;
|
||||
}
|
||||
else if (cmd == 0x3003)
|
||||
|
@ -492,7 +492,7 @@ namespace vm
|
||||
|
||||
const auto diff = range_lock - g_range_lock_set;
|
||||
|
||||
if (bits != umax && !bits.bit_test_set(diff))
|
||||
if (bits != umax && !bits.bit_test_set(::narrow<u32>(diff)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -557,7 +557,7 @@ namespace vm
|
||||
for (u64 hi = addr2 >> 16, max = (addr2 + size2 - 1) >> 16; hi <= max; hi++)
|
||||
{
|
||||
u64 addr3 = addr2;
|
||||
u32 size3 = std::min<u64>(addr2 + size2, utils::align(addr2, 0x10000)) - addr2;
|
||||
u64 size3 = std::min<u64>(addr2 + size2, utils::align(addr2, 0x10000)) - addr2;
|
||||
|
||||
if (u64 is_shared = g_shmem[hi]) [[unlikely]]
|
||||
{
|
||||
@ -2405,8 +2405,10 @@ void fmt_class_string<vm::_ptr_base<const char, u32>>::format(std::string& out,
|
||||
return;
|
||||
}
|
||||
|
||||
const u32 addr = ::narrow<u32>(arg);
|
||||
|
||||
// Filter certainly invalid addresses
|
||||
if (!vm::check_addr(arg, vm::page_readable))
|
||||
if (!vm::check_addr(addr, vm::page_readable))
|
||||
{
|
||||
out += reinterpret_cast<const char*>(u8"«INVALID_ADDRESS:");
|
||||
fmt_class_string<u32>::format(out, arg);
|
||||
@ -2418,7 +2420,7 @@ void fmt_class_string<vm::_ptr_base<const char, u32>>::format(std::string& out,
|
||||
|
||||
out += reinterpret_cast<const char*>(u8"“");
|
||||
|
||||
if (!vm::read_string(arg, umax, out, true))
|
||||
if (!vm::read_string(addr, umax, out, true))
|
||||
{
|
||||
// Revert changes
|
||||
out.resize(start);
|
||||
|
@ -295,8 +295,8 @@ namespace
|
||||
r = upload_untouched_naive(src.data(), dst.data(), count);
|
||||
#endif
|
||||
|
||||
min_index = r;
|
||||
max_index = r >> 32;
|
||||
min_index = ::narrow<T>(r);
|
||||
max_index = ::narrow<T>(r >> 32);
|
||||
|
||||
return std::make_tuple(min_index, max_index, count);
|
||||
}
|
||||
@ -401,8 +401,8 @@ namespace
|
||||
r = upload_untouched_naive(src.data(), dst.data(), count, restart_index);
|
||||
#endif
|
||||
|
||||
min_index = r;
|
||||
max_index = r >> 32;
|
||||
min_index = ::narrow<T>(r);
|
||||
max_index = ::narrow<T>(r >> 32);
|
||||
|
||||
return std::make_tuple(min_index, max_index, count);
|
||||
}
|
||||
|
@ -3182,7 +3182,7 @@ namespace rsx
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
const u32 found_cmds_count = std::min<u32>(-count, ::size32(pcs_of_valid_cmds) - 1 - index_of_get);
|
||||
const u32 found_cmds_count = static_cast<u32>(std::min<s64>(-count, pcs_of_valid_cmds.size() - 1LL - index_of_get));
|
||||
|
||||
return {found_cmds_count, pcs_of_valid_cmds[index_of_get + found_cmds_count]};
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ namespace utils
|
||||
, m_size(utils::align(size, 0x10000))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_handle = ensure(::CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_EXECUTE_READWRITE, 0, m_size, nullptr));
|
||||
m_handle = ensure(::CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_EXECUTE_READWRITE, 0, ::narrow<DWORD>(m_size), nullptr));
|
||||
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||
m_file = -1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user