mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Fix a bug with auto-assigned VMA addresses
When calling vma_map or vma_create_map with an address of 0, the kernel would return colliding addresses.
This commit is contained in:
@@ -86,8 +86,6 @@ vm_space::add(uintptr_t base, obj::vm_area *area, util::bitset32 flags)
|
|||||||
if (!base)
|
if (!base)
|
||||||
base = min_auto_address;
|
base = min_auto_address;
|
||||||
|
|
||||||
uintptr_t end = base + area->size();
|
|
||||||
|
|
||||||
//TODO: optimize find/insert
|
//TODO: optimize find/insert
|
||||||
bool exact = flags.get(vm_flags::exact);
|
bool exact = flags.get(vm_flags::exact);
|
||||||
for (size_t i = 0; i < m_areas.count(); ++i) {
|
for (size_t i = 0; i < m_areas.count(); ++i) {
|
||||||
@@ -96,6 +94,7 @@ vm_space::add(uintptr_t base, obj::vm_area *area, util::bitset32 flags)
|
|||||||
if (base >= aend)
|
if (base >= aend)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
uintptr_t end = base + area->size();
|
||||||
if (end <= a.base)
|
if (end <= a.base)
|
||||||
break;
|
break;
|
||||||
else if (exact)
|
else if (exact)
|
||||||
|
|||||||
Reference in New Issue
Block a user