mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
Don't leak FDT
This commit is contained in:
@@ -161,8 +161,13 @@ int AddressSpace::unmap(void *virt) {
|
||||
return 1;
|
||||
}
|
||||
FDT *AddressSpace::getFdt() {
|
||||
if (!_fdt) _fdt = new FDT();
|
||||
return _fdt;
|
||||
if (_fdt.get() == nullptr) {
|
||||
LockGuard l(_fdtLock);
|
||||
if (_fdt.get() == nullptr) {
|
||||
_fdt = UniquePtr(new FDT());
|
||||
}
|
||||
}
|
||||
return _fdt.get();
|
||||
}
|
||||
|
||||
static volatile struct limine_kernel_address_request kernel_address_request = {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "PointersCollection.hpp"
|
||||
#include "mutex.hpp"
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
@@ -44,9 +45,10 @@ public:
|
||||
|
||||
private:
|
||||
// Pointer to PML4 in HHDM
|
||||
uint64_t *PML4;
|
||||
uint64_t *PML4;
|
||||
|
||||
FDT *_fdt = nullptr;
|
||||
UniquePtr<FDT> _fdt;
|
||||
Mutex _fdtLock;
|
||||
};
|
||||
|
||||
extern AddressSpace *KERN_AddressSpace;
|
||||
|
||||
Reference in New Issue
Block a user