mem: implement most of StandardAllocator (#860)

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:
SciresM 2020-03-29 14:43:16 -07:00 committed by GitHub
parent 7502e2174f
commit 87ec045a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 5473 additions and 43 deletions

View file

@ -101,10 +101,19 @@ namespace ams::os {
}
};
NX_INLINE u32 GetCurrentThreadPriority() {
u32 prio;
ALWAYS_INLINE s32 GetCurrentThreadPriority() {
s32 prio;
R_ABORT_UNLESS(svcGetThreadPriority(&prio, CUR_THREAD_HANDLE));
return prio;
}
/* TODO: ThreadManager? */
ALWAYS_INLINE s32 GetCurrentProcessorNumber() {
return svcGetCurrentProcessorNumber();
}
ALWAYS_INLINE s32 GetCurrentCoreNumber() {
return GetCurrentProcessorNumber();
}
}