[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/29] s390x/ioinst: Rework memory access in STSCH in
From: |
Christian Borntraeger |
Subject: |
[Qemu-devel] [PULL 22/29] s390x/ioinst: Rework memory access in STSCH instruction |
Date: |
Wed, 18 Feb 2015 21:22:16 +0100 |
From: Thomas Huth <address@hidden>
Change the handler for STSCH to use the new logical memory
access functions.
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: Jens Freimann <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Signed-off-by: Christian Borntraeger <address@hidden>
---
target-s390x/ioinst.c | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c
index 0ef7a93..23c2faf 100644
--- a/target-s390x/ioinst.c
+++ b/target-s390x/ioinst.c
@@ -284,8 +284,7 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb)
SubchDev *sch;
uint64_t addr;
int cc;
- SCHIB *schib;
- hwaddr len = sizeof(*schib);
+ SCHIB schib;
CPUS390XState *env = &cpu->env;
addr = decode_basedisp_s(env, ipb);
@@ -293,21 +292,23 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb)
program_interrupt(env, PGM_SPECIFICATION, 2);
return;
}
- schib = s390_cpu_physical_memory_map(env, addr, &len, 1);
- if (!schib || len != sizeof(*schib)) {
- program_interrupt(env, PGM_ADDRESSING, 2);
- goto out;
- }
if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {
- program_interrupt(env, PGM_OPERAND, 2);
- goto out;
+ /*
+ * As operand exceptions have a lower priority than access exceptions,
+ * we check whether the memory area is writeable (injecting the
+ * access execption if it is not) first.
+ */
+ if (!s390_cpu_virt_mem_check_write(cpu, addr, sizeof(schib))) {
+ program_interrupt(env, PGM_OPERAND, 2);
+ }
+ return;
}
trace_ioinst_sch_id("stsch", cssid, ssid, schid);
sch = css_find_subch(m, cssid, ssid, schid);
if (sch) {
if (css_subch_visible(sch)) {
- css_do_stsch(sch, schib);
+ css_do_stsch(sch, &schib);
cc = 0;
} else {
/* Indicate no more subchannels in this css/ss */
@@ -318,14 +319,21 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb)
cc = 3; /* No more subchannels in this css/ss */
} else {
/* Store an empty schib. */
- memset(schib, 0, sizeof(*schib));
+ memset(&schib, 0, sizeof(schib));
cc = 0;
}
}
+ if (cc != 3) {
+ if (s390_cpu_virt_mem_write(cpu, addr, &schib, sizeof(schib)) != 0) {
+ return;
+ }
+ } else {
+ /* Access exceptions have a higher priority than cc3 */
+ if (s390_cpu_virt_mem_check_write(cpu, addr, sizeof(schib)) != 0) {
+ return;
+ }
+ }
setcc(cpu, cc);
-
-out:
- s390_cpu_physical_memory_unmap(env, schib, len, 1);
}
int ioinst_handle_tsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb)
--
1.9.3
- [Qemu-devel] [PULL 25/29] s390x/ioinst: Rework memory access in STCRW instruction, (continued)
- [Qemu-devel] [PULL 25/29] s390x/ioinst: Rework memory access in STCRW instruction, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 01/29] s390x/ipl: always load the bios for ccw machine, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 05/29] s390x/mmu: Move mmu_translate() and friends to separate file, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 03/29] s390x/ipl: drop reipl parameters on resets, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 28/29] s390x/pci: Rework memory access in zpci instruction, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 11/29] s390x/mmu: Fix exception types when checking the ASCEs, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 24/29] s390x/ioinst: Rework memory access in TSCH instruction, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 17/29] s390x/kvm: Add function for injecting pgm access exceptions, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 23/29] s390x/ioinst: Set condition code in ioinst_handle_tsch() handler, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 06/29] s390x/mmu: Fix the check for the real-space designation bit, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 22/29] s390x/ioinst: Rework memory access in STSCH instruction,
Christian Borntraeger <=
- [Qemu-devel] [PULL 10/29] s390x/mmu: Fix translation exception code in lowcore, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 26/29] s390x/ioinst: Rework memory access in CHSC instruction, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 07/29] s390x/mmu: Fix the handling of the table levels, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 15/29] s390x/mmu: Check bit 52 in page table entry, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 29/29] s390x/helper: Remove s390_cpu_physical_memory_map, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 20/29] s390x/ioinst: Rework memory access in MSCH instruction, Christian Borntraeger, 2015/02/18
- [Qemu-devel] [PULL 27/29] s390x/ioinst: Rework memory access in TPI instruction, Christian Borntraeger, 2015/02/18
- Re: [Qemu-devel] [PULL 00/29] s390x guest reipl and page table handling, Peter Maydell, 2015/02/26