mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:07:46 +00:00
Kernel/riscv64: Take the memory map from the FDT and dump it
For this the BootInfo struct was made architecture specific
This commit is contained in:
parent
21a21c6a11
commit
d3f6b03733
10 changed files with 368 additions and 119 deletions
25
Kernel/Arch/riscv64/CPU.cpp
Normal file
25
Kernel/Arch/riscv64/CPU.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Leon Albrecht <leon.a@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/riscv64/CPU.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.h>
|
||||
#include <Userland/Libraries/LibDeviceTree/Validation.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
BootInfo s_boot_info;
|
||||
|
||||
alignas(PAGE_SIZE) __attribute__((section(".bss.fdt"))) u8 s_fdt_storage[fdt_storage_size];
|
||||
|
||||
void dump_fdt()
|
||||
{
|
||||
auto& header = *bit_cast<DeviceTree::FlattenedDeviceTreeHeader*>(&s_fdt_storage[0]);
|
||||
auto fdt = ReadonlyBytes(s_fdt_storage, header.totalsize);
|
||||
MUST(DeviceTree::dump(header, fdt));
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue