Kernel: Store memory region size as uint64_t

On 32 bit target, we were storing 32 bit physical region sizes which
would truncate regions > 4 GiB
This commit is contained in:
2026-04-07 03:09:20 +03:00
parent 7fb27b16e8
commit 7e907b70f6
4 changed files with 7 additions and 7 deletions

View File

@@ -44,7 +44,7 @@ namespace Kernel
struct BootModule struct BootModule
{ {
paddr_t start; paddr_t start;
size_t size; uint64_t size;
}; };
struct BootInfo struct BootInfo

View File

@@ -10,7 +10,7 @@ namespace Kernel
class PhysicalRange class PhysicalRange
{ {
public: public:
PhysicalRange(paddr_t, size_t); PhysicalRange(paddr_t, uint64_t);
paddr_t reserve_page(); paddr_t reserve_page();
void release_page(paddr_t); void release_page(paddr_t);

View File

@@ -12,7 +12,7 @@ namespace Kernel
struct ReservedRegion struct ReservedRegion
{ {
paddr_t paddr; paddr_t paddr;
size_t size; uint64_t size;
}; };
static BAN::Vector<ReservedRegion> get_reserved_regions() static BAN::Vector<ReservedRegion> get_reserved_regions()
@@ -138,10 +138,10 @@ namespace Kernel
MUST(m_physical_ranges.emplace_back(e_start, e_end - e_start)); MUST(m_physical_ranges.emplace_back(e_start, e_end - e_start));
} }
size_t total_kibi_bytes = 0; uint64_t total_kibi_bytes = 0;
for (auto& range : m_physical_ranges) for (auto& range : m_physical_ranges)
{ {
const size_t kibi_bytes = range.usable_memory() / 1024; const uint64_t kibi_bytes = range.usable_memory() / 1024;
dprintln("RAM {8H}->{8H} ({}.{3} MiB)", range.start(), range.end(), kibi_bytes / 1024, kibi_bytes % 1024); dprintln("RAM {8H}->{8H} ({}.{3} MiB)", range.start(), range.end(), kibi_bytes / 1024, kibi_bytes % 1024);
total_kibi_bytes += kibi_bytes; total_kibi_bytes += kibi_bytes;
} }
@@ -152,7 +152,7 @@ namespace Kernel
{ {
const auto modules = BAN::move(g_boot_info.modules); const auto modules = BAN::move(g_boot_info.modules);
size_t kibi_bytes = 0; uint64_t kibi_bytes = 0;
for (const auto& module : modules) for (const auto& module : modules)
{ {
vaddr_t start = module.start; vaddr_t start = module.start;

View File

@@ -10,7 +10,7 @@ namespace Kernel
static constexpr size_t bits_per_page = PAGE_SIZE * 8; static constexpr size_t bits_per_page = PAGE_SIZE * 8;
PhysicalRange::PhysicalRange(paddr_t paddr, size_t size) PhysicalRange::PhysicalRange(paddr_t paddr, uint64_t size)
: m_paddr(paddr) : m_paddr(paddr)
, m_page_count(size / PAGE_SIZE) , m_page_count(size / PAGE_SIZE)
, m_free_pages(m_page_count) , m_free_pages(m_page_count)