On Thu, May 11, 2017 at 4:55 PM, Bernd Oppolzer <[email protected]>
wrote:

> Yes, of course. I detected the error when I looked at
> my piece of software from last year which examined the different LE heaps.
>
> and: thank you, Allan Kielstra, for the clarification regarding Reg 12;
> so my call to the ASSEMBLER function to get the address of the CEECAA will
> work?
>
> Here is the ASSEMBLER program which returns the registers (especially reg
> 12)
> to the C program:
>
> MDV9970  CSECT
> MDV9970  AMODE 31
> MDV9970  RMODE ANY
> *
> ***************************************************************
> *        UNTERPROGRAMM ZUR ERMITTLUNG DER
> *        AKTUELLEN REGISTERSTAENDE UND ABLAGE
> *        IN EINEN C-BUFFER (DER ALS PARAMETER
> *        UEBERGEBEN WIRD). ZWECK DER UEBUNG:
> *        ZUGRIFF AUF CEECAA (COMMON ANCHOR AREA VOM LE)
> *        UND DAMIT AUF ANYHEAP UND BELOWHEAP
> *        BERND OPPOLZER / AUGUST 2016
> ***************************************************************
> *
> R0       EQU   0
> R1       EQU   1
> R2       EQU   2
> R3       EQU   3
> R4       EQU   4
> R5       EQU   5
> R6       EQU   6
> R7       EQU   7
> R8       EQU   8
> R9       EQU   9
> RA       EQU   10
> RB       EQU   11
> RC       EQU   12
> RD       EQU   13
> RE       EQU   14
> RF       EQU   15
> *
>          STM   RE,RC,12(RD)        REGISTER SICHERN
>          USING MDV9970,RF          ADRESSIERUNG HERSTELLEN
>          L     R3,0(R1)            ADRESSE VOM BUFFER = 1. PARAMETER
>          MVC   0(52,R3),20(RD)     REGISTER 0 BIS 12 AUS SA UEBERTR.
>          ST    RD,52(R3)           REGISTER 13 ABSPEICHERN
>          MVC   56(8,R3),12(RD)     REGISTER 14 UND 15 AUS SA UEBERTR.
>          LM    RE,RC,12(RD)        REGISTER ZURUECKLADEN
>          BR    RE                  UND RUECKSPRUNG
> *
>          END   MDV9970
>

​Looks fairly good to me. For returning the 32 bit registers, that is. But
it seems to be "overkill" to me. The "guts" of the routine could be just:

     STM R0,RF,12(RD) SAVE ALL REGS.
     L R3,0(,R1) POINT TO RETURN AREA
     ​MVC 0(64,R3),12(RD) MOVE REGS AT ENTRY
     SLR RF,RF
     BR RE

This does not use standard linkage, but is that really necessary? The only
possible abend would be on the MVC, if the routine is not called properly.
I included the SLR just to "zero" the return code. If the C code is
declared as returning "void" (e.g. "void MDV9970(regs) ;" where regs is
defined as "uint regs[16];" ) then R15 on exit is ignored.



>
> Kind regards
>
> Bernd
>
>
>
-- 
Advertising is a valuable economic factor because it is the cheapest way of
selling goods, particularly if the goods are worthless. -- Sinclair Lewis


Maranatha! <><
John McKown

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

Reply via email to