kernel: convert miscellaneous

This commit is contained in:
Liam
2023-03-06 23:08:53 -05:00
parent d1b53c8d82
commit 57f1d8ef8d
7 changed files with 80 additions and 93 deletions

View File

@ -132,7 +132,7 @@ protected:
template <typename Derived, typename Base>
class KAutoObjectWithSlabHeapAndContainer : public Base {
static_assert(std::is_base_of<KAutoObjectWithList, Base>::value);
static_assert(std::is_base_of_v<KAutoObjectWithList, Base>);
private:
static Derived* Allocate(KernelCore& kernel) {
@ -144,18 +144,18 @@ private:
}
public:
KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel_) : Base(kernel_), kernel(kernel_) {}
KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel_) : Base(kernel_) {}
virtual ~KAutoObjectWithSlabHeapAndContainer() {}
virtual void Destroy() override {
const bool is_initialized = this->IsInitialized();
uintptr_t arg = 0;
if (is_initialized) {
kernel.ObjectListContainer().Unregister(this);
Base::kernel.ObjectListContainer().Unregister(this);
arg = this->GetPostDestroyArgument();
this->Finalize();
}
Free(kernel, static_cast<Derived*>(this));
Free(Base::kernel, static_cast<Derived*>(this));
if (is_initialized) {
Derived::PostDestroy(arg);
}
@ -169,7 +169,7 @@ public:
}
size_t GetSlabIndex() const {
return SlabHeap<Derived>(kernel).GetObjectIndex(static_cast<const Derived*>(this));
return SlabHeap<Derived>(Base::kernel).GetObjectIndex(static_cast<const Derived*>(this));
}
public:
@ -209,9 +209,6 @@ public:
static size_t GetNumRemaining(KernelCore& kernel) {
return kernel.SlabHeap<Derived>().GetNumRemaining();
}
protected:
KernelCore& kernel;
};
} // namespace Kernel