#! /bin/ksh # This script modifies 32-bit XCOFF variable o_maxdata (+4C). # Non-zero o_maxdata uses the AIX "Large Address Space Model." # See "AIX: General Programming Concepts, Writing and Debugging Pgms." # To find the current maxdata setting for an executable # run the command dump -ov executable look for the maxDATA entry # on the last line. # exactly two parameters? # 1st parm is name of executable # 2nd parm is maxdata unit # maxdata units are: # 0 = 256mb # 1 = 256mb # 2 = 512mb # 3 = 768mb # 4 = 1024mb-1gb # 5 = 1280mb # 6 = 1536mb # 7 = 1792mb # 8 = 2048mb-2gb-max size for 32bit software/hardware # if [[ $# -ne 2 ]] then print 'usage: "maxdata XCOFF [0-8]"' ; print '\tThe second parameter (maxdata size) specifies units of 256M.' ; print '\te.g.: "maxdata /bin/xldb 4" sets /bin/xldb maxdata to 1G.' ; exit ; fi # first parm a 32-bit xcoff? file $1 | grep -q 'executable (RISC System/6000) or object module' ; if [[ $? -ne 0 ]] then print "$1 isn't a readable 32-bit XCOFF file." ; exit ; fi # ... and writable? if [[ ! -w $1 ]] then print "$1 isn't a writable and executable file." ; exit ; fi # second parm equals 0,1,2,...,8 ? case ${2:-4} in [0-8] ) typeset -i8 d=${2:-4}*16 ; typeset -i10 m=${2:-4}*256 ;; * ) print 'The second parameter has to be an integer [0-8].' ; exit 1 ;; esac # Do it: print -n "$1 o_maxdata before: " ; od -HAx -N4 -j76 $1 | head -1 ; eval "print -n '\\0'${d#*#}'\\0\\0\\0' | dd of=$1 bs=4 count=1 seek=19 conv=notrunc 2>/dev/null" ; print -n "$1 o_maxdata after: " ; od -HAx -N4 -j76 $1 | head -1 ; print "Maxdata in $1 now set to ${m}M." ;