Browse Prior Art Database

Module Length Insertion Procedure

IP.com Disclosure Number: IPCOM000117646D
Original Publication Date: 1996-Apr-01
Included in the Prior Art Database: 2005-Mar-31
Document File: 2 page(s) / 70K

Publishing Venue

IBM

Related People

Lennon, CJ: AUTHOR [+3]

Abstract

Disclosed is a method for providing the length of a module. The module length is determined at assembly time and placed within the module in a manner where it can be easily found and retrieved.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 53% of the total text.

Module Length Insertion Procedure

      Disclosed is a method for providing the length of a module.
The module length is determined at assembly time and placed within
the module in a manner where it can be easily found and retrieved.

      This article describes a methodology by which a module length
can be included within the module and can easily be located for use
by the module.  The solution is to place the module size into a
specific location within a module using an assembler instruction
called a NO-OP BRANCH to hold this value.  The NO-OP BRANCH
instruction is a four-byte instruction that when executed results in
no action by the CPU.  Instead, it just ignores the instruction and
goes to the next instruction.  The first two bytes of the instruction
identify it as a NO-OP BRANCH and the third and fourth bytes are
ignored by the CPU.  This is where the size of the module is placed,
hidden from execution.  Using this NO-OP BRANCH instruction has two
advantages.  First, it hides the module length value during execution
of the module.  If it were not hidden and the CPU attempted to
execute it as an instruction, it would most likely cause a program
check condition (i.e., ABEND).  Second, it provides a unique
identifier (i.e., the X'4700' value in the first two bytes of the
instruction which indicates that it is a NO-OP BRANCH) that can
easily be found when the module length is required.

      To perform this placement, the size of the module is computed
at assemble time and placed into the NO-OP BRANCH instruction toward
the beginning of the module.  A sample of this placement follows:
  AMODULE   CSECT ,
               .
               .
               .
  * These next 2 lines of code are placed as close to the beginning
of
  * the module as possible.
           DC  XL2'4700'             * NO-OP BRANCH instruction
           DC  AL2(MODLEN)           * two byte module length
               .
           (program code)
               .
               .
  * This next instruction is placed at the very end of the CSECT.
  MODLEN   EQU  *-AMODULE            * this computes the module
length
           END                       * end of CSECT AMODULE

      In the above example, MODLEN  is the label of the computed
length of the module.  The first two assembler instructions will
generate the following value in the object code of the module very
close to the beginning of the module:
  4700xxxx
  where '4700' indicates that the instruction is a NO-OP BRANCH and
   'xxxx' is the length of the module.

To access the module length value in this ins...