[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/25] s390x/mmu: Add support for read-only regions
From: |
Jens Freimann |
Subject: |
[Qemu-devel] [PATCH 09/25] s390x/mmu: Add support for read-only regions |
Date: |
Thu, 12 Feb 2015 18:09:26 +0100 |
From: Thomas Huth <address@hidden>
If the "DAT-protection" bit is set in the region table entry and EDAT is
enabled, only read accesses are allowed in the corresponding memory area.
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: Jens Freimann <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
---
target-s390x/cpu.h | 1 +
target-s390x/mmu_helper.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index c0016b6..08cdb15 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -837,6 +837,7 @@ struct sysib_322 {
#define _ASCE_TABLE_LENGTH 0x03 /* region table length
*/
#define _REGION_ENTRY_ORIGIN ~0xfffULL /* region/segment table origin
*/
+#define _REGION_ENTRY_RO 0x200 /* region/segment protection bit
*/
#define _REGION_ENTRY_TF 0xc0 /* region/segment table offset
*/
#define _REGION_ENTRY_INV 0x20 /* invalid region table entry
*/
#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask
*/
diff --git a/target-s390x/mmu_helper.c b/target-s390x/mmu_helper.c
index 0c53ae9..702e8b8 100644
--- a/target-s390x/mmu_helper.c
+++ b/target-s390x/mmu_helper.c
@@ -188,9 +188,6 @@ static int mmu_translate_region(CPUS390XState *env,
target_ulong vaddr,
return -1;
}
- /* XXX region protection flags */
- /* *flags &= ~PAGE_WRITE */
-
if (level == _ASCE_TYPE_SEGMENT) {
return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags,
rw, exc);
@@ -205,6 +202,10 @@ static int mmu_translate_region(CPUS390XState *env,
target_ulong vaddr,
return -1;
}
+ if ((env->cregs[0] & CR0_EDAT) && (new_entry & _REGION_ENTRY_RO)) {
+ *flags &= ~PAGE_WRITE;
+ }
+
/* yet another region */
return mmu_translate_region(env, vaddr, asc, new_entry, level - 4,
raddr, flags, rw, exc);
--
2.1.4
- [Qemu-devel] [PATCH 00/25] s390x: rework guest memory access, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 18/25] s390x/ioinst: Rework memory access in STSCH instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 24/25] s390x/pci: Rework memory access in zpci instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 12/25] s390x/mmu: Clean up mmu_translate_asc(), Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 15/25] s390x/css: Make schib parameter of css_do_msch const, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 11/25] s390x/mmu: Check bit 52 in page table entry, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 08/25] s390x/mmu: Fix the exception codes for illegal table entries, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 05/25] s390x/mmu: Skip exceptions properly when translating addresses for debug, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 04/25] s390x/mmu: Check table length and offset fields, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 09/25] s390x/mmu: Add support for read-only regions,
Jens Freimann <=
- [Qemu-devel] [PATCH 03/25] s390x/mmu: Fix the handling of the table levels, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 25/25] s390x/helper: Remove s390_cpu_physical_memory_map, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 07/25] s390x/mmu: Fix exception types when checking the ASCEs, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 14/25] s390x/mmu: Add function for accessing guest memory, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 16/25] s390x/ioinst: Rework memory access in MSCH instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 13/25] s390x/kvm: Add function for injecting pgm access exceptions, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 17/25] s390x/ioinst: Rework memory access in SSCH instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 02/25] s390x/mmu: Fix the check for the real-space designation bit, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 20/25] s390x/ioinst: Rework memory access in TSCH instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 22/25] s390x/ioinst: Rework memory access in CHSC instruction, Jens Freimann, 2015/02/12