Enable customizing PageShift to set PageSize for embedded targets (#19129)

* Enable customizing PageSize (via PageShift).

This enables adjusting PageSize for embedded targets without abusing
cpu16.

* copy nimPageXYZ settings for mmpaptest

* add docs for Nim manual

* add docs for Nim manual

* docs tweaks

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
This commit is contained in:
Jaremy Creechley 2021-11-16 11:30:07 -08:00 • committed by GitHub
commit 92d6fb86c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 5 deletions

View file

@ -19,8 +19,11 @@ proc `+!!`(p: pointer, size: int): pointer {.inline.} =
result = cast[pointer](cast[int](p) + size)
const
PageShift = when defined(cpu16): 8 else: 12 # \
# my tests showed no improvements for using larger page sizes.
PageShift = when defined(nimPage256) or defined(cpu16): 8
elif defined(nimPage512): 9
elif defined(nimPage1k): 10
else: 12 # \ # my tests showed no improvements for using larger page sizes.
PageSize = 1 shl PageShift
var p = osAllocPages(3 * PageSize)