diff --git a/include/arch/i386/include/vm.h b/include/arch/i386/include/vm.h index 757a14a8e..71104e0a2 100644 --- a/include/arch/i386/include/vm.h +++ b/include/arch/i386/include/vm.h @@ -10,6 +10,7 @@ i386/vm.h /* i386 paging constants */ #define I386_VM_PRESENT 0x001 /* Page is present */ #define I386_VM_WRITE 0x002 /* Read/write access allowed */ +#define I386_VM_READ 0x000 /* Read access only */ #define I386_VM_USER 0x004 /* User access allowed */ #define I386_VM_PWT 0x008 /* Write through */ #define I386_VM_PCD 0x010 /* Cache disable */ diff --git a/servers/vm/arch/i386/pagetable.h b/servers/vm/arch/i386/pagetable.h index 68d54c20c..acb12a02a 100644 --- a/servers/vm/arch/i386/pagetable.h +++ b/servers/vm/arch/i386/pagetable.h @@ -26,6 +26,7 @@ typedef struct { /* Mapping flags. */ #define PTF_WRITE I386_VM_WRITE +#define PTF_READ I386_VM_READ #define PTF_PRESENT I386_VM_PRESENT #define PTF_USER I386_VM_USER #define PTF_GLOBAL I386_VM_GLOBAL @@ -35,7 +36,7 @@ typedef struct { /* For arch-specific PT routines to check if no bits outside * the regular flags are set. */ -#define PTF_ALLFLAGS (PTF_WRITE|PTF_PRESENT|PTF_USER|PTF_GLOBAL|PTF_NOCACHE) +#define PTF_ALLFLAGS (PTF_READ|PTF_WRITE|PTF_PRESENT|PTF_USER|PTF_GLOBAL|PTF_NOCACHE) #if SANITYCHECKS #define PT_SANE(p) { pt_sanitycheck((p), __FILE__, __LINE__); } diff --git a/servers/vm/region.c b/servers/vm/region.c index a7edf1464..857b498db 100644 --- a/servers/vm/region.c +++ b/servers/vm/region.c @@ -196,7 +196,7 @@ static int map_sanitycheck_pt(struct vmproc *vmp, if(WRITABLE(vr, pb)) rw = PTF_WRITE; else - rw = 0; + rw = PTF_READ; r = pt_writemap(vmp, &vmp->vm_pt, vr->vaddr + pr->offset, pb->phys, pb->length, PTF_PRESENT | PTF_USER | rw, WMF_VERIFY); @@ -375,7 +375,7 @@ static int map_ph_writept(struct vmproc *vmp, struct vir_region *vr, if(WRITABLE(vr, pb)) rw = PTF_WRITE; else - rw = 0; + rw = PTF_READ; if(pt_writemap(vmp, &vmp->vm_pt, vr->vaddr + pr->offset, pb->phys, pb->length, PTF_PRESENT | PTF_USER | rw, @@ -2112,6 +2112,8 @@ static int do_map_memory(struct vmproc *vms, struct vmproc *vmd, */ if(flag > 0) pt_flag |= PTF_WRITE; + else + pt_flag |= PTF_READ; /* Map phys blocks in the source process to the destination process. */ end = offset_d + length;