lx_emul & arm: define ZERO_PAGE

The implementation was copied from the already existing LX-emul implementation
for x86 but the commit additionally page-aligns the array that serves as
backing store for the zero page as we assume this to be expected by the contrib
code. However, this commit doesn't apply the alignment also to the x86
implementation as we agreed, that this should be done in a separate commit.

Ref #4397
This commit is contained in:
Martin Stein 2022-05-18 11:05:54 +02:00 committed by Christian Helmuth
parent bd501404db
commit cded594346
3 changed files with 15 additions and 0 deletions

View File

@ -22,6 +22,9 @@
#ifndef __ASSEMBLY__
extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
#define ZERO_PAGE(vaddr) ((void)(vaddr),virt_to_page(empty_zero_page))
pte_t pte_mkwrite(pte_t pte);
int pte_none(pte_t pte);

View File

@ -25,6 +25,9 @@
#include <lx_emul/debug.h>
extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
#define ZERO_PAGE(vaddr) ((void)(vaddr),virt_to_page(empty_zero_page))
pte_t pte_mkwrite(pte_t pte);
pte_t pte_get(pte_t pte);

View File

@ -30,6 +30,15 @@ void time_init(void)
}
#include <asm/pgtable.h>
/*
* Note that empty_zero_page lands in the BSS section and is therefore
* automatically zeroed at program startup.
*/
unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
__attribute__((aligned(PAGE_SIZE)));
void lx_emul_setup_arch(void *dtb)
{
/* calls from setup_arch of arch/arm64/kernel/setup.c */