summaryrefslogtreecommitdiffhomepage
path: root/src/vsm.h
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-27 18:15:26 -0600
committerGitHub <noreply@github.com>2026-11-27 18:15:26 -0600
commit83e8fbc692b36be5ac9011ccf26b1b232d560008 (patch)
treeab62a06c6a49b343b33d41b502487b233128ad80 /src/vsm.h
parent4c95e6490d189b47cad050744de9768465e0307b (diff)
parentb5bb63d4760f6f6e0282fc9f7eec36b41705458c (diff)
downloadztop-main.tar.gz
Merge pull request #7 from skurtz97/feature/views-and-dec-glyphsHEADmain
views: PS, FS and LOG, and a DEC-graphics frame
Diffstat (limited to 'src/vsm.h')
-rw-r--r--src/vsm.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/vsm.h b/src/vsm.h
index b762788..ae17a1a 100644
--- a/src/vsm.h
+++ b/src/vsm.h
@@ -10,7 +10,6 @@
#ifndef ZTOP_VSM_H
#define ZTOP_VSM_H
-#include <stdbool.h>
#include <stdint.h>
/** @brief Area codes, the same numbers the assembler stub takes. */
@@ -20,42 +19,49 @@ enum vsm_area { VSM_CSA = 1, VSM_SQA = 2, VSM_LSQA = 3, VSM_PVT = 4 };
enum vsm_space { VSM_FREE = 1, VSM_UNALLOC = 2 };
/** @brief Rows kept per area; PVT can hold several TCBs of subpools. */
-#define VSM_MAX_SUB 512
+enum { VSM_MAX_SUB = 512 };
/** @brief Region descriptors kept for display (CSA/ECSA/RUCSA, PVT regions). */
-#define VSM_MAX_REGION 16
+enum { VSM_MAX_REGION = 16 };
+
+/** @brief The 16-megabyte line: below it are 24-bit addresses. */
+enum { VSM_LINE_16M = 0x01000000 };
/** @brief One subpool: allocated blocks, the free space in them, the real use.
*/
-struct vsm_subpool {
+typedef struct vsm_subpool {
unsigned id; /**< translated subpool number */
unsigned key; /**< storage key from the descriptor's flag byte */
unsigned flags; /**< the descriptor's flag byte */
uint32_t tcb; /**< owning TCB for PVT, zero for common areas */
uint64_t used; /**< block bytes minus free space inside the blocks */
+ uint64_t below; /**< used bytes in blocks starting below the 16M line */
+ uint64_t above; /**< used bytes in blocks starting at or above 16M */
uint64_t free; /**< free space inside allocated blocks */
uint64_t foot; /**< footprint: sum of allocated block lengths */
uint64_t largest; /**< largest allocated block */
uint32_t lo, hi; /**< address range of the allocated blocks */
unsigned blocks; /**< number of allocated blocks */
-};
+} vsm_subpool;
/** @brief A region descriptor (an unallocated range, or a PVT region). */
-struct vsm_region {
+typedef struct vsm_region {
uint32_t addr;
uint32_t len;
-};
+} vsm_region;
/** @brief Everything one area reports, accumulated over continuation calls. */
-struct vsm_info {
+typedef struct vsm_info {
unsigned area; /**< enum vsm_area */
unsigned space; /**< enum vsm_space of the last parse */
unsigned tcbs; /**< PVT: TCBs listed */
int nsub;
- struct vsm_subpool sub[VSM_MAX_SUB];
+ vsm_subpool sub[VSM_MAX_SUB];
unsigned blocks; /**< allocated blocks in the area */
uint64_t used;
+ uint64_t below; /**< used bytes in blocks starting below the 16M line */
+ uint64_t above; /**< used bytes in blocks starting at or above 16M */
uint64_t free;
uint64_t foot;
uint64_t largest;
@@ -65,15 +71,15 @@ struct vsm_info {
uint64_t unalloc; /**< unallocated bytes (CSA/PVT only) */
uint64_t largest_unalloc;
int nregion;
- struct vsm_region region[VSM_MAX_REGION];
+ vsm_region region[VSM_MAX_REGION];
bool truncated; /**< more subpools than VSM_MAX_SUB; totals still right */
bool unalloc_valid; /**< the UNALLOC request succeeded */
char err[160]; /**< why the last parse or service call failed */
-};
+} vsm_info;
/** @brief Zero @p v and set the request it describes. */
-void vsm_reset(struct vsm_info *v, unsigned area, unsigned space);
+void vsm_reset(vsm_info *v, unsigned area, unsigned space);
/**
* @brief Check the work-area header and locate the data area.
@@ -95,11 +101,9 @@ bool vsm_work_data(const unsigned char *work, unsigned wlen,
* @return false on a stream that does not match the documented layout, with
* v::err set and the offset in it.
*/
-bool vsm_parse_alloc(struct vsm_info *v, const unsigned char *data,
- unsigned len);
+bool vsm_parse_alloc(vsm_info *v, const unsigned char *data, unsigned len);
/** @brief Parse an unallocated-storage data area (CSA or PVT only). */
-bool vsm_parse_unalloc(struct vsm_info *v, const unsigned char *data,
- unsigned len);
+bool vsm_parse_unalloc(vsm_info *v, const unsigned char *data, unsigned len);
#endif