mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
lx_emul: __alloc_pages support in shadow/mm/page_alloc.c
This commit is contained in:
parent
a222df31ba
commit
4474460377
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/version.h>
|
||||
#include <lx_emul/page_virt.h>
|
||||
|
||||
unsigned long __alloc_pages_bulk(gfp_t gfp,int preferred_nid,
|
||||
@ -51,3 +52,20 @@ void __free_pages(struct page * page, unsigned int order)
|
||||
lx_emul_mem_free(virt_addr);
|
||||
lx_emul_mem_free(page);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* In earlier kernel versions, '__alloc_pages' was an inline function.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(5,12,0)
|
||||
struct page * __alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
|
||||
nodemask_t * nodemask)
|
||||
{
|
||||
unsigned const nr_pages = (1u << order);
|
||||
|
||||
void const *ptr = lx_emul_mem_alloc_aligned(PAGE_SIZE*nr_pages, PAGE_SIZE);
|
||||
struct page *page = lx_emul_virt_to_pages(ptr, nr_pages);
|
||||
|
||||
return page;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user