CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/MemArena.h
Views: 1401
// Copyright (C) 2003 Dolphin Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official SVN repository and contact information can be found at15// http://code.google.com/p/dolphin-emu/1617#pragma once1819#include <cstdint>2021#ifdef _WIN3222#include "CommonWindows.h"23#elif defined(__APPLE__)24#include <mach/mach.h>25#endif2627#include "Common/CommonTypes.h"2829// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.30// Multiple views can mirror the same section of the block, which makes it very convient for emulating31// memory mirrors.3233struct MemArenaData;3435class MemArena {36public:37size_t roundup(size_t x);38bool GrabMemSpace(size_t size);39void ReleaseSpace();40void *CreateView(s64 offset, size_t size, void *base = 0);41void ReleaseView(s64 offset, void *view, size_t size);4243// This only finds 1 GB in 32-bit44u8 *Find4GBBase();45bool NeedsProbing();4647private:48#ifdef _WIN3249HANDLE hMemoryMapping;50SYSTEM_INFO sysInfo;51#elif defined(__APPLE__)52size_t vm_size;53vm_address_t vm_mem; // same type as vm_address_t54#else55int fd = -1;56#endif57};585960