X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/28c176b668c841a3b7fb093faccf0efa39257603..0fd474df7001837bde53da0e42e83081827c9641:/lunaix-os/arch/x86/mm/vmutils.c diff --git a/lunaix-os/arch/x86/mm/vmutils.c b/lunaix-os/arch/x86/mm/vmutils.c index df831c2..5f4d3df 100644 --- a/lunaix-os/arch/x86/mm/vmutils.c +++ b/lunaix-os/arch/x86/mm/vmutils.c @@ -1,5 +1,6 @@ #include -#include + +#include struct leaflet* dup_leaflet(struct leaflet* leaflet) @@ -36,4 +37,23 @@ dup_leaflet(struct leaflet* leaflet) vunmap(dest_va, new_leaflet); return new_leaflet; -} \ No newline at end of file +} + +pte_t +translate_vmr_prot(unsigned int vmr_prot, pte_t pte) +{ + pte = pte_mkuser(pte); + + if ((vmr_prot & PROT_WRITE)) { + pte = pte_mkwritable(pte); + } + + if ((vmr_prot & PROT_EXEC)) { + pte = pte_mkexec(pte); + } + else { + pte = pte_mknonexec(pte); + } + + return pte; +}