From fddb6a31a77d8f19a4df89733b4cbe154255d406 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 2 Jul 2022 21:25:55 +0300 Subject: [PATCH] Use utils::c_page_size --- Utilities/address_range.h | 15 ++++----------- rpcs3/Emu/RSX/RSXZCULL.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Utilities/address_range.h b/Utilities/address_range.h index 6610a2e39a..bb5c14ec5c 100644 --- a/Utilities/address_range.h +++ b/Utilities/address_range.h @@ -1,33 +1,26 @@ #pragma once #include "util/types.hpp" +#include "util/vm.hpp" #include "StrFmt.h" #include #include -#if defined(ARCH_X64) -#define HOST_PAGE_SIZE 4096u -#else -#define HOST_PAGE_SIZE get_page_size() -#endif - namespace utils { class address_range_vector; - long get_page_size(); - /** * Helpers */ static inline u32 page_start(u32 addr) { - return addr & ~(HOST_PAGE_SIZE - 1); + return addr & ~(c_page_size - 1); } static inline u32 next_page(u32 addr) { - return page_start(addr) + HOST_PAGE_SIZE; + return page_start(addr) + c_page_size; } static inline u32 page_end(u32 addr) @@ -37,7 +30,7 @@ namespace utils static inline u32 is_page_aligned(u32 val) { - return (val & (HOST_PAGE_SIZE - 1)) == 0; + return (val & (c_page_size - 1)) == 0; } diff --git a/rpcs3/Emu/RSX/RSXZCULL.cpp b/rpcs3/Emu/RSX/RSXZCULL.cpp index 006e4c5c9d..12d4a61871 100644 --- a/rpcs3/Emu/RSX/RSXZCULL.cpp +++ b/rpcs3/Emu/RSX/RSXZCULL.cpp @@ -23,7 +23,7 @@ namespace rsx { if (p.second.prot != utils::protection::rw) { - utils::memory_protect(vm::base(p.first), utils::get_page_size(), utils::protection::rw); + utils::memory_protect(vm::base(p.first), utils::c_page_size, utils::protection::rw); } } @@ -796,7 +796,7 @@ namespace rsx if (page.prot == utils::protection::rw) { - utils::memory_protect(vm::base(page_address), utils::get_page_size(), utils::protection::no); + utils::memory_protect(vm::base(page_address), utils::c_page_size, utils::protection::no); page.prot = utils::protection::no; } } @@ -844,7 +844,7 @@ namespace rsx if (page.prot != utils::protection::rw) { - utils::memory_protect(vm::base(this_address), utils::get_page_size(), utils::protection::rw); + utils::memory_protect(vm::base(this_address), utils::c_page_size, utils::protection::rw); page.prot = utils::protection::rw; } @@ -890,7 +890,7 @@ namespace rsx else { // R/W to stale block, unload it and move on - utils::memory_protect(vm::base(page_address), utils::get_page_size(), utils::protection::rw); + utils::memory_protect(vm::base(page_address), utils::c_page_size, utils::protection::rw); m_locked_pages[location].erase(page_address); return true;