VM: Add PTF_READ page table flag

This commit is contained in:
Arun Thomas 2012-08-16 23:34:15 +02:00
parent fc9b3f9bdd
commit 7ca1ce7968
3 changed files with 7 additions and 3 deletions

View file

@ -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 */

View file

@ -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__); }

View file

@ -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;