Skip to content

Commit

Permalink
Merge pull request #427 from zowe/update-v3
Browse files Browse the repository at this point in the history
Update v3
  • Loading branch information
JoeNemo authored Feb 21, 2024
2 parents e23522d + 6411387 commit eb8bd1e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
6 changes: 4 additions & 2 deletions c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,10 +1626,12 @@ ZOWE_PRAGMA_PACK_RESET
recoveryRC = recoveryEstablishRouter2(&(envAddr)->recoveryContext, \
(cmsGlobalAreaAddr)->pcssRecoveryPool, \
RCVR_ROUTER_FLAG_PC_CAPABLE | \
RCVR_ROUTER_FLAG_RUN_ON_TERM); \
RCVR_ROUTER_FLAG_RUN_ON_TERM | \
RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY); \
} else { \
recoveryRC = recoveryEstablishRouter(RCVR_ROUTER_FLAG_PC_CAPABLE | \
RCVR_ROUTER_FLAG_RUN_ON_TERM); \
RCVR_ROUTER_FLAG_RUN_ON_TERM | \
RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY); \
} \
if (recoveryRC != RC_RCV_OK) { \
returnCode = RC_CMS_ERROR; \
Expand Down
30 changes: 17 additions & 13 deletions c/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,12 @@ static StackedState getStackedState(StackedStateExtractionCode code) {
return state;
}

static uint8_t getPSWKey(void) {
int pswHighWord;
__asm(" EPSW 0,0 " : "=NR:r0"(pswHighWord));
return (pswHighWord >> 20) & 0x0F;
}

typedef struct RecoveryStatePool_tag {

#define RCVR_STATE_POOL_EYECATCHER "RCVSPOOL"
Expand All @@ -1072,15 +1078,12 @@ static CPID makeRecoveryStatePool(unsigned int primaryCellCount,
unsigned int secondaryCellCount,
int storageSubpool) {

StackedState stackedState = getStackedState(STACKED_STATE_EXTRACTION_CODE_01);
uint8_t pswKey = (stackedState.state01.psw & 0x00F0000000000000LLU) >> 52;

unsigned alignedCellSize =
cellpoolGetDWordAlignedSize(sizeof(RecoveryStateEntry));
CPID poolID = cellpoolBuild(primaryCellCount,
secondaryCellCount,
alignedCellSize,
storageSubpool, pswKey,
storageSubpool, getPSWKey(),
&(CPHeader){"ZWESRECOVERYSTATEPOOL "});

return poolID;
Expand Down Expand Up @@ -1173,8 +1176,7 @@ static int establishRouterInternal(RecoveryContext *userContext,
}
#endif /* RCVR_CPOOL_STATES */

StackedState stackedState = getStackedState(STACKED_STATE_EXTRACTION_CODE_01);
context->routerPSWKey = (stackedState.state01.psw & 0x00F0000000000000LLU) >> 48;
context->routerPSWKey = getPSWKey() << 4;

__asm(
" ST 12,%0 \n"
Expand Down Expand Up @@ -1729,9 +1731,13 @@ int recoveryPush(char *name, int flags, char *dumpTitle,
return RC_RCV_CONTEXT_NOT_FOUND;
}

int16_t linkageStackToken = getLinkageStackToken();
if (linkageStackToken == -1) {
return RC_RCV_LNKSTACK_ERROR;
int16_t linkageStackToken = 0;
if (!(context->flags & RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY) ||
(flags & RCVR_FLAG_QUERY_LSTACK)) {
linkageStackToken = getLinkageStackToken();
if (linkageStackToken == -1) {
return RC_RCV_LNKSTACK_ERROR;
}
}

RecoveryStateEntry *newEntry =
Expand All @@ -1745,13 +1751,11 @@ int recoveryPush(char *name, int flags, char *dumpTitle,

newEntry->linkageStackToken = linkageStackToken;

/* Extract key from the newly created stacked state. IPK cannot be used
* as it requires the extract-authority set.
/* Extract the current key from the PSW.
* This value will be used to restore the current's recovery state key if
* it changes during the recovery process - this usually happens under an SRB
* when SETRP retry with key 0. */
StackedState stackedState = getStackedState(STACKED_STATE_EXTRACTION_CODE_01);
newEntry->key = (stackedState.state01.psw & 0x00F0000000000000LLU) >> 48;
newEntry->key = getPSWKey() << 4;

__asm(

Expand Down
29 changes: 27 additions & 2 deletions h/recovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ typedef struct RecoveryStateEntry_tag {
#define RCVR_FLAG_SDWA_TO_LOGREC 0x08000000
#define RCVR_FLAG_DISABLE 0x10000000
#define RCVR_FLAG_CPOOL_BASED 0x20000000
#define RCVR_FLAG_QUERY_LSTACK 0x40000000
volatile char state;
#define RECOVERY_STATE_DISABLED 0x00
#define RECOVERY_STATE_ENABLED 0x01
Expand Down Expand Up @@ -282,6 +283,7 @@ typedef struct RecoveryContext_tag {
#define RCVR_ROUTER_FLAG_SRB 0x20000000
#define RCVR_ROUTER_FLAG_LOCKED 0x40000000
#define RCVR_ROUTER_FLAG_FRR 0x80000000
#define RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY 0x00010000
int previousESPIEToken;
unsigned char routerPSWKey;
uint8_t structVersion;
Expand Down Expand Up @@ -365,8 +367,19 @@ typedef struct RecoveryContext_tag {
* RCVR_ROUTER_FLAG_NONE - no flags
* RCVR_ROUTER_FLAG_NON_INTERRUPTIBLE - cancel or detach will not
* interrupted recovery process
* RCVR_ROUTER_FLAG_PC_CAPABALE - should be set when the recovery
* RCVR_ROUTER_FLAG_PC_CAPABLE - should be set when the recovery
* needs to used in PC calls
* RCVR_ROUTER_FLAG_RUN_ON_TERM - ESTAEX exit to be scheduled in case
* of termination events (see the
* description of the TERM parameter
* in the ESTAEX documentation)
* RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY - by default do not perform
* linkage-stack queries in
* recoveryPush calls for this router
* (use this flag for a better
* performance if there are no
* linkage-stack entries added
* between recoveryPush calls)
*
* Return value:
* When a router has successfully been established, the function returns
Expand All @@ -391,8 +404,19 @@ int recoveryEstablishRouter(int flags);
* RCVR_ROUTER_FLAG_NONE - no flags
* RCVR_ROUTER_FLAG_NON_INTERRUPTIBLE - cancel or detach will not
* interrupted recovery process
* RCVR_ROUTER_FLAG_PC_CAPABALE - should be set when the recovery
* RCVR_ROUTER_FLAG_PC_CAPABLE - should be set when the recovery
* needs to used in PC calls
* RCVR_ROUTER_FLAG_RUN_ON_TERM - ESTAEX exit to be scheduled in case
* of termination events (see the
* description of the TERM parameter
* in the ESTAEX documentation)
* RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY - by default do not perform
* linkage-stack queries in
* recoveryPush calls for this router
* (use this flag for a better
* performance if there are no
* linkage-stack entries added
* between recoveryPush calls)
*
* Return value:
* When a router has successfully been established, the function returns
Expand Down Expand Up @@ -470,6 +494,7 @@ bool recoveryIsRouterEstablished();
* RCVR_FLAG_DELETE_ON_RETRY - state is removed on retry
* RCVR_FLAG_SDWA_TO_LOGREC - SDWA is written to LOGREC
* RCVR_FLAG_DISABLE - state is disabled
* RCVR_FLAG_QUERY_LSTACK - perform a linkage-stack query
* dumpTitle - SVC dump title
* userAnalysisFunction - function called in the very beginning of
* recovery
Expand Down
2 changes: 1 addition & 1 deletion manifest.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ keywords:
- zowe
- zowe-common-c
- appfw
license: EPL-2.0
license: EPL-2.0

0 comments on commit eb8bd1e

Please sign in to comment.