There is good chance that in some cases it may work by allocating as many pages as needed one after another. Example implementation:
local PAGE_SIZE = 0x1000
function allocateConsecutivePages(count, mode, address)
count = count or 1
mode = mode or gg.PROT_READ | gg.PROT_EXEC
address = address or 0
local firstPageAddress = gg.allocatePage(mode, address)
if type(firstPageAddress) == "string" then
return firstPageAddress
end
for i = 1, count - 1 do
local desiredPageAddress = firstPageAddress + i * PAGE_SIZE
local pageAddress = gg.allocatePage(mode, desiredPageAddress)
if pageAddress ~= desiredPageAddress then
-- failed to allocate page right after previous one, handle as needed
end
end
return firstPageAddress
end