kernel/vm: Make sure the base address is larger than fBase.

This is technically only a functional change following the previous
commit, which unconditionally made sure the address was larger than
the base except for B_EXACT_ADDRESS. Essentially this makes sure
that if an address is passed which is smaller than the base is
passed in, it won't immediately fail just by being too small.

Checked against BeOS (0x0 passed to create_area with B_BASE_ADDRESS
succeeds, and returns 0x2000 consistently.) This is also needed
to not break userland initialization following the next commit.
This commit is contained in:
Augustin Cavalier 2019-02-20 15:33:32 -05:00
parent 836a9548e0
commit 10aa58d7c3

View File

@ -178,7 +178,7 @@ VMUserAddressSpace::InsertArea(VMArea* _area, size_t size,
case B_BASE_ADDRESS:
case B_RANDOMIZED_BASE_ADDRESS:
searchBase = (addr_t)addressRestrictions->address;
searchBase = std::max(fBase, (addr_t)addressRestrictions->address);
searchEnd = fEndAddress;
break;
@ -186,7 +186,7 @@ VMUserAddressSpace::InsertArea(VMArea* _area, size_t size,
case B_ANY_KERNEL_ADDRESS:
case B_ANY_KERNEL_BLOCK_ADDRESS:
case B_RANDOMIZED_ANY_ADDRESS:
searchBase = std::max(fBase, USER_BASE_ANY);
searchBase = std::max(fBase, (addr_t)USER_BASE_ANY);
searchEnd = fEndAddress;
break;