HP OpenVMS Systems

ask the wizard
Content starts here

Alpha Macro32 Compiler and Alpha Calling Standard?

» close window

The Question is:

I'm in the process of converting some MACRO-32 code from VAX to ALPHA.  The
 MACRO is a subroutine that gets called from FORTRAN programs.  The subroutine
 takes 9 parameters.
The original code made use of references to the AP.  This was causing me some
 grief in this case, although in other routines with fewer parameters, I had no
I've decided to alter the code to conform to the ALPHA calling standards.  I
 replaced references to (AP) for the argument count to R25.  The first six
 parameters, I replaced with the appropriate registers (R16 thru R21).
According to table 3-14 in the "OpenVMS Calling Standard" manual, the remaining
 3 parameters should be referenced as 0(SP), 8(SP) and 16(SP), respectively.
When I did this, the compiler complained with an error of UPLEVSTK.  I'm not
 sure how why or how to get around this.
Can you provide an example of MACRO subroutine that takes more than 6
 parameters that I can refer to?
Thanks in advance for any help you can provide.
Tim DiBendetto

The Answer is :

  First, determine if you even need the Macro32 code.  In many
  cases, the Macro32 code is no longer required and can be
  replaced as alternative solution(s) are now available.
  Then make only the recommended motifications to the Macro32 code,
  there is no need to modify the register operations to match the
  Macro64 assembler registers as you are working with the Macro32
  compiler and not the Macro64 assembler.
  The Macro32 compiler will correctly process argument lists with
  more than six arguments -- the code generated by the Macro32
  compiler will correctly and transparently use the six Alpha
  hardware registers and the stack designated for this purpose
  by the Alpha calling standard.
  A simple example of Macro32 argument passing follows:
        .psect code,nowrt,exe,quad
        .entry  main,^m<r2>
        pushl   #^x10101
        pushl   #^x20202
        pushl   #^x30303
        pushl   #^x40404
        pushl   #^x50505
        pushl   #^x60606
        pushl   #^x70707
        calls   #^x7,sub
        cmpl    r0,#^x10101
        beql    10$
        movl    #ss$_badparam,r0
10$:    movl    #ss$_normal,r0
        .entry  sub,^m<r2>
        movl    7*4(ap),r0
        .end    main

answer written or last revised on ( 22-MAR-2001 )

» close window