[Simh] O2 optimization on Linux (was: VMS 4.6 crashes on Linux)
Bob Supnik
bob at supnik.org
Tue Dec 28 17:00:04 EST 2010
Jason Stevens wrote:
You didn't build it with -O2 on linux did you? There is some weird
things with GCC and SIMH's VAX... I can only speak to 4.X BSD, but I
was able to identify two procedures that when optimized with -O2 break
4BSD on SIMH....
I kind of detailed it here:
http://www.mail-archive.com/simh@trailing-edge.com/msg00463.html
And the procedures in question were:
op_ldpctx
op_mtpr
---
Interestingly, those routines are the ONLY places in the VAX simulator where these macros are used:
/* Machine specific reserved operand tests (all NOPs) */
#define ML_PA_TEST(r)
#define ML_LR_TEST(r)
#define ML_SBR_TEST(r)
#define ML_PXBR_TEST(r)
#define LP_AST_TEST(r)
#define LP_MBZ84_TEST(r)
#define LP_MBZ92_TEST(r)
On the 780, they are real tests:
/* Machine specific reserved operand tests */
#define ML_LR_TEST(r) if ((uint32)((r)& 0xFFFFFF)> 0x200000) RSVD_OPND_FAULT
#define ML_PXBR_TEST(r) if ((((r)& 0x80000000) == 0) || \
((r)& 0x00000003)) RSVD_OPND_FAULT
#define ML_SBR_TEST(r) if ((r)& 0x00000003) RSVD_OPND_FAULT
#define ML_PA_TEST(r) if ((r)& 0x00000003) RSVD_OPND_FAULT
#define LP_AST_TEST(r) if ((r)> AST_MAX) RSVD_OPND_FAULT
#define LP_MBZ84_TEST(r) if ((r)& 0xF8C00000) RSVD_OPND_FAULT
#define LP_MBZ92_TEST(r) if ((r)& 0x7FC00000) RSVD_OPND_FAULT
---
One (or more) of those six tests is the smoking gun, and if I had to put
my money on it, I think it's this one:
#define ML_LR_TEST(r) if ((uint32)((r)& 0xFFFFFF)> 0x200000) RSVD_OPND_FAULT
Try adding an extra level of parentheses:
if (((uint32)((r)& 0xFFFFFF))> 0x200000) RSVD_OPND_FAULT
just to be sure that the uint32 cast isn't be applied to the whole
comparison, instead of just the first term.
If that fails to get it running, then try "no-oping" all of the macros
to see if VMS 4.6 will boot. If it does, then enable each of the macros
in turn, to see where the simulator fails.
/Bob
More information about the Simh
mailing list