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

@ -27,7 +27,7 @@ namespace ams::kern {
KVirtualAddress address;
size_t num_pages;
public:
constexpr KBlockInfo() : address(), num_pages() { /* ... */ }
constexpr KBlockInfo() : util::IntrusiveListBaseNode<KBlockInfo>(), address(), num_pages() { /* ... */ }
constexpr void Initialize(KVirtualAddress addr, size_t np) {
this->address = addr;
@ -82,9 +82,9 @@ namespace ams::kern {
BlockInfoList block_list;
KBlockInfoManager *manager;
public:
KPageGroup() : block_list(), manager() { /* ... */ }
explicit KPageGroup(KBlockInfoManager *m) : block_list(), manager(m) { /* ... */ }
~KPageGroup() { this->Finalize(); }
void Initialize(KBlockInfoManager *m);
void Finalize();
iterator begin() const { return this->block_list.begin(); }
@ -107,4 +107,14 @@ namespace ams::kern {
}
};
class KScopedPageGroup {
private:
KPageGroup *group;
public:
explicit ALWAYS_INLINE KScopedPageGroup(KPageGroup *gp) : group(gp) { group->Open(); }
explicit ALWAYS_INLINE KScopedPageGroup(KPageGroup &gp) : KScopedPageGroup(std::addressof(gp)) { /* ... */ }
ALWAYS_INLINE ~KScopedPageGroup() { group->Close(); }
};
}