> I decided to start looking at the BSA instruction as part of a solution 
> to accessing memory in various keys using key 0.
> 
> I'm running a reentrant program from an authorized library (so it's 
> loaded in key 0) in problem state; I get a S0D3 abend, which I assume is 

> PIC 13 Special Operation exception, executing the following code:
> 
>           LARL  R6,BSA_RA        Address for reduced authority routine
>           OILH  R6,X'8000'       Mark address 31-bit
>           LLILF R5,X'00C00090'   preserve PKM, switch to Key 9
>           BSA   R5,R6            Off to Reduced Authority routine
> 
> BSA_BA   DS    0H               Return to base authority
>           ...
> 
> 
> BSA_RA   DS    0H               Reduced authority routine
>           SR    R6,R6            zero R6 in order to return
>           BSA   R5,R6            Return to base authority
>           DC    X'00DEAD00'      If something unpredicted happens
> 
> I abend S0D3 in the BSA_RA routine on the BSA instruction. Until I had 
> the program in key 0 memory, I abended S0C4 as I entered the BSA_RA 
> routine at the SR R6,R6 instruction because the program was loaded in 
> key 8 fetch-protected memory.
> 
> The only reason listed for a Special Operation exception for BSA is if 
> R6 is non-zero when returning to base authority.  And the dump shows it 
> is zero, and PSW is not updated with the address of BSA_BA.
> 
> Does anyone have any ideas of what probably obvious thing I'm missing 
here?
 
  Reconsider your interpretation of 
"When BRANCH AND SET AUTHORITY is executed
in the reduced-authority state, as indicated by the
reduced-authority (RA) bit in the DUCT being one, R2
must be zero; otherwise, a special-operation exception
is recognized."

  And then try
   BSA   R5,0             Return to base authority 

Jim Mulder   z/OS System Test   IBM Corp.  Poughkeepsie,  NY

Reply via email to