1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 13:14:59 +00:00
serenity/Kernel/Arch/PC/BIOS.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

40 lines
1.1 KiB
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/StringView.h>
#include <Kernel/Arch/PC/BIOS.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/TypedMapping.h>
namespace Kernel {
MappedROM map_bios()
{
MappedROM mapping;
mapping.size = 128 * KiB;
mapping.paddr = PhysicalAddress(0xe0000);
mapping.region = MM.allocate_kernel_region(mapping.paddr, page_round_up(mapping.size), {}, Region::Access::Read);
return mapping;
}
MappedROM map_ebda()
{
auto ebda_segment_ptr = map_typed<u16>(PhysicalAddress(0x40e));
auto ebda_length_ptr_b0 = map_typed<u8>(PhysicalAddress(0x413));
auto ebda_length_ptr_b1 = map_typed<u8>(PhysicalAddress(0x414));
PhysicalAddress ebda_paddr(*ebda_segment_ptr << 4);
size_t ebda_size = (*ebda_length_ptr_b1 << 8) | *ebda_length_ptr_b0;
MappedROM mapping;
mapping.region = MM.allocate_kernel_region(ebda_paddr.page_base(), page_round_up(ebda_size), {}, Region::Access::Read);
mapping.offset = ebda_paddr.offset_in_page();
mapping.size = ebda_size;
mapping.paddr = ebda_paddr;
return mapping;
}
}