Received: from eggs.gnu.org ([2001:4830:134:3::10]:48630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4WlB-0000ka-LT for qemu-devel@nongnu.org; Mon, 15 Jun 2015 11:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4WlA-0003Jj-9k for qemu-devel@nongnu.org; Mon, 15 Jun 2015 11:57:17 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:47742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Wl9-0003HF-TG for qemu-devel@nongnu.org; Mon, 15 Jun 2015 11:57:16 -0400 From: Aurelien Jarno Date: Mon, 15 Jun 2015 17:57:01 +0200 Message-Id: <1434383829-26451-3-git-send-email-aurelien@aurel32.net> In-Reply-To: <1434383829-26451-1-git-send-email-aurelien@aurel32.net> References: <1434383829-26451-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 02/10] s390/ioinst: fix endianness in ioinst_schib_valid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , Christian Borntraeger , Alexander Graf , Aurelien Jarno , Richard Henderson From: Alexander Graf The ioinst_schib_valid gets a SCHIB in guest endianness, we should byteswap the fields we access. Cc: Christian Borntraeger Cc: Cornelia Huck Signed-off-by: Alexander Graf Signed-off-by: Aurelien Jarno --- target-s390x/ioinst.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Note that it creates some asymmetry with the ioinst_orb_valid function. We might want to move the copy_schib_from_guest from hw/s390x/css.c to target-s390x/ioinst.c and do the byteswapping only once. diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index e220cea..77f2a1f 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -129,12 +129,12 @@ void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1) static int ioinst_schib_valid(SCHIB *schib) { - if ((schib->pmcw.flags & PMCW_FLAGS_MASK_INVALID) || - (schib->pmcw.chars & PMCW_CHARS_MASK_INVALID)) { + if ((be16_to_cpu(schib->pmcw.flags) & PMCW_FLAGS_MASK_INVALID) || + (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_INVALID)) { return 0; } /* Disallow extended measurements for now. */ - if (schib->pmcw.chars & PMCW_CHARS_MASK_XMWME) { + if (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_XMWME) { return 0; } return 1; -- 2.1.4