mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-09 18:40:27 +00:00
Use utils::c_page_size
This commit is contained in:
parent
278ae7763a
commit
fddb6a31a7
@ -1,33 +1,26 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
|
#include "util/vm.hpp"
|
||||||
#include "StrFmt.h"
|
#include "StrFmt.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if defined(ARCH_X64)
|
|
||||||
#define HOST_PAGE_SIZE 4096u
|
|
||||||
#else
|
|
||||||
#define HOST_PAGE_SIZE get_page_size()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
{
|
{
|
||||||
class address_range_vector;
|
class address_range_vector;
|
||||||
|
|
||||||
long get_page_size();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helpers
|
* Helpers
|
||||||
*/
|
*/
|
||||||
static inline u32 page_start(u32 addr)
|
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)
|
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)
|
static inline u32 page_end(u32 addr)
|
||||||
@ -37,7 +30,7 @@ namespace utils
|
|||||||
|
|
||||||
static inline u32 is_page_aligned(u32 val)
|
static inline u32 is_page_aligned(u32 val)
|
||||||
{
|
{
|
||||||
return (val & (HOST_PAGE_SIZE - 1)) == 0;
|
return (val & (c_page_size - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (p.second.prot != utils::protection::rw)
|
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)
|
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;
|
page.prot = utils::protection::no;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -844,7 +844,7 @@ namespace rsx
|
|||||||
|
|
||||||
if (page.prot != utils::protection::rw)
|
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;
|
page.prot = utils::protection::rw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ namespace rsx
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// R/W to stale block, unload it and move on
|
// 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);
|
m_locked_pages[location].erase(page_address);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user