Common: Make __pagesize unsigned

This commit is contained in:
Stenzek 2023-07-22 14:22:06 +10:00 committed by Connor McLaughlin
parent 9191e8ce91
commit eae29bb1f2
3 changed files with 6 additions and 5 deletions

View File

@ -78,6 +78,7 @@ namespace Common
template <typename T>
static constexpr T PageAlign(T size)
{
static_assert(std::has_single_bit(__pagesize), "Page size is a power of 2");
return Common::AlignUpPow2(size, __pagesize);
}

View File

@ -108,7 +108,8 @@ static void SysPageFaultSignalFilter(int signal, siginfo_t* siginfo, void* ctx)
void* const exception_pc = nullptr;
#endif
const PageFaultInfo pfi{(uptr)exception_pc, (uptr)siginfo->si_addr & ~__pagemask};
const PageFaultInfo pfi{
reinterpret_cast<uptr>(exception_pc), reinterpret_cast<uptr>(siginfo->si_addr) & ~static_cast<uptr>(__pagemask)};
s_in_exception_handler = true;

View File

@ -81,10 +81,9 @@
// Defines the memory page size for the target platform at compilation. All supported platforms
// (which means Intel only right now) have a 4k granularity.
#define PCSX2_PAGESIZE 0x1000
static constexpr int __pagesize = PCSX2_PAGESIZE;
static constexpr int __pageshift = 12;
static constexpr size_t __pagemask = PCSX2_PAGESIZE - 1;
static constexpr unsigned int __pagesize = 0x1000;
static constexpr unsigned int __pageshift = 12;
static constexpr unsigned int __pagemask = __pagesize - 1;
// --------------------------------------------------------------------------------------
// Microsoft Visual Studio