aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-14 10:51:00 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-14 10:51:00 +0000
commitdae3270c6e25062b9085da0756b68fafedc9bb2c (patch)
treebbe89088ce3699c28271cb181bdbe1b54573d4e7 /exec.c
parent9b0b82037a2ebfb3d38ed2ae23194eadd85b1440 (diff)
suppressed page_unprotect_range() - fixed access_ok()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3641 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/exec.c b/exec.c
index e817a4e5e2..6384df270f 100644
--- a/exec.c
+++ b/exec.c
@@ -1894,10 +1894,19 @@ int page_check_range(target_ulong start, target_ulong len, int flags)
if( !(p->flags & PAGE_VALID) )
return -1;
- if (!(p->flags & PAGE_READ) && (flags & PAGE_READ) )
- return -1;
- if (!(p->flags & PAGE_WRITE) && (flags & PAGE_WRITE) )
+ if ((flags & PAGE_READ) && !(p->flags & PAGE_READ))
return -1;
+ if (flags & PAGE_WRITE) {
+ if (!(p->flags & PAGE_WRITE_ORG))
+ return -1;
+ /* unprotect the page if it was put read-only because it
+ contains translated code */
+ if (!(p->flags & PAGE_WRITE)) {
+ if (!page_unprotect(addr, 0, NULL))
+ return -1;
+ }
+ return 0;
+ }
}
return 0;
}
@@ -1942,21 +1951,6 @@ int page_unprotect(target_ulong address, unsigned long pc, void *puc)
return 0;
}
-/* call this function when system calls directly modify a memory area */
-/* ??? This should be redundant now we have lock_user. */
-void page_unprotect_range(target_ulong data, target_ulong data_size)
-{
- target_ulong start, end, addr;
-
- start = data;
- end = start + data_size;
- start &= TARGET_PAGE_MASK;
- end = TARGET_PAGE_ALIGN(end);
- for(addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
- page_unprotect(addr, 0, NULL);
- }
-}
-
static inline void tlb_set_dirty(CPUState *env,
unsigned long addr, target_ulong vaddr)
{