Skip to content

Commit

Permalink
pcb.h: annotate sizes [#95]
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Jul 27, 2019
1 parent 7928f02 commit c83b1af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hdr/pcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand All @@ -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
Expand All @@ -105,13 +108,15 @@ 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 {
UWORD pc_ss;
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*/
Expand Down
1 change: 1 addition & 0 deletions hdr/portab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c83b1af

Please sign in to comment.