mem: implement most of StandardAllocator

This was tested using `https://github.com/node-dot-cpp/alloc-test` plus a few other by-hand tests.

It seems to work for the case we care about (sysmodules without thread cache-ing).

External users are advised to build with assertions on and contact SciresM if you find issues.

This is a lot of code to have gotten right in one go, and it was written mostly after midnight while sick, so there are probably un-noticed issues.
This commit is contained in:
Michael Scire
2020-03-28 16:20:00 -07:00
parent 9bb5af9823
commit cc24a33600
47 changed files with 5473 additions and 43 deletions

View File

@@ -60,6 +60,8 @@ namespace ams::svc {
T pointer;
public:
constexpr ALWAYS_INLINE UserPointer(T p) : pointer(p) { /* ... */ }
constexpr ALWAYS_INLINE T GetPointerUnsafe() { return this->pointer; }
};
template<typename T>
@@ -168,11 +170,11 @@ namespace ams::svc {
InitialProcessIdRangeInfo_Maximum = 1,
};
enum PhysicalMemoryInfo : u64 {
PhysicalMemoryInfo_Application = 0,
PhysicalMemoryInfo_Applet = 1,
PhysicalMemoryInfo_System = 2,
PhysicalMemoryInfo_SystemUnsafe = 3,
enum PhysicalMemorySystemInfo : u64 {
PhysicalMemorySystemInfo_Application = 0,
PhysicalMemorySystemInfo_Applet = 1,
PhysicalMemorySystemInfo_System = 2,
PhysicalMemorySystemInfo_SystemUnsafe = 3,
};
enum LastThreadInfoFlag : u32 {