Interlocked Memory Instructions (Alpha Only)
A.2 Using the Code Analysis Tool (SRM_CHECK)
The tool supports wildcard searches. Use the following command line to initiate a
wildcard search:
$ srm_check [*...]* -log
Use the -log qualifier to generate a list of images that have been checked. You
can use the -output qualifier to write the output to a data file. For example, the
following command directs output to a file named CHECK.DAT:
$ srm_check ’file’ -output check.dat
You can use the output from the tool to find the module that generated the
sequence by looking in the image’s MAP file. The addresses shown correspond
directly to the addresses that can be found in the MAP file.
The following example illustrates the output from using the analysis tool on an
image named SYSTEM_SYNCHRONIZATION.EXE:
** Potential Alpha Architecture Violation(s) found in file...
** Found an unexpected ldq at 00003618
0000360C AD970130 ldq_l R12, 0x130(R23)
00003610 4596000A and R12, R22, R10
00003614 F5400006 bne R10, 00003630
00003618 A54B0000 ldq R10, (R11)
Image Name: SYSTEM_SYNCHRONIZATION
Image Ident: X-3
Link Time: 5-NOV-1998 22:55:58.10
Build Ident: X6P7-SSB-0000
Header Size: 584
Image Section: 0, vbn: 3, va: 0x0, flags: RESIDENT EXE (0x880)
The MAP file for system_synchronization.exe contains the following:
EXEC$NONPAGED_CODE 00000000 0000B317 0000B318 ( 45848.) 2 ** 5
SMPROUT 00000000 000047BB 000047BC ( 18364.) 2 ** 5
SMPINITIAL 000047C0 000061E7 00001A28 ( 6696.) 2 ** 5
The address 360C is in the SMPROUT module, which contains the addresses
from 0-47BB. By looking at the machine code output from the module, you can
locate the code and use the listing line number to identify the corresponding
source code. If SMPROUT had a nonzero base, you would need to subtract the
base from the address (360C in this case) to find the relative address in the
listing file.
Note that the tool reports potential violations in its output. Although SRM_
CHECK can normally identify a code section in an image by the section’s
attributes, it is possible for OpenVMS images to contain data sections with those
same attributes. As a result, SRM_CHECK may scan data as if it were code, and
occasionally, a block of data may look like a noncompliant code sequence. This
circumstance is rare and can be detected by examining the MAP and listing files.
A.3 Noncompliant Code Characteristics
The areas of noncompliance detected by the SRM_CHECK tool can be grouped
into the following four categories. Most of these can be fixed by recompiling
with new compilers. In rare cases, the source code may need to be modified. See
Section A.5 for information about compiler versions.
• Some versions of OpenVMS compilers introduce noncompliant code sequences
during an optimization called "loop rotation." This problem can be triggered
only in C or C++ programs that use LDx_L/STx_C instructions in assembly
language code that is embedded in the C/C++ source using the ASM function,
A–2 Interlocked Memory Instructions (Alpha Only)