Skip to content

Commit

Permalink
s390/ioinst: fix endianness in ioinst_schib_valid
Browse files Browse the repository at this point in the history
The ioinst_schib_valid gets a SCHIB in guest endianness, we should
byteswap the fields we access.

Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
agraf committed Jun 17, 2015
1 parent ae52e58 commit d49f4ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions target-s390x/ioinst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d49f4ab

Please sign in to comment.