Richard

Depending on what you are trying to accomplish, there are better options of 
sharing memory between two address spaces.

If you own the code in both address spaces, then you could use shared memory 
objects or even get ASID(A) to own a space-switch PC to return requested memory 
contents in a buffer to its callers in ASID(B).

If you do not own the code in ASID(A) and are using PGMB in ASID(B) to look at 
memory in ASID(A), then there are a couple of other techniques :
(o) ASID(B) schedules an SRB into ASID(A) to retrieve the memory - I have 
example code to do this at : https://github.com/rscott-rocket/mxe (there is 
also an allied Share presentation for this code)
(o) Use the BLSACTV service in SYS1.MACLIB (since z/OS 2.5) - this is actually 
what we use for the SDSF "MEM" command.

Using CHKEAX=NO for address spaces outside of your control is not ideal - about 
20 years ago on this very forum Chris Craddock (one of the original BMC 
Mainview/Resolve developers) commented the following :

"This technique for peeking into another address space is very dangerous on a 
number of levels. If the address space is out then any access to private area 
pages will fail. If you take page faults in that space and you need to be 
suspended then bind break processing may notice the target space is not set up 
for cross memory access and abend you (S058?) likewise if the address space 
terminates while you're looking at it. I would expect to bump into one or more 
of the S058 or related abends with some regularity with this technique"

Note that all of the above alternative methods can be achieved in PSW keys 
other than 0 (perhaps key2 or key4), which helps make your code safer as you 
are less likely to overwrite other important system or common memory by mistake 
and become "famous".

Rob Scott
Rocket Software

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Richard Zierdt
Sent: Tuesday, October 1, 2024 5:22 AM
To: [email protected]
Subject: Cross-Memory Access: Can an Address Space be treated as a Data Space 
using an ALET?

EXTERNAL EMAIL





The goal is to read data from an address space (not a data space) using an ALET.
The idea is "Program A" creates its own ALET that another program ("Program B") 
uses in its address space to read data from Program A's address space.  Is this 
possible ?

A summary of Program A code (AMODE31, RMODE24, authorized) is:
         ALESERV EXTRACTH,STOKEN=stoken  Returns STOKEN for the address space
         MODESET KEY=ZERO        Needed, or return code from ALESERV is not zero
         ALESERV ADD AL=PASN,
               STOKEN=stoken,    input STOKEN
               ALET=HomeALET,    output ALET
               CHKEAX=NO,
               AL=PASN,
               ACCESS=PUBLIC,
               MF=(E,ALESERV)
         SYSEVENT DONTSWAP       make unswappable
         WTOR  sit on a WTOR so that Program B can access Program A's address 
space

Result is HomeALET=x'01010038' which looks good, except that Program B gets an 
0E0, Reason Code 29 (hex) abend using that ALET.  "An ALET specified an access 
list entry (ALE) that is not valid."

A summary of Program B code (AMODE31, RMODE24, authorized) is:
         SAC   512                 sets the ASC mode to AR mode
         LAM   0,15,Zeros          clear access registers
         L     R6,=x'00007000'     load offset to data    into GR6
         LAM   6,6,=x'01010038'    load ALET of Program A into AR6
Abend0E0 MVC   Here,0(R6)          copy data from Program A to Here
         SAC   0                   escape AR mode
Here     ds    CL32

SYSTEM COMPLETION CODE=0E0  REASON CODE=00000029 ACTIVE MODULE 
ADDRESS=00000000_00007000  OFFSET=00000050 NAME=PROGRAMB DATA AT PSW  0000704A 
- C0809A66  C084D21F  C05C6000
AR/GR 0: 00000000/00000064   1: 00000000/00006FF8
      2: 00000000/00000040   3: 00000000/008DBD64
      4: 00000000/008DBD40   5: 00000000/008FB058
      6: 01010038/00007000   7: 00000000/00FBB880
      8: 00000000/008FD608   9: 00000000/008D0CB0
      A: 00000000/01DE1E00   B: 00000000/00000001
      C: 00000000/80007000   D: 00000000/00008000
      E: 00000000/80FD66D8   F: 00000000/80007000

Any help appreciated; Thanks --
Richard Zierdt

Confidentiality Warning/Avertissement de confidentialité:

This message is intended only for the named recipients. This message may 
contain information that is privileged or confidential. If you are not the 
named recipient, its employee or its agent, please notify us immediately and 
permanently destroy this message and any copies you may have. Ce message est 
destiné uniquement aux destinataires dûment nommés. Il peut contenir de 
l'information privilégiée ou confidentielle. Si vous n'êtes pas le destinataire 
dûment nommé, son employé ou son mandataire, veuillez nous aviser sans tarder 
et supprimer ce message ainsi que toute copie qui peut en avoir été faite.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ 
Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: 
https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - 
http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to