From c83b1af6ecab4b3f0ffebbcb930aa41f41d75186 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Sat, 27 Jul 2019 17:24:21 +0300 Subject: [PATCH] pcb.h: annotate sizes [#95] --- hdr/pcb.h | 5 +++++ hdr/portab.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hdr/pcb.h b/hdr/pcb.h index 9391feb3..8f62e747 100644 --- a/hdr/pcb.h +++ b/hdr/pcb.h @@ -66,6 +66,7 @@ typedef union { UBYTE h; /* access mode for ah, bh, etc. */ } b; } xreg; +ANNOTATE_SIZE(xreg, 2); /* The structure assumes that: 1) An interrupt was invoked, & @@ -78,12 +79,14 @@ typedef struct _iregss { UWORD si, di, bp, ds, es; UWORD ip, cs, flags; } iregs; +ANNOTATE_SIZE(iregs, 24); /* struct used for local copy of registers */ typedef struct { xreg a, b, c, d; UWORD si, di, ds, es; } lregs; +ANNOTATE_SIZE(lregs, 16); struct int2f12regs { #ifdef I386 @@ -105,6 +108,7 @@ struct int2f12regs { UWORD ip, cs, flags; UWORD callerARG1; /* used if called from INT2F/12 */ }; +ANNOTATE_SIZE_S(int2f12regs, 32); /* Process control block for task switching */ typedef struct { @@ -112,6 +116,7 @@ typedef struct { UWORD pc_sp; iregs pc_regs; } pcb; +ANNOTATE_SIZE(pcb, 4 + sizeof(iregs)); /* Note: The following figure is not made by myself and I assume that the order of "ES" through "AX" are misinterpreted?! -- 2000/03/22 ska*/ diff --git a/hdr/portab.h b/hdr/portab.h index bacaa3a1..6412a6a2 100644 --- a/hdr/portab.h +++ b/hdr/portab.h @@ -261,6 +261,7 @@ void PurgeHook(void *ptr, UDWORD len); #define DATA(t, n, i) CTOR(t, n, i) #define DATAAIS(t, n, ...) CTORAI(static, t, n, __VA_ARGS__) #define ANNOTATE_SIZE(n, s) static_assert(sizeof(n) == s, "wrong size of " #n) +#define ANNOTATE_SIZE_S(n, s) static_assert(sizeof(struct n) == s, "wrong size of " #n) #define FAR /* linear architecture */ #define REG