SDL-Hercules-390 / hyperion

The SDL Hercules 4.x Hyperion version of the System/370, ESA/390, and z/Architecture Emulator
Other
247 stars 92 forks source link

TRTE and TRTRE - failed PGM_SPECIFICATION_EXCEPTION #506

Closed JamesWekel closed 2 years ago

JamesWekel commented 2 years ago

TRTE and TRTRE fail to generate a PGM_SPECIFICATION_EXCEPTION when the A bit is 1 and the operand 1 is not an even number.

Currently in general2.c (develop branch line 3108), the TRTE instruction does the following check:

https://github.com/SDL-Hercules-390/hyperion/blob/49be931cccfbde1d7b5f757d5879be2dfc131f77/general2.c#L3108-L3109

The issue is (buf_len % 1) is always 0 (false), so an odd buf_len will not raise the specification exception.

The same check is made for the TRTRE instruction (develop branch line 3204):

https://github.com/SDL-Hercules-390/hyperion/blob/49be931cccfbde1d7b5f757d5879be2dfc131f77/general2.c#L3204-L3205

Jim

Fish-Git commented 2 years ago

Good catch, Jim!   It looks like the programmer probably meant to use (buf_len & 1) (ampersand instead of percent).   I'll try to get that fixed right away.  Thanks for reporting it.

Fish-Git commented 2 years ago

Closed by commit 76c3c54c9ad5c13e431071207fa8c9cd1512fbe3.