Several years ago at SHARE, I did a presentation on various requests for new architecture. Such an instruction to determine accessibility was at the top of the list. So, I dragged out an architecture instruction template and designed one on the spot: Given a base register, index register, and long displacement using a standard RXY instruction format, set a condition code to indicate whether the access caused an exception.
Oh, plus programming note 1: This instruction is absolutely useless! Upon reflection, my proposed PN#1 was not totally accurate. If you happened to be running in a non-virtual environment such as OS/MFT, things would work just swell. But for any OS that uses paging to present a virtual address space to the user, only the OS knows the answer to this question. So, you need to use an OS service to make the determination. As an alternative to setting up an ESPIE environment, you might want to consider transactional execution (TX, available on the z12 and up). In addition to its multiprocessing lock elision features, TX also provides an easy means for an application to do speculative execution by evading certain program-interruption conditions. For example: TBEGIN TDB,2 JNZ ABORTED ... speculatively access data. TEND If the code branches to the ABORTED label, a transaction diagnostic block is stored (except for CC1), and the program can determine what exception condition caused the abort and whether recovery is likely without OS intervention. See the TX section of Chapter 5 for more details.