This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
hilbert-os/euler/source/memory/new.cpp

13 lines
302 B
C++

#include <euler/heap.hpp>
void *operator new(uint64_t size) {
void *ptr = euler::alloc(size + 8);
*(uint64_t *)ptr = size + 8;
return (uint8_t *)ptr + 8;
}
void *operator new[](uint64_t size) {
void *ptr = euler::alloc(size + 8);
*(uint64_t *)ptr = size + 8;
return (uint8_t *)ptr + 8;
}