<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: fortran calling macro in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058911#M38063</link>
    <description>thanks to all&lt;BR /&gt;the ap has been changed to not inc&lt;BR /&gt;.call_entry used&lt;BR /&gt;&lt;BR /&gt;found that one routine was using rsb&lt;BR /&gt;instead of ret&lt;BR /&gt;&lt;BR /&gt;code is working now&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;John</description>
    <pubDate>Thu, 19 Jul 2007 12:53:52 GMT</pubDate>
    <dc:creator>JDuck</dc:creator>
    <dc:date>2007-07-19T12:53:52Z</dc:date>
    <item>
      <title>fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058903#M38055</link>
      <description>I am moving code from a VAX to Itanium.  When the fortran code calls a subroutine written in macro it crashes giving an access violation.  This appears to be associated with the AP or writting to R0.  I have attached a  test program that demonstrates the problem&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 18 Jul 2007 10:35:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058903#M38055</guid>
      <dc:creator>JDuck</dc:creator>
      <dc:date>2007-07-18T10:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058904#M38056</link>
      <description>Didn't you get an -I- message from the Macro compiler for your modification of the AP register?&lt;BR /&gt;&lt;BR /&gt;I received:&lt;BR /&gt;&lt;BR /&gt;%IMAC-I-APTEMPUSE, AP used as a temporary register is converted to R12 in routine DOIT&lt;BR /&gt;&lt;BR /&gt;There is no AP register on Itanium.  Your code's use of the auto-increment addressing mode forced us to reassign AP from its semantic meaning of the "arglist" to some scratch register.  &lt;BR /&gt;&lt;BR /&gt;Change the:&lt;BR /&gt;&lt;BR /&gt;   movl (ap)+,r0&lt;BR /&gt;&lt;BR /&gt;into&lt;BR /&gt;&lt;BR /&gt;   movb (ap), r0&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Wed, 18 Jul 2007 10:55:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058904#M38056</guid>
      <dc:creator>John Reagan</dc:creator>
      <dc:date>2007-07-18T10:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058905#M38057</link>
      <description>Thanks&lt;BR /&gt;I got the -i- message but since it was info I didnt think it would be a problem.  I read that AP was reassigned to r12.  the code you sent did work.  how do i increment to get to the next passed argument.&lt;BR /&gt;&lt;BR /&gt;incl r12?&lt;BR /&gt;incl ap?&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Wed, 18 Jul 2007 12:25:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058905#M38057</guid>
      <dc:creator>JDuck</dc:creator>
      <dc:date>2007-07-18T12:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058906#M38058</link>
      <description>the next argument will be 4(AP).&lt;BR /&gt;Best not increment AP</description>
      <pubDate>Wed, 18 Jul 2007 13:24:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058906#M38058</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2007-07-18T13:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058907#M38059</link>
      <description>To quote from the MACRO32 porting manual&lt;BR /&gt;[&lt;A href="http://h71000.www7.hp.com/doc/82final/5601/aa-pv64e-te.pdf]" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/5601/aa-pv64e-te.pdf]&lt;/A&gt;&lt;BR /&gt;"If a VAX MACRO source is&lt;BR /&gt;referencing AP as a scratch register, the compiler converts this reference to a&lt;BR /&gt;reference to R12. If this is not desirable, you should change the code to use a&lt;BR /&gt;different scratch register."&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jul 2007 13:27:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058907#M38059</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2007-07-18T13:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058908#M38060</link>
      <description>I think if you do change the code to copy AP to another register then the MACRO compiler will home the argument list. See section&lt;BR /&gt;2.4.1 Homed Argument Lists &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/5601/aa-pv64e-te.pdf" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/5601/aa-pv64e-te.pdf&lt;/A&gt;</description>
      <pubDate>Wed, 18 Jul 2007 13:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058908#M38060</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2007-07-18T13:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058909#M38061</link>
      <description>If you do something like&lt;BR /&gt;&lt;BR /&gt;  movab (ap),r6&lt;BR /&gt;&lt;BR /&gt;we'll notice you take the address of the argument list.  You can also put the HOME_ARGS=TRUE on the .CALL_ENTRY directive (you should read the Macro Compiler user manual from the docset).&lt;BR /&gt;&lt;BR /&gt;Once the compiler sees the MOVAB or HOME_ARGS, we'll home the argument list to memory to make it look like a VAX.  On Itanium, the first 8 arguments are inside of 64-bit wide registers and the remainder of the arguments are in 64-bit wide argument slots.  The compiler will copy them all into a 32-bit array to make the arguments look like they do on the VAX.  That is the address you'll get with the MOVAB instruction above.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jul 2007 14:26:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058909#M38061</guid>
      <dc:creator>John Reagan</dc:creator>
      <dc:date>2007-07-18T14:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058910#M38062</link>
      <description>Just for completeness...&lt;BR /&gt;&lt;BR /&gt;I was sent a larger example via email.&lt;BR /&gt;&lt;BR /&gt;MOVL (AP)+,R0 ; POP THE ARGUMENT COUNT INTO R0&lt;BR /&gt;MOVL (AP)+,R0 ;ADDRESS OF THE INPUT BUFFER&lt;BR /&gt;ADDL2 #24,R0 ;POINT DIRECTLY TO THE DATA BUFFER&lt;BR /&gt;MOVL (AP)+,A ;LOAD UNIT NUMBER ADDRESS&lt;BR /&gt;MOVL (AP)+,C ;LOAD PAYROLL NUMBER ADDRESS&lt;BR /&gt;MOVL (AP)+,D ;LOAD PERSONNAL PASSWORD ADDRESS&lt;BR /&gt;MOVL (AP)+,E ;LOAD SYSTEM PASSWORD ADDRESS&lt;BR /&gt;MOVL (AP)+,F ;LOAD SHOP NUMBER ADDRESS&lt;BR /&gt;&lt;BR /&gt;The code is reading arguments by incrementing the AP register and walking down the list.&lt;BR /&gt;&lt;BR /&gt;While the AP is a real register on VAX, it is an abstract concept created by the compiler on Alpha and Itanium.  Section 2.4.3 in the HP MACRO Compiler Porting and User's Guide talks about this non-portable practice.&lt;BR /&gt;&lt;BR /&gt;A revised sequence would be something like:&lt;BR /&gt;&lt;BR /&gt;MOVL 4(AP),R0 ;ADDRESS OF THE INPUT BUFFER&lt;BR /&gt;ADDL2 #24,R0 ;POINT DIRECTLY TO THE DATA BUFFER&lt;BR /&gt;MOVL 8(AP),A ;LOAD UNIT NUMBER ADDRESS&lt;BR /&gt;MOVL 12(AP),C ;LOAD PAYROLL NUMBER ADDRESS&lt;BR /&gt;MOVL 16(AP),D ;LOAD PERSONNAL PASSWORD ADDRESS&lt;BR /&gt;MOVL 20(AP),E ;LOAD SYSTEM PASSWORD ADDRESS&lt;BR /&gt;MOVL 24(AP),F ;LOAD SHOP NUMBER ADDRESS&lt;BR /&gt;&lt;BR /&gt;There is no actual need to increment/modify the AP register just to fetch the fixed number of arguments.  The compiler will do the right thing and location each argument regardless of whether is came in via a register or on the memory stack.  No argument homing is needed.</description>
      <pubDate>Thu, 19 Jul 2007 10:15:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058910#M38062</guid>
      <dc:creator>John Reagan</dc:creator>
      <dc:date>2007-07-19T10:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: fortran calling macro</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058911#M38063</link>
      <description>thanks to all&lt;BR /&gt;the ap has been changed to not inc&lt;BR /&gt;.call_entry used&lt;BR /&gt;&lt;BR /&gt;found that one routine was using rsb&lt;BR /&gt;instead of ret&lt;BR /&gt;&lt;BR /&gt;code is working now&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Thu, 19 Jul 2007 12:53:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-calling-macro/m-p/5058911#M38063</guid>
      <dc:creator>JDuck</dc:creator>
      <dc:date>2007-07-19T12:53:52Z</dc:date>
    </item>
  </channel>
</rss>

