× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Addresses and Pointers
  • From: Dave McKenzie <davemck@xxxxxxxxxxxxx>
  • Date: Sun, 05 Aug 2001 08:43:05 -0700


ILE objects (modules, pgms, srvpgms) have not one, but many associated
spaces.  If you do SETSPPFP from a system pointer to the object
(e.g. a module), the space pointer returned points to the "primary"
A.S.  Within the "functional part" of the primary A.S., starting at
offset x20, are the addresses of the "secondary" A.S.'s.

There is indeed a new MI instruction to get to these: MATSSP,
Materialize Secondary Spaces.

The MI pgm below shows how to use MATSSP.  However, I haven't been
able to get it to compile directly.  So the pgm compiles a MATAUOBJ
instruction instead, which has similar parameters.  The RISC machine
code generated for MATAUOBJ & MATSSP differs only in the value put in
register 10: x1C for MATAUOBJ and x13D for MATSSP.  Here's the RISC
code for MATAUOBJ:

18BA36D45A 001598     000118    389C0000          ADDI 4,28,0
18BA36D45A 00159C     00011C    E05FBF92          LQ 2,0XBF90(31),2
18BA36D45A 0015A0     000120    38BB0000          ADDI 5,27,0
18BA36D45A 0015A4     000124    3940001C          ADDI 10,0,28
18BA36D45A 0015A8     000128    7C0004C8          TXER 0,0,41
18BA36D45A 0015AC     00012C    44000141          SCV 10

If you use SST to manually patch the 4th instruction to 3940013D, it
will be converted into a MATSSP.

MATSSP takes 3 parms:

  Parm 1:  SPP to a receiver structure
  Parm 2:  SYP to the object
  Parm 3:  SPP to a selection template

The selection template has 3 fields:

  SELTYP  - x11 = return only the NUMSPCS field
            x21 = return an array of SPP's to secondary spaces
            x31 = return an array of 48-byte attribute structures

  FIRSTSP - index (1-rel) of first space to return
  LASTSP  - index (1-rel) of last space to return (0 = only 1 space)

The MI assembler evidently knows about MATSSP.  If I change it to
MATSSPX, it complains about a bad opcode.  But it doesn't complain for
MATSSP.  If I give it only 2 parms, it complains that there aren't
enough parms.  I think it's the translator that doesn't recognize
the MI object code generated for it.

If you or anyone else can get MATSSP to compile, I'd sure like to hear
about it :-)

--Dave

        
--------------------------------------------------
         DCL DD OBJDESC CHAR(34) AUTO BDRY(2);
         DCL DD TYPESUB CHAR(2)  DEF(OBJDESC) POS(H'01');
         DCL DD OBJNAM  CHAR(30) DEF(OBJDESC) POS(H'03');
         DCL DD *       CHAR(2)  DEF(OBJDESC) POS(H'21') INIT(X'0000');

         DCL SPCPTR RCVRSPP   AUTO INIT(RCVR);
         DCL DD RCVR    CHAR(16400) AUTO BDRY(16);
         DCL DD BYTPROV    BIN(4) DEF(RCVR) POS(H'01');
         DCL DD BYTAVAIL   BIN(4) DEF(RCVR) POS(H'05');
         DCL DD NUMSPCS    BIN(2) DEF(RCVR) POS(H'09');
         DCL SPCPTR SPCSPPS(1024) DEF(RCVR) POS(H'11');

         DCL SYSPTR OBJSYP    AUTO;

         DCL SPCPTR SELSPP    AUTO INIT(SEL);
         DCL DD SEL     CHAR(16) AUTO BDRY(2);
         DCL DD SELTYP  CHAR( 1) DEF(SEL) POS(H'01');
         DCL DD FIRSTSP  BIN( 2) DEF(SEL) POS(H'03');
         DCL DD LASTSP   BIN( 2) DEF(SEL) POS(H'05');

         DCL SPCPTR SSPCSPP   AUTO;
         DCL SPC SSPC         BAS(SSPCSPP);

         DCL DD WKBIN    BIN( 2) AUTO BDRY(2);

         CPYBLA     TYPESUB, X'0201';
         CPYBLAP    OBJNAM,' ',' ';
         CPYBLA     OBJNAM, 'ANILEPGM';
         RSLVSP     OBJSYP, OBJDESC, *,*;

         CPYBLAP    RCVR, X'00',X'00';
         CPYNV      BYTPROV, 16400;

         CPYBLAP    SEL, X'00',X'00';
         CPYBLA     SELTYP, X'21'       /* SPP'S  */;
         CPYNV      FIRSTSP, 1;
         CPYNV      LASTSP, 1024;

     /*  MATSSP     RCVRSPP, OBJSYP, SELSPP;  */
         MATAUOBJ   RCVRSPP, OBJSYP, SEL;

         CPYNV      WKBIN, 1;
         SETSPPFP   SSPCSPP, SPCSPPS(WKBIN);
         PEND;
--------------------------------------------------


On Saturday 28 July 2001 08:43, Leif Svalgaard wrote:
> Folks,
>
> In MI, to access some data you need (in general) a space pointer
> to the data. Several objects have addresses to other objects in
> them. How does one turn such an address into a pointer?
> (without patching the program and making a counterfeit
> pointer). Similarly, some associated spaces have useful
> data in the *functional part* of their associated spaces
> (e.g. debug information for *MODULES). The SETSPPFP
> instruction does not give you access to the functional part.
>
> Are there any new MI-instructions for this that I don't know about?
> If not, are there APIs that I don't know about? and how do
> these do their magic?
+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.