Compare commits
No commits in common. "2e24e091467c64a7b3720af34763469b5ff050d5" and "cedcfa9c63f4732835f4b6722f0c21ed3a26eaf9" have entirely different histories.
2e24e09146
...
cedcfa9c63
@ -105,12 +105,10 @@ namespace MemoryManager
|
|||||||
// there's no point in continuing.
|
// there's no point in continuing.
|
||||||
auto bitmap_pages = g_frame_bitmap.size_in_bytes() / ARCH_PAGE_SIZE;
|
auto bitmap_pages = g_frame_bitmap.size_in_bytes() / ARCH_PAGE_SIZE;
|
||||||
|
|
||||||
auto virtual_bitmap_base =
|
auto virtual_bitmap_base = KernelVM::alloc_several_pages(bitmap_pages).release_value();
|
||||||
KernelVM::alloc_several_pages(bitmap_pages)
|
|
||||||
.expect_value("Unable to allocate virtual memory for the physical frame bitmap, cannot continue");
|
|
||||||
map_frames_at(virtual_bitmap_base, (u64)g_frame_bitmap.location(), bitmap_pages,
|
map_frames_at(virtual_bitmap_base, (u64)g_frame_bitmap.location(), bitmap_pages,
|
||||||
MMU::ReadWrite | MMU::NoExecute)
|
MMU::ReadWrite | MMU::NoExecute)
|
||||||
.expect_value("Unable to map the physical frame bitmap to virtual memory, cannot continue");
|
.release_value();
|
||||||
|
|
||||||
g_frame_bitmap.initialize((void*)virtual_bitmap_base, g_frame_bitmap.size_in_bytes());
|
g_frame_bitmap.initialize((void*)virtual_bitmap_base, g_frame_bitmap.size_in_bytes());
|
||||||
}
|
}
|
||||||
@ -294,7 +292,7 @@ namespace MemoryManager
|
|||||||
{
|
{
|
||||||
auto rc = MMU::get_flags(address);
|
auto rc = MMU::get_flags(address);
|
||||||
if (rc.has_error()) return false;
|
if (rc.has_error()) return false;
|
||||||
if (rc.value() & MMU::ReadWrite) return true;
|
if (rc.release_value() & MMU::ReadWrite) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ void MemoryMapIterator::rewind()
|
|||||||
m_cur_ent = 0;
|
m_cur_ent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Option<MemoryMapEntry> MemoryMapIterator::at(usize index) const
|
Result<MemoryMapEntry> MemoryMapIterator::at(usize index) const
|
||||||
{
|
{
|
||||||
if (index >= m_mmap_entries) return {};
|
if (index >= m_mmap_entries) return err(ERANGE);
|
||||||
return memory_map_entry_from_mmapent(m_base_ent + index);
|
return memory_map_entry_from_mmapent(m_base_ent + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
Option<MemoryMapEntry> MemoryMapIterator::next()
|
Result<MemoryMapEntry> MemoryMapIterator::next()
|
||||||
{
|
{
|
||||||
return at(m_cur_ent++);
|
return at(m_cur_ent++);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ MemoryMapEntry MemoryMapIterator::largest_free()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return at(largest_index).value();
|
return at(largest_index).release_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryMapEntry MemoryMapIterator::highest()
|
MemoryMapEntry MemoryMapIterator::highest()
|
||||||
@ -83,5 +83,5 @@ MemoryMapEntry MemoryMapIterator::highest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return at(highest_index).value();
|
return at(highest_index).release_value();
|
||||||
}
|
}
|
@ -44,13 +44,13 @@ class MemoryMapIterator
|
|||||||
|
|
||||||
void rewind();
|
void rewind();
|
||||||
|
|
||||||
Option<MemoryMapEntry> next();
|
Result<MemoryMapEntry> next();
|
||||||
|
|
||||||
MemoryMapEntry largest_free();
|
MemoryMapEntry largest_free();
|
||||||
|
|
||||||
MemoryMapEntry highest();
|
MemoryMapEntry highest();
|
||||||
|
|
||||||
Option<MemoryMapEntry> at(usize index) const;
|
Result<MemoryMapEntry> at(usize index) const;
|
||||||
|
|
||||||
usize entries() const
|
usize entries() const
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,7 @@ namespace Scheduler
|
|||||||
g_idle.ticks_left = 1;
|
g_idle.ticks_left = 1;
|
||||||
|
|
||||||
// Map some stack for the idle task
|
// Map some stack for the idle task
|
||||||
u64 idle_stack_vm = MemoryManager::alloc_for_kernel(1, MMU::NoExecute | MMU::ReadWrite)
|
u64 idle_stack_vm = MemoryManager::alloc_for_kernel(1, MMU::NoExecute | MMU::ReadWrite).release_value();
|
||||||
.expect_value("Error while setting up the idle task, cannot continue");
|
|
||||||
|
|
||||||
Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE};
|
Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE};
|
||||||
g_idle.set_sp(idle_stack.top());
|
g_idle.set_sp(idle_stack.top());
|
||||||
|
Loading…
Reference in New Issue
Block a user