diff options
author | Damien Zammit <damien@zamaudio.com> | 2022-08-21 06:58:54 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-21 11:42:52 +0200 |
commit | a14feb6ffadd6902ba09f23122beda08beb970ad (patch) | |
tree | 05a5c7f75322361f4c5dcb26761b3c4df88bcfc4 /vm | |
parent | 0e53658a0c0444a28d7a1858b311d811b9018f60 (diff) | |
download | gnumach-a14feb6ffadd6902ba09f23122beda08beb970ad.tar.gz gnumach-a14feb6ffadd6902ba09f23122beda08beb970ad.tar.bz2 gnumach-a14feb6ffadd6902ba09f23122beda08beb970ad.zip |
gnumach: vm_allocate_contiguous: Allow small power 2 alignments
This allows contiguous allocations aligned to values
smaller than one page, but still a power of 2,
by forcing the alignment to be to the nearest page.
This works because PAGE_SIZE is a power of two.
Message-Id: <20220821065732.269573-1-damien@zamaudio.com>
Diffstat (limited to 'vm')
-rw-r--r-- | vm/vm_user.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vm/vm_user.c b/vm/vm_user.c index ad1fa75d..3ef64dfc 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -590,6 +590,10 @@ kern_return_t vm_allocate_contiguous( if (palign == 0) palign = PAGE_SIZE; + /* FIXME: Allows some small alignments less than page size */ + if ((palign < PAGE_SIZE) && (PAGE_SIZE % palign == 0)) + palign = PAGE_SIZE; + /* FIXME */ if (palign != PAGE_SIZE) return KERN_INVALID_ARGUMENT; |