Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys/uvm Mark XIP pages as PG_RDONLY.
details: https://anonhg.NetBSD.org/src/rev/9b849ab3be4d
branches: uebayasi-xip
changeset: 751734:9b849ab3be4d
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Jul 08 06:55:13 2010 +0000
description:
Mark XIP pages as PG_RDONLY.
diffstat:
sys/uvm/uvm_bio.c | 13 +++++--------
sys/uvm/uvm_fault.c | 15 ++++++---------
sys/uvm/uvm_page.c | 9 +++++----
3 files changed, 16 insertions(+), 21 deletions(-)
diffs (129 lines):
diff -r 2d22d3a6fc84 -r 9b849ab3be4d sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Thu Jul 08 05:30:43 2010 +0000
+++ b/sys/uvm/uvm_bio.c Thu Jul 08 06:55:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_bio.c,v 1.68.2.4 2010/07/07 16:35:26 uebayasi Exp $ */
+/* $NetBSD: uvm_bio.c,v 1.68.2.5 2010/07/08 06:55:13 uebayasi Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.68.2.4 2010/07/07 16:35:26 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.68.2.5 2010/07/08 06:55:13 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_ubc.h"
@@ -385,13 +385,10 @@
* is marked as PG_RDONLY.
*/
- /* XXXUEBS device pages are always read-only for now */
- rdonly = uvm_pageisdirect_p(pg) ||
- ((access_type & VM_PROT_WRITE) == 0 &&
- (pg->flags & PG_RDONLY) != 0) ||
+ rdonly = ((access_type & VM_PROT_WRITE) == 0 &&
+ (pg->flags & PG_RDONLY) != 0) ||
UVM_OBJ_NEEDS_WRITEFAULT(uobj);
- KASSERT(uvm_pageisdirect_p(pg) ||
- (pg->flags & PG_RDONLY) == 0 ||
+ KASSERT((pg->flags & PG_RDONLY) == 0 ||
(access_type & VM_PROT_WRITE) == 0 ||
pg->offset < umap->writeoff ||
pg->offset + PAGE_SIZE > umap->writeoff + umap->writelen);
diff -r 2d22d3a6fc84 -r 9b849ab3be4d sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c Thu Jul 08 05:30:43 2010 +0000
+++ b/sys/uvm/uvm_fault.c Thu Jul 08 06:55:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_fault.c,v 1.166.2.11 2010/07/08 02:23:28 uebayasi Exp $ */
+/* $NetBSD: uvm_fault.c,v 1.166.2.12 2010/07/08 06:55:13 uebayasi Exp $ */
/*
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.166.2.11 2010/07/08 02:23:28 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.166.2.12 2010/07/08 06:55:13 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_xip.h"
@@ -1731,8 +1731,7 @@
"(0x%x) with locked get",
curpg, 0,0,0);
} else {
- bool readonly = uvm_pageisdirect_p(curpg)
- || (curpg->flags & PG_RDONLY)
+ bool readonly = (curpg->flags & PG_RDONLY)
|| (curpg->loan_count > 0)
|| UVM_OBJ_NEEDS_WRITEFAULT(curpg->uobject);
@@ -2177,11 +2176,9 @@
" MAPPING: case2: pm=0x%x, va=0x%x, pg=0x%x, promote=%d",
ufi->orig_map->pmap, ufi->orig_rvaddr, pg, flt->promote);
KASSERT((flt->access_type & VM_PROT_WRITE) == 0 ||
- uvm_pageisdirect_p(pg) || (pg->flags & PG_RDONLY) == 0);
- if (pmap_enter(ufi->orig_map->pmap, ufi->orig_rvaddr,
- VM_PAGE_TO_PHYS(pg),
- (uvm_pageisdirect_p(pg) || pg->flags & PG_RDONLY) ?
- (flt->enter_prot & ~VM_PROT_WRITE) : flt->enter_prot,
+ (pg->flags & PG_RDONLY) == 0);
+ if (pmap_enter(ufi->orig_map->pmap, ufi->orig_rvaddr, VM_PAGE_TO_PHYS(pg),
+ pg->flags & PG_RDONLY ? flt->enter_prot & ~VM_PROT_WRITE : flt->enter_prot,
flt->access_type | PMAP_CANFAIL | (flt->wire_mapping ? PMAP_WIRED : 0)) != 0) {
if (uvm_pageisdirect_p(pg)) {
diff -r 2d22d3a6fc84 -r 9b849ab3be4d sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Thu Jul 08 05:30:43 2010 +0000
+++ b/sys/uvm/uvm_page.c Thu Jul 08 06:55:13 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.153.2.41 2010/07/07 16:35:26 uebayasi Exp $ */
+/* $NetBSD: uvm_page.c,v 1.153.2.42 2010/07/08 06:55:13 uebayasi Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.41 2010/07/07 16:35:26 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.42 2010/07/08 06:55:13 uebayasi Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -125,7 +125,6 @@
/*
* physical memory config is stored in vm_physmem.
*/
-/* XXXUEBS merge these two */
SIMPLEQ_HEAD(vm_physseg_freelist, vm_physseg);
@@ -134,6 +133,7 @@
static struct vm_physseg vm_physmem_store[VM_PHYSSEG_MAX];
static struct vm_physseg_freelist vm_physmem_freelist =
SIMPLEQ_HEAD_INITIALIZER(vm_physmem_freelist);
+
#ifdef XIP
struct vm_physseg *vm_physdev_ptrs[VM_PHYSSEG_MAX];
int vm_nphysdev = 0;
@@ -856,6 +856,7 @@
* XIP page metadata initialization
* - Only "phys_addr" and "vm_page_md" (== "PV" management) are used.
* - No "pageq" operation is done.
+ * - XIP pages are read-only (for now).
*/
seg->pgs = kmem_zalloc(sizeof(struct vm_page) * (end - start),
KM_SLEEP);
@@ -869,7 +870,7 @@
paddr_t paddr = (start + i) << PAGE_SHIFT;
pg->phys_addr = paddr;
- pg->flags |= PG_DIRECT;
+ pg->flags |= PG_RDONLY | PG_DIRECT;
#ifdef __HAVE_VM_PAGE_MD
VM_MDPAGE_INIT(&pg->mdpage, paddr);
#endif
Home |
Main Index |
Thread Index |
Old Index