kern: implement enough of KPageTable to initialize a thread

This commit is contained in:
Michael Scire 2020-02-13 17:38:56 -08:00
parent c6d1579265
commit 8c93eb5712
31 changed files with 1475 additions and 270 deletions

View file

@ -34,9 +34,9 @@ namespace ams::kern {
}
static constexpr s32 GetBlockIndex(size_t num_pages) {
for (size_t i = 0; i < NumMemoryBlockPageShifts; i++) {
for (s32 i = static_cast<s32>(NumMemoryBlockPageShifts) - 1; i >= 0; i--) {
if (num_pages >= (size_t(1) << MemoryBlockPageShifts[i]) / PageSize) {
return static_cast<s32>(i);
return i;
}
}
return -1;