Kernel: Fix bitmap byte index calculation in PMM
No idea how I had not crashed here earlier, but running on real hw with a bit initrd ended up crashing :D
This commit is contained in:
parent
706c0816dd
commit
4b5a8196c3
|
|
@ -98,8 +98,9 @@ namespace Kernel
|
||||||
[this](size_t buffer_bit) -> bool
|
[this](size_t buffer_bit) -> bool
|
||||||
{
|
{
|
||||||
const size_t page_index = buffer_bit / bits_per_page;
|
const size_t page_index = buffer_bit / bits_per_page;
|
||||||
const size_t byte = buffer_bit / 8;
|
const size_t bit_index = buffer_bit % bits_per_page;
|
||||||
const size_t bit = buffer_bit % 8;
|
const size_t byte = bit_index / 8;
|
||||||
|
const size_t bit = bit_index % 8;
|
||||||
|
|
||||||
uint8_t current;
|
uint8_t current;
|
||||||
PageTable::with_fast_page(m_paddr + page_index * PAGE_SIZE, [¤t, byte] {
|
PageTable::with_fast_page(m_paddr + page_index * PAGE_SIZE, [¤t, byte] {
|
||||||
|
|
@ -113,8 +114,9 @@ namespace Kernel
|
||||||
[this](size_t buffer_bit) -> void
|
[this](size_t buffer_bit) -> void
|
||||||
{
|
{
|
||||||
const size_t page_index = buffer_bit / bits_per_page;
|
const size_t page_index = buffer_bit / bits_per_page;
|
||||||
const size_t byte = buffer_bit / 8;
|
const size_t bit_index = buffer_bit % bits_per_page;
|
||||||
const size_t bit = buffer_bit % 8;
|
const size_t byte = bit_index / 8;
|
||||||
|
const size_t bit = bit_index % 8;
|
||||||
PageTable::with_fast_page(m_paddr + page_index * PAGE_SIZE, [byte, bit] {
|
PageTable::with_fast_page(m_paddr + page_index * PAGE_SIZE, [byte, bit] {
|
||||||
volatile uint8_t& current = PageTable::fast_page_as_sized<volatile uint8_t>(byte);
|
volatile uint8_t& current = PageTable::fast_page_as_sized<volatile uint8_t>(byte);
|
||||||
current = current | (1u << bit);
|
current = current | (1u << bit);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue