Here's a brute force assembler translation of my quick decoding of doc for
"ARCHLEVEL" in the z/OS V2R2 C/C++ UG.
NB: It would be great if someone could get IBM to confirm that these are
the correct FACL bits described by the ARCHLEVEL doc.
It returns "9" as expected on the z196 machine that I am using, so it must
be right ;-)
TITLE '-- Entry / prologue'
*--------------------------------------------------------------------*
* Checks the IBM z/OS PSAE facility bits to return the highest
* ARCHLEVEL that would be supported by the IBM C/C++ compiler
* on the current machine.
*
* Call with standard system linkage; RC=R15 is the ARCH level.
*
* References:
* IBM C/C++ User's Guide
* Principles of Operation
* IHAFACL macro comments
*
* Version: November 28, 2015
*
* Please report bugs or enhancements to author:
* Kirk Wolf
* Dovetailed Technologies
*
ki...@dovetail.com
*
* This is free and unencumbered software released into the
* public domain. Anyone is free to copy, modify, publish,
* use, compile, sell or distribute this software for any purpose.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*--------------------------------------------------------------------*
CHKARCH CSECT
CHKARCH AMODE 31
CHKARCH RMODE ANY
USING *,R15
SAVE (14,12),,'CHKARCH &SYSDATE. &SYSTIME.'
LR R12,R15
DROP R15 drop temporary base reg
USING CHKARCH,R12 establish our base register
TITLE '-- Mainline'
USING FLCESAME,0 PSA/PSAE is at location 0
USING FaclData,FlceFacilitiesList
LA R15,0 Default ARCH(0) - should not occur
* Test ARCH(5)
TM FaclByte0,FaclZArchInstalled
BNO EXIT
LA R15,5 ARCH(5)
* Test ARCH(6)
* long-displacement facility
TM FaclByte2,FaclLongDisplacement
BNO EXIT
LA R15,6 ARCH(6)
* Test ARCH(7) (z9)
* long-displacement facility
TM FaclByte2,FaclExtendedImmediate
BNO EXIT
LA R15,7 ARCH(7)
* Test ARCH(8) (z10)
* extended-immediate facility,
* DFP facility
TM FaclByte4,FaclGeneralInstExtension
BNO EXIT
TM FaclByte5,FaclDFPF
BNO EXIT
LA R15,8 ARCH(8)
* Test ARCH(9) (z196)
* high-word facility,
* interlocked-access facility,
* load/store-on-condition facility,
* distinct-operands-facility,
* population-count facility.
TM FaclByte5,FaclHighWord
BNO EXIT
TM FaclByte5,FaclLoadStoreOnCondition
BNO EXIT
TM FaclByte5,FaclDistinctOperands
BNO EXIT
TM FaclByte5,FaclPopulationCount
BNO EXIT
LA R15,9 ARCH(9)
* Test ARCH(10) (xc12)
* execution-hint facility,
* load-and-trap facility,
* miscellaneous-instruction-extension facility,
* transactional-execution facility.
TM FaclByte6,FaclExecutionHint
BNO EXIT
TM FaclByte6,FaclLoadAndTrap
BNO EXIT
TM FaclByte6,FaclMiscInstExt
BNO EXIT
TM FaclByte9,FaclTransactionalExecution
BNO EXIT
LA R15,10 ARCH(10)
* Test ARCH(11) (z13)
* vector facility, -- should we also check CVTVEF ??
* decimal floating point packed conversion facility,
* load/store-on-condition facility,
* conditional-transaction-end facility
TM FaclByte16,Facl_VectorExtensionFacility
BNO EXIT
TM FaclByte10,FACL_DFPPackedConversion
BNO EXIT
TM FaclByte6,FACL_LoadStoreOnCond2
BNO EXIT
TM FaclByte6,FACL_CTEND
BNO EXIT
LA R15,11 ARCH(11)
TITLE '-- Exit / epilogue'
EXIT DS 0H
L 14,12(0,13) restore return address
RETURN (0,12),RC=(15),T
TITLE '-- Constants / DSECTS'
IHAPSAE ,
IHAFACL ,
YREGS ,
END CHKARCH
Kirk Wolf
Dovetailed Technologies
http://dovetail.com