How To
Summary
SLIP Zero Address Detection (ZAD) is a z/OS feature that detects and documents execution of an instruction that accesses (stores or fetches) storage by using an operand address that was formed from a general register containing zero. This detection feature allows the owner of an application to identify programming errors where an assembler instruction is inadvertently accessing data within the Prefixed Save Area (PSA) control block, which resides at virtual address zero, due to incorrect register content of zero.
Objective
Environment
Steps
- Due to potential for performance impact, it is recommended that ZAD be used in a test environment. If using ZAD in a production environment, provide an appropriate PRCNTLIM (PL) parameter value on the SLIP and monitor the system closely for possible overhead.
- Minimize PER matches through use of SLIP filters.
- Use SLIP parameter ASIDSA=SA to catch accesses to location 0 in an address space only (and not in a data space).
- Look for ZAD events only within your own product code. Many expected ZAD events in IBM modules can occur which do not represent problems and are not defects. If you see a ZAD event that is outside of your product code, and you do not suspect that it is an error, do not report it.
At the beginning of the report, you see an indication of when the report ran and how long:
SLIP Action Exit IEAVTSZR Event Report 07/04/2022 17:53:10.07
IEAVTSZR SLIP Trap ID=ZADT Duration: 00000007_0770AC56 Seconds: 7
To get to the section of most interest, from the beginning of the report, do: FIND JOBNAME
This search gets you to a data header followed by multiple lines of data. Each line of data represents a count of how many times within the run of ZAD a particular job/ASID/module/offset combination executed an instruction that accessed PSA storage by using a general register containing a value of zero. The storage access could have been for either a fetch or a store. For a detailed definition of what register conditions trigger a ZAD event, see the section on "Zero Address Detection" in chapter 4 of the IBM z/Architecture Principles of Operation.
Following is a breakdown of the fields in the column header:
- JobName - name of the job under which the highlighted instruction (the instruction that caused the ZAD event) was executed. This will be set to '********' when the address of the highlighted instruction resides in common storage.
- ASID - hexadecimal ASID number of the job under which the highlighted instruction was executed
- Address - address in storage where the highlighted instruction resides
- Count - the number of times within the run that a particular job/ASID/module/offset combination executed an instruction that accessed storage by using a general register containing a value of zero.
- Modname - name of the load module or nucleus module in which the highlighted instruction resides
- Offset - offset within module where the highlighted instruction resides
- Dsp - if there is a "D" in this column, the access was to a data space; otherwise, it was to an address space. (Use SLIP parameter ASIDSA=SA on the ZAD SLIP to eliminate data space entries from this report.)
- InstrucText - the 6 bytes of hexadecimal data at the address indicated by the Address field. This data includes the highlighted instruction. The instruction might be only the first 2 or first 4 bytes of this 6-byte string.
- Decoded Instruction Text - the highlighted instruction, displayed as an assembler language instruction
If you encounter modules in the report that are intentionally accessing the PSA control block, consider the following coding suggestions to avoid triggering ZAD events.
- Replace code that places a value of zero into a base register with code that specifies a base register number of zero. For instruction formats where an index register is applicable, such as RX-format, replace code that places a value of zero into an index register with code that specifies an index register number of zero.
For example, replace the following assembler code:
LHI RegX,0
L RegY,PSATOLD-PSA(,RegX)
with:
L RegY,PSATOLD-PSA(0,0)
or:
USING PSA,0
L RegY,PSATOLD
As an example using C, given the following PSA definition:
struct psa {
…
void *__ptr32 psatold;
…
};
replace:
struct psa* psaptr = 0;
if (psaptr -> psatold == 0) ...
with:
if (((struct psa *)0) -> psatold == 0) ...
- When using an index to access an element of an array, ensure that the index register is used to hold the index value and the base register is used to point to the start of the array. Reversing the use of the index register and base register will trigger a ZAD event when the base register contains zero.
If you encounter modules in the report that are accessing the page at address 0 in a data space, you can add ASIDSA=SA to the ZAD SLIP to filter out these events. The events will still occur (and thus consume CPU cycles), but they will not appear in the report. If you prefer not to filter out these data space references, you can prevent the ZAD event by defining the data space such that it does not have a page at address 0. Doing this not only has the benefit of eliminating a ZAD event, but it also means that an unintended reference to the first page of the data space will result in a program interrupt. One way to define a data space that does not include page 0 is to use the HIDEZERO=YES option of the DSPSERV CREATE macro invocation. You will also need to make sure that your implementation is adjusted to accommodate the data space origin of X’1000’ rather than 0.
Document Location
Worldwide
Was this topic helpful?
Document Information
More support for:
z/OS
Component:
z/OS->RTM & Dumping Services->SLIP
Software version:
2.3.0, 2.4.0, 2.5.0 and future releases
Operating system(s):
z/OS
Document number:
6602085
Modified date:
06 June 2024
UID
ibm16602085