Kernel: pass ref down to Object and wrap ID counter into kernel state

This commit is contained in:
Weiyi Wang 2018-10-13 17:24:51 -04:00
parent 87426b29ff
commit 751ebe55e9
18 changed files with 31 additions and 22 deletions

View file

@ -14,8 +14,6 @@
namespace Kernel {
std::atomic<u32> Object::next_object_id{0};
/// Initialize the kernel
KernelSystem::KernelSystem(u32 system_mode) {
ConfigMem::Init();
@ -25,8 +23,6 @@ KernelSystem::KernelSystem(u32 system_mode) {
resource_limits = std::make_unique<ResourceLimitList>(*this);
Kernel::ThreadingInit();
Kernel::TimersInit();
Object::next_object_id = 0;
// TODO(Subv): Start the process ids from 10 for now, as lower PIDs are
// reserved for low-level services
Process::next_process_id = 10;
@ -51,4 +47,8 @@ const ResourceLimitList& KernelSystem::ResourceLimit() const {
return *resource_limits;
}
u32 KernelSystem::GenerateObjectID() {
return next_object_id++;
}
} // namespace Kernel