Switching to real page sizes, not allocation granularity.
This commit is contained in:
@@ -21,8 +21,13 @@ namespace xe {
|
||||
namespace memory {
|
||||
|
||||
// Returns the native page size of the system, in bytes.
|
||||
// This should be ~4KiB.
|
||||
size_t page_size();
|
||||
|
||||
// Returns the allocation granularity of the system, in bytes.
|
||||
// This is likely 64KiB.
|
||||
size_t allocation_granularity();
|
||||
|
||||
enum class PageAccess {
|
||||
kNoAccess = 0,
|
||||
kReadOnly = 1 << 0,
|
||||
|
||||
@@ -15,6 +15,16 @@ namespace xe {
|
||||
namespace memory {
|
||||
|
||||
size_t page_size() {
|
||||
static size_t value = 0;
|
||||
if (!value) {
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
value = si.dwPageSize;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t allocation_granularity() {
|
||||
static size_t value = 0;
|
||||
if (!value) {
|
||||
SYSTEM_INFO si;
|
||||
|
||||
Reference in New Issue
Block a user