[Info-vax] VMS process communication

Arne Vajhøj arne at vajhoej.dk
Sat Mar 25 13:09:22 EDT 2023


On 3/22/2023 1:37 PM, John Reagan wrote:
> On Wednesday, March 22, 2023 at 1:13:20 PM UTC-4, Ian Miller wrote:
>> On Wednesday, March 22, 2023 at 2:50:17 PM UTC, Arne Vajhøj wrote:
>>> On 3/22/2023 7:18 AM, Ian Miller wrote:
>>>> On VMS E9.2-1 x86-64 all code by default is put into P2 by the
>>>> linker but you can put /SEGMENT=CODE=P0 to stop that.

>>> So is a function pointer always 64 bit?

>> from the release notes "The LINKER creates small stub routines in 
>> 32-bit P0 space to allow the address of a routine to be stored in
>> a 32-bit variable."
VMS is VMS.

:-)

> For the most part, few people have noticed that the code now resides
> in 64-bit space.  The linker-created trampolines hide the details.
> The trampoline IS the routine's address.   Shareable image
> symbol-vectors feel more like VAX these days since they also are an
> array of trampolines.
> 
> What I've seen more is VAX-era code (mostly Macro-32 and BLISS) that
> goes out of the way to place readonly data into the $CODE$ PSECT or
> mark $PLIT$/$LITERAL$/etc as EXE.

They have do something special.

$ type hw.mar
         .title  hw
         .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
hw:     .asciz  "Hello world!"
         .entry  gethw,^m<>
         movab   hw,r0
         ret
         .end
$ macro hw

hw:     .asciz  "Hello world!"
^
%AMAC-E-DATINCODE, data in code stream
at line number 3 in file DISK2:[ARNE]hw.mar;1

Of course they can do:

$ type hw2.mar
         .title  hw2
         .psect  $PDATA quad,pic,con,lcl,shr,noexe,nowrt
hw:     .asciz  "Hello world!"
         .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
         .entry  gethw,^m<>
         movab   hw,r0
         ret
         .end
$ macro hw2
$ type hw0.c
#include <stdio.h>

char *gethw();

int main(int argc, char *argv[])
{
     printf("%s\n", gethw());
     return 0;
}
$ cc hw0
$ link/map hw0 + hw2 + sys$input/opt
psect_attr=$pdata,EXE
$
$ run hw0
Hello world!

which if I understand correct will fail on x86-64
default and on Itanium with eksplicit /SEGMENT=CODE=P2
because returning a P2 address in 32 bit just doesn't work.

Arne





More information about the Info-vax mailing list