10/30/95
Changing Between Large and Small Address Models
SPECIAL NOTICES
Information in this document is correct to the best of our
knowledge at the time of this writing. Please send feedback
by fax to "AIXServ Information" at (512) 823-4009.
Please use this information with care. IBM will not be
responsible for damages of any kind resulting from its use.
The use of this information is the sole responsibility of
the customer and depends on the customer's ability to eval-
uate and integrate this information into the customer's
operational environment.
ABOUT THIS DOCUMENT
This document describes how to change to the Large Address-
Space Model, which may be required for some applications
| which manipulate large amounts of data. This document
| applies to all levels of AIX 3.2. and later.
ABOUT SMALL AND LARGE ADDRESS-SPACE MODELS
The RISC System/6000 divides the address space into sixteen
equally sized segments of 256MB. When a program is loaded,
by default a single segment is allocated to program text
(executable instructions) and a second segment is allocated
to program data (heap, stack, user block).
This arrangement is sufficient for most applications.
Applications which manipulate large amounts of data,
however, may require more than one segment for program data.
This is facilitated with the "Large Address-Space Model",
which is described in InfoExplorer in the article "Large
Program Support Overview".
When an application is compiled, the loader stores the
maximum data-segment size in the executable file. This
value may be changed with the two scripts in the following
section. These two scripts modify the executable file
header and cause the executable to use the "Large Address-
Space Model."
THE SCRIPTS
For each script, create a file and carefully enter the
script text given below. Then put the two files in the
system directory where local commands are stored. This
directory must be in the $PATH environment variable for the
commands to be found. The files must then be made execut-
able with the "chmod" command "chmod 555 mksmall mklarge".
To change an executable command from the "Small Address-
Space Model" to the "Large Address-Space Model", execute the
script "mklarge" with the name of the file to be modified as
the argument. To change an executable command from the
"Large Address-Space Model" to the "Small Address-Space
Changing Between Large and Small Address Models 1
10/30/95
Model", execute the command "mksmall" with the name of the
file to be modified as the argument.
For example, to make the "gprof" command use the large
address-space model, execute the command:
mklarge /usr/ucb/gprof
This could be reversed with the command:
mksmall /usr/ucb/gprof
Note that these commands can only be executed by a user with
write permission on the file being changed.
NOTE: Depending on how you are viewing this document, some
characters in the following code may appear incorrectly. If
the characters in the following list do not match their
descriptions, be sure to change them in the code.
+----------------------------------------------------------+
| |
| [ left bracket |
| ] right bracket |
| ` grave (back tic) |
| |
+----------------------------------------------------------+
The "mklarge" Script
#!/bin/ksh
#
# mklarge -- change executable to be "large address-space model"
#
if [ $# -ne 1 -o ! -f "${1}" -o ! -x "${1}" -o ! -w "${1}" ]; then
/bin/echo 'usage: mklarge file'
exit 1
fi
MAGIC=`/bin/dd bs=1 count=2 if=${1} 2>/dev/null`
TEST=`/bin/echo '\001\0337\c'`
if [ "${MAGIC}" != "${TEST}" ]; then
/bin/echo "${1} is not an executable file"
exit 1
fi
/bin/echo '\200\0\0\0' | \
/bin/dd of=${1} bs=4 count=1 seek=19 conv=notrunc 2>/dev/null
exit 0
Changing Between Large and Small Address Models 2
10/30/95
The "mksmall" Script
#!/bin/ksh
#
#mksmall -- change executable to be "small address-space model"
#
if [ $# -ne 1 -o ! -f "${1}" -o ! -x "${1}" -o ! -w "${1}" ]; then
/bin/echo 'usage: mksmall file'
exit 1
fi
MAGIC=`/bin/dd bs=1 count=2 if=${1} 2>/dev/null`
TEST=`/bin/echo '\001\0337\c'`
if [ "${MAGIC}" != "${TEST}" ]; then
/bin/echo "${1} is not an executable file"
exit 1
fi
/bin/echo '\0\0\0\0' | \
/bin/dd of=${1} bs=4 count=1 seek=19 conv=notrunc 2>/dev/null
exit 0
Changing Between Large and Small Address Models 3
10/30/95
READER'S COMMENTS
Please fax this form to (512) 823-4009, attention "AIXServ Informa-
tion". You may also e-mail comments to: elizabet@austin.ibm.com.
These comments should include the same customer information requested
below.
Use this form to tell us what you think about this document. If you
have found errors in it, or if you want to express your opinion about
it (such as organization, subject matter, appearance) or make sug-
gestions for improvement, this is the form to use.
If you need technical assistance, contact your local branch office,
point of sale, or 1-800-CALL-AIX (for information about support offer-
ings). These services may be billable. Faxes on a variety of sub-
jects may be ordered free of charge from 1-800-IBM-4FAX. Outside the
U.S. call 415-855-4329 using a fax machine phone.
When you send comments to IBM, you grant IBM a nonexclusive right to
use or distribute your comments in any way it believes appropriate
without incurring any obligation to you.
NOTE: If you have a problem report or item number, supplying that
number may help us determine why a procedure did or did not work in
your specific situation.
Problem Report or Item #: Branch Office or Customer #:
Be sure to print your name and fax number below if you would like a
reply:
Name: Fax Number:
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
END OF DOCUMENT (JFH) (large.addr.model.lng, 4FAX# 2942)
Changing Between Large and Small Address Models 4