mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Some semantic cleanup
This commit is contained in:
1 parent
7a75119ed0
commit
f45a7cf06b
4 files changed
+9
-7
No files matched your search
+1
-1
@@ -136,7 +136,7 @@ public:
|
||||
// Call this when shutting down. Don't rely on the destructor, even though it'll do the job.
|
||||
void FreeCodeSpace() {
|
||||
ProtectMemoryPages(region, region_size, MEM_PROT_READ | MEM_PROT_WRITE);
|
||||
FreeMemoryPages(region, region_size);
|
||||
FreeExecutableMemory(region, region_size);
|
||||
region = nullptr;
|
||||
writableRegion = nullptr;
|
||||
region_size = 0;
|
||||
|
||||
@@ -30,15 +30,11 @@ template <class T, int N>
|
||||
class FixedSizeQueue {
|
||||
public:
|
||||
FixedSizeQueue() {
|
||||
// Allocate aligned memory, just because.
|
||||
//int sizeInBytes = N * sizeof(T);
|
||||
//storage_ = (T *)AllocateMemoryPages(sizeInBytes);
|
||||
storage_ = new T[N];
|
||||
clear();
|
||||
}
|
||||
|
||||
~FixedSizeQueue() {
|
||||
// FreeMemoryPages((void *)storage_, N * sizeof(T));
|
||||
delete [] storage_;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +275,10 @@ void FreeMemoryPages(void *ptr, size_t size) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void FreeExecutableMemory(void *ptr, size_t size) {
|
||||
FreeMemoryPages(ptr, size);
|
||||
}
|
||||
|
||||
void FreeAlignedMemory(void* ptr) {
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
+4
-2
@@ -31,9 +31,11 @@ bool PlatformIsWXExclusive();
|
||||
|
||||
// Note that some platforms go through special contortions to allocate executable memory. So for memory
|
||||
// that's intended for execution, allocate it first using AllocateExecutableMemory, then modify protection as desired.
|
||||
// AllocateMemoryPages is simpler and more generic. Note that on W^X platforms, this will return executable but not writable
|
||||
// memory!
|
||||
// AllocateMemoryPages is simpler and more generic.
|
||||
// Note that on W^X platforms, this will return writable memory that can later be changed to executable!
|
||||
void* AllocateExecutableMemory(size_t size);
|
||||
void FreeExecutableMemory(void *ptr, size_t size);
|
||||
|
||||
void* AllocateMemoryPages(size_t size, uint32_t memProtFlags);
|
||||
// Note that on platforms returning PlatformIsWXExclusive, you cannot set a page to be both readable and writable at the same time.
|
||||
bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags);
|
||||
|
||||
Reference in new issue
Block a user