diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-28 19:16:17 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-28 19:16:17 -0600 |
| commit | ac9f9fc94440491661d4c37c2853c055f14dc7d8 (patch) | |
| tree | e88d0ec58d1fdc7647ed5012643306cf2a7f91c4 | |
| parent | d51ac5247e9b0393e9d05cd34f0e1b5e87f82c68 (diff) | |
| parent | 7993921ca96e48840c3225d8bbf0ab1bf0844593 (diff) | |
| download | whoson-ac9f9fc94440491661d4c37c2853c055f14dc7d8.tar.gz | |
Use constexpr for the ASVT offsets and eye-catchers
| -rw-r--r-- | whoson.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -94,26 +94,26 @@ static constexpr size_t ps_path_buf = 1027; /* CVTASVT. The ASVT's own head, then ASVTENTY, the array of ASCB addresses; * a set high bit marks an ASID that is free or non-reusable. */ /** @brief CVT field holding the ASVT address (CVTASVT). */ -#define CVT_ASVT_OFF 0x22Cu +static constexpr uint32_t cvt_asvt_off = 0x22CU; /** @brief ASVT field: the eye-catcher "ASVT". */ -#define ASVT_ACRONYM_OFF 0x200u +static constexpr uint32_t asvt_acronym_off = 0x200U; /** @brief ASVT field: highest ASID in use (ASVTMXU). */ -#define ASVT_MAXU_OFF 0x204u +static constexpr uint32_t asvt_maxu_off = 0x204U; /** @brief ASVT field: first entry of ASVTENTY, four bytes each. */ -#define ASVT_ENTY_OFF 0x210u +static constexpr uint32_t asvt_enty_off = 0x210U; /* An eye-catcher is a four-byte word that spells its block name in EBCDIC, * and these blocks are filled in while the system runs in EBCDIC, even when * whoson is built in ASCII mode. The value therefore cannot be a character * literal: 'ASCB' would be the ASCII bytes B0 09 34 7E. */ /** @brief "ASVT" as it appears in the ASVT. */ -#define ASVT_ACRONYM 0xC1E2E5E3u +static constexpr uint32_t asvt_acronym = 0xC1E2E5E3U; /** @brief "ASCB" as it appears in the ASCB. */ -#define ASCB_ACRONYM 0xC1E2C3C2u +static constexpr uint32_t ascb_acronym = 0xC1E2C3C2U; /** @brief "CSCB" as it appears in the CSCB. */ -#define CSCB_ACRONYM 0xC3E2C3C2u +static constexpr uint32_t cscb_acronym = 0xC3E2C3C2U; /** @brief "ASSB" as it appears in the ASSB. */ -#define ASSB_ACRONYM 0xC1E2E2C2u +static constexpr uint32_t assb_acronym = 0xC1E2E2C2U; /** @brief CSCB CHTRKID value that marks a TSO/E session. */ enum { CSCB_TRKID_TSO = 0x01 }; @@ -568,7 +568,7 @@ static int scan_one(unsigned idx, uint32_t entry, uint32_t entries, fault_armed = 0; return -1; } - if (read_u32(ascb_addr) != ASCB_ACRONYM) + if (read_u32(ascb_addr) != ascb_acronym) goto fail; asid = read_u16(ascb_addr + (uint32_t)offsetof(ascb, ascbasid)); if (asid != idx + 1) @@ -581,7 +581,7 @@ static int scan_one(unsigned idx, uint32_t entry, uint32_t entries, uint32_t assb_addr = read_u32(ascb_addr + (uint32_t)offsetof(ascb, ascbassb)); - if (assb_addr != 0 && read_u32(assb_addr) == ASSB_ACRONYM) + if (assb_addr != 0 && read_u32(assb_addr) == assb_acronym) tod += read_u64(assb_addr + (uint32_t)offsetof(assb, assbasst)); } /* A CSCB that has already been released can still be reachable through a @@ -589,7 +589,7 @@ static int scan_one(unsigned idx, uint32_t entry, uint32_t entries, * still belongs to this address space. */ if (cscb_addr != 0 && read_u32(cscb_addr + (uint32_t)offsetof(cscb, chcscbid)) == - CSCB_ACRONYM && + cscb_acronym && read_u16(cscb_addr + (uint32_t)offsetof(cscb, chasid)) == asid) { read_name(cscb_addr + (uint32_t)offsetof(cscb, chkey), key, sizeof(key)); @@ -645,15 +645,15 @@ static int read_asvt(unsigned *maxu, uint32_t *entries) { cvt = read_u32(16); if (cvt == 0) goto fail; - asvt = read_u32(cvt + CVT_ASVT_OFF); + asvt = read_u32(cvt + cvt_asvt_off); if (asvt == 0) goto fail; - if (read_u32(asvt + ASVT_ACRONYM_OFF) != ASVT_ACRONYM) + if (read_u32(asvt + asvt_acronym_off) != asvt_acronym) goto fail; - *maxu = read_u32(asvt + ASVT_MAXU_OFF) & 0xFFFFu; + *maxu = read_u32(asvt + asvt_maxu_off) & 0xFFFFu; if (*maxu == 0) goto fail; - *entries = asvt + ASVT_ENTY_OFF; + *entries = asvt + asvt_enty_off; fault_armed = 0; return 0; fail: |
