I'm not going to push this much farther, as it's just an idea, but your description does not necessarily match what the real machines would do, because the state of a machine after a diagnose command is issued is dependent on the exact model (and even the field revision state) of that machine. This would be true even if though there are some "standard" diagnose functions some later models.
It's an operating system's responsibility to know?
before issuing a diagnose, that it will not cause a problem. The 1987 version of the 370-XA Prince of Ops, and earlier 370 versions indicates that the Model and Version fields of the data returned by STIDP would be used to make that determination:
DIAGNOSE, unlike other instructions, does not follow the rule that programming errors are distinguished from equipment errors. Improper use of DIAGNOSE may result in false machine-check indications or may cause actual?machine malfunctions to be ignored. It may also alter other aspects of system operation, including instruction execution and channel- program operation, to an extent that the operation does not comply with that specified in this publication. As a result of the improper use of DIAGNOSE, the system may be left in such a condition that the power-on reset or initial-microprogram-loading (IML) function must be performed. Since the function performed by DIAGNOSE may differ from model to model and between versions of a model, the program should avoid issuing DIAGNOSE unless the program recognizes both the model number and version code stored by STORE CPU 10.?
So handling the exception is Hercules-specific, and has nothing to do with a "real" 370. So whatever we do is an?
I took a look at the source, and it seems that the Hercules options defined in feat370.h includes FEATURE_HERCULES_DIAGCALLS. This means that it should generally be possible to check to check if DIAG 008 is enabled in the configuration by the use of other Hercules-specific diagnose calls. So it's certainly reasonable to argue that this crash can be handled in CP, and therefore should be.
I agree that a patch to the HCP command to check that it's running under Hercules would be a good idea. I also think there's an argument that a Hercules console message for illegal DIAGNOSE instructions could be helpful in the presumably rare case where an OS performs a DIAGNOSE instruction incorrectly, and it does seem easy to implement.