ppc: Fix the range check in the LSWI instruction
commitafbee7128c2399b6fca7b744ee560e3a1851118e
authorThomas Huth <thuth@redhat.com>
Thu, 14 Apr 2016 15:14:52 +0000 (14 17:14 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 18 Apr 2016 05:14:38 +0000 (18 15:14 +1000)
tree4ff672e1ae2b7a74012571f5efd1fd84f0195030
parentc7b45f12828c1ba7105dbc029c63d7de68eaa91c
ppc: Fix the range check in the LSWI instruction

There are two issues: First, the number of registers that are used has
to be calculated with "(nb + 3) / 4" (i.e. round always up, not down).
Second, the "start <= ra && (start + nr - 32) > ra" condition for the
wrap-around case is wrong: It has to be tested with "||" instead of "&&".
Since we can reuse this check later for the LSWX instruction, let's
place the fixed code into a helper function, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target-ppc/cpu.h
target-ppc/translate.c