|
From: <sv...@va...> - 2005-06-30 12:21:14
|
Author: sewardj
Date: 2005-06-30 13:21:04 +0100 (Thu, 30 Jun 2005)
New Revision: 1235
Log:
Fill in guest_ppc32_state_requires_precise_mem_exns() properly, so Vex
has a bit more of a chance of optimising the IR.
Modified:
trunk/priv/guest-ppc32/ghelpers.c
Modified: trunk/priv/guest-ppc32/ghelpers.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/guest-ppc32/ghelpers.c 2005-06-30 12:08:48 UTC (rev 1234)
+++ trunk/priv/guest-ppc32/ghelpers.c 2005-06-30 12:21:04 UTC (rev 1235)
@@ -274,16 +274,46 @@
/* Figure out if any part of the guest state contained in minoff
.. maxoff requires precise memory exceptions. If in doubt return
True (but this is generates significantly slower code). =20
+
+ By default we enforce precise exns for guest R1 (stack pointer),
+ CIA (current insn address) and LR (link register). These are the
+ minimum needed to extract correct stack backtraces from ppc32
+ code. [[NB: not sure if keeping LR up to date is actually
+ necessary.]]
*/
Bool guest_ppc32_state_requires_precise_mem_exns ( Int minoff,=20
- Int maxoff)
+ Int maxoff )
{
- return True; // FIXME (also comment above)
+ Int lr_min =3D offsetof(VexGuestPPC32State, guest_LR);
+ Int lr_max =3D lr_min + 4 - 1;
+ Int r1_min =3D offsetof(VexGuestPPC32State, guest_GPR1);
+ Int r1_max =3D r1_min + 4 - 1;
+ Int cia_min =3D offsetof(VexGuestPPC32State, guest_CIA);
+ Int cia_max =3D cia_min + 4 - 1;
+
+ if (maxoff < lr_min || minoff > lr_max) {
+ /* no overlap with LR */
+ } else {
+ return True;
+ }
+
+ if (maxoff < r1_min || minoff > r1_max) {
+ /* no overlap with R1 */
+ } else {
+ return True;
+ }
+
+ if (maxoff < cia_min || minoff > cia_max) {
+ /* no overlap with CIA */
+ } else {
+ return True;
+ }
+
+ return False;
}
=20
=20
-
-#define ALWAYSDEFD(field) \
+#define ALWAYSDEFD(field) \
{ offsetof(VexGuestPPC32State, field), \
(sizeof ((VexGuestPPC32State*)0)->field) }
=20
|