[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/25] s390x/ioinst: Rework memory access in CHSC in
From: |
Jens Freimann |
Subject: |
[Qemu-devel] [PATCH 22/25] s390x/ioinst: Rework memory access in CHSC instruction |
Date: |
Thu, 12 Feb 2015 18:09:39 +0100 |
From: Thomas Huth <address@hidden>
Change the CHSC handler to correctly use logical addresses, too.
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/ioinst.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c
index 157972d..7e748c2 100644
--- a/target-s390x/ioinst.c
+++ b/target-s390x/ioinst.c
@@ -629,8 +629,8 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb)
int reg;
uint16_t len;
uint16_t command;
- hwaddr map_size = TARGET_PAGE_SIZE;
CPUS390XState *env = &cpu->env;
+ uint8_t buf[TARGET_PAGE_SIZE];
trace_ioinst("chsc");
reg = (ipb >> 20) & 0x00f;
@@ -640,16 +640,20 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb)
program_interrupt(env, PGM_SPECIFICATION, 2);
return;
}
- req = s390_cpu_physical_memory_map(env, addr, &map_size, 1);
- if (!req || map_size != TARGET_PAGE_SIZE) {
- program_interrupt(env, PGM_ADDRESSING, 2);
- goto out;
+ /*
+ * Reading sizeof(ChscReq) bytes is currently enough for all of our
+ * present CHSC sub-handlers ... if we ever need more, we should take
+ * care of req->len here first.
+ */
+ if (s390_cpu_virt_mem_read(cpu, addr, buf, sizeof(ChscReq))) {
+ return;
}
+ req = (ChscReq *)buf;
len = be16_to_cpu(req->len);
/* Length field valid? */
if ((len < 16) || (len > 4088) || (len & 7)) {
program_interrupt(env, PGM_OPERAND, 2);
- goto out;
+ return;
}
memset((char *)req + len, 0, TARGET_PAGE_SIZE - len);
res = (void *)((char *)req + len);
@@ -673,9 +677,9 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb)
break;
}
- setcc(cpu, 0); /* Command execution complete */
-out:
- s390_cpu_physical_memory_unmap(env, req, map_size, 1);
+ if (!s390_cpu_virt_mem_write(cpu, addr + len, res, be16_to_cpu(res->len)))
{
+ setcc(cpu, 0); /* Command execution complete */
+ }
}
int ioinst_handle_tpi(CPUS390XState *env, uint32_t ipb)
--
2.1.4
- [Qemu-devel] [PATCH 09/25] s390x/mmu: Add support for read-only regions, (continued)
- [Qemu-devel] [PATCH 09/25] s390x/mmu: Add support for read-only regions, Jens Freimann, 2015/02/12
- [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 <=
- [Qemu-devel] [PATCH 10/25] s390x/mmu: Renaming related to the ASCE confusion, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 06/25] s390x/mmu: Fix translation exception code in lowcore, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 19/25] s390x/ioinst: Set condition code in ioinst_handle_tsch() handler, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 21/25] s390x/ioinst: Rework memory access in STCRW instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 23/25] s390x/ioinst: Rework memory access in TPI instruction, Jens Freimann, 2015/02/12
- [Qemu-devel] [PATCH 01/25] s390x/mmu: Move mmu_translate() and friends to separate file, Jens Freimann, 2015/02/12
- Re: [Qemu-devel] [PATCH 00/25] s390x: rework guest memory access, Christian Borntraeger, 2015/02/18