I found it in my archives, from 1995. External ASSEMBLER function,
callable from C - and PL/1 - , to switch the 0C8 mask bit on or off.
Some of you might understand the German comments.

*
**********************************************************
* *
*   SETFOFL - OC8-MASKENBIT AUS- ODER ANMACHEN *
* *
*   AUTOR: BERND OPPOLZER / CA. 1995 *
* *
*   UEBERNAHME IN CP0030 IM NOVEMBER 2002 *
* *
*   PROTOTYP: extern int setfofl (int *modus); *
* *
*   AUFRUFBEISPIEL: *
* *
*   modus = 0; *
*   modusalt = setfofl (&modus);                         *
* *
*   MODUS = NEUER MODUS; ALTER MODUS WIRD ALS *
*   FUNKTIONSERGEBNIS ZURUECKGEGEBEN *
* *
**********************************************************
*
SETFOFL  CSECT
         STM   14,12,12(13)        VERKUERZTE OS-KONVENTIONEN
         BALR  11,0
         USING *,11
*
         XR    2,2                 PROGRAMMMASKENBIT NACH R2
         IPM   2
         LR    4,2                 UND NACH R4
         N     2,=X'08000000'      FIXED OVERFLOW BIT
         SRA   2,27                NACH RECHTS AUF 1-ER-POSITION
*
         N     4,=X'F7FFFFFF'      BIT IN R4 AUSKNIPSEN
*
         L     3,0(1)              UEBERGEBENEN WERT HOLEN
         L     3,0(3)              UND NOCHMAL WG. CALL-BY-REF
         N     3,=X'00000001'      ALLES WEG AUSSER RECHTES BIT
         SLA   3,27                AUF POSITION DES FOFL-BITS
         OR    4,3                 UND REINWURSTELN
         SPM   4                   UND INS PSW DAMIT
*
         LR    15,2                RUECKGABE AN DEN RUFER
         L     14,12(13)
         LM    0,12,20(13)
         BR    14
*
         END




Am 01.04.2014 17:08, schrieb Bernd Oppolzer:
of course, all those problems are easily solved when coding
some small ASSEMBLER subprograms. I did this in fact, when we
had some problems in the past with the 0C8 abends due to high
order bits set in passed addresses (call an ASSEMBLER subprogram
to switch OFF the PSW mask bit for 0C8 on entry to the C module -
which the site wanted to be ON in the normal case - and switch it
ON again, when leaving the C module).

The solution with ASSEMBLER subprograms of course has the
drawback that you have to link the subprogram, that is, you have
some impact on the compile and link JCL, which is not always
desirable, and: you have to provide at least minimal linkage
conventions, while a C solution, as I provided it in my other post,
can be inlined in the generated C code without this overhead.

The key is indeed, as Andrew Rowley pointed it out: if you don't
tell the C compiler that the pointer coming from PL/1 is a pointer,
the C compiler will not treat it as a 31 bit value, so you can manipulate
it before casting it to a pointer ... at least I hope so. I see no reason,
why the solution proposed by Andrew should not work.

Kind regards

Bernd




Am 01.04.2014 16:44, schrieb Charles Mills:
Perhaps write the cleanup function in assembler? This is obviously a trivial problem in assembler. None of the inconvenience of strong typing to get in
your way LOL.

Charles

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


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

Reply via email to