[Info-vax] VMS process communication

Andreas Gruhl gruhl at isidata.de
Mon Mar 20 05:37:49 EDT 2023


Arne Vajhøj schrieb am Samstag, 18. März 2023 um 01:26:39 UTC+1:
> On 3/16/2023 5:05 AM, Andreas Gruhl wrote: 
> > Arne Vajhøj schrieb am Donnerstag, 16. März 2023 um 01:47:31 UTC+1: 
> >> On 3/10/2023 4:01 PM, Arne Vajhøj wrote: 
> >>> Pre-release for comments: 
> >>> 
> >>> https://www.vajhoej.dk/arne/articles/vms64.html 
> >> 
> >> Updated to version 1.0 based on comments.
> > Small correction: PASCAL/USAGE=64BIT_TO_DESCR does NOT change the 
> > compiler's treatment of pointers. Interpreting pointers as unsigned 
> > values has to be provided by the programmer. The qualifier only 
> > allows for P2 structures to be used as actual routine parameters via 
> > descriptor, which otherwise would be flagged as a compile time 
> > error.
> So it does not change the treatment of pointers. 
> 
> It disables a compiler check. 
> 
> Like allowing this to compile: 
> 
> procedure whatever(...; %STDESCR somearg; ...); external; 
> ... 
> (* z is in lower 2 GB of P2 space *) 
> ... 
> whatever(..., z, ...); 
> 
> ? 
> 
> Arne
That's correct. 
'whatever' then has to take care of interpreting somearg as a descriptor and treating the pointer contained inside as unsigned.
We usually enable direct access to descriptors by using two different routine declarations, e.g.
[external(whatever_i)] procedure whatever(...; %STDESCR somearg; ...); external; (* official declaration *)
[global] procedure whatever_i(...; var somearg : dsc$type; ...); external;  (* internal implementation, dsc$type from starlet *)
type ptr_string = [quad]^packed array[1..1000] of char; 
var uns : unsigned64 ;
       ptr : ptr_string; (* a 64 bit pointer *)
begin
uns:=somearg.dsc$a_pointer::unsigned; (* convert to 64 bits avoiding sign extension *)
ptr:=uns::ptr_string; (* convert to 64 bit pointer type *)
(* ptr can now be used to access the z argument without any further restrictions. *)
...
end;
This works for all z addresses between 0 and %XFFFFFFFF, which includes P0, P1 and the first 2 GB of P2
(if you encounter even larger addresses, only the lower 32 address bits will be correct - but sometimes this can help, too).
We use this heavily to extend the lifetime of our 32-bit routines into the 64 bit era without having to apply
changes to the calling programs.
And again: none of these programs misses the default behaviour of addresses above %7FFFFFFF to access system space.
This feature is almost useless for application programs. Whereas doubling the available address space into P2 is VERY useful.
Andreas



More information about the Info-vax mailing list