From 9fbacc2a325fdb96daf6c9e1afa6f0ce5a5853c4 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Sat, 22 Dec 2018 17:24:29 +0100 Subject: [PATCH] sim: minor updates --- sim/pdp10-core.h | 20 +++++++++++++++----- sim/pdp10-ea.h | 13 ++++++++++++- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/sim/pdp10-core.h b/sim/pdp10-core.h index 77b8140..767dd79 100644 --- a/sim/pdp10-core.h +++ b/sim/pdp10-core.h @@ -90,13 +90,23 @@ static inline unsigned int BIT36(pdp10_uint36_t X, unsigned int BIT) return BITS36(X, BIT, BIT); } -typedef uint32_t pdp10_vaddr_t; /* 30 bits: section number, section offset */ -typedef uint32_t pdp10_pc_t; /* 31 bits: global flag, vaddr */ +typedef uint32_t pdp10_vaddr_t; /* 30 bits: 12-bit section number, 18-bit section offset */ struct pdp10_cpu { - pdp10_pc_t PC; - pdp10_uint36_t AC[017]; - unsigned int flags; /* 13 bits */ + pdp10_vaddr_t PC; + pdp10_uint36_t AC[017]; /* copy of ACS[CAB] */ + pdp10_uint36_t ACS[8][017]; + unsigned int flags:13; + unsigned int CAB:3; /* Current AC Block */ + /* + * Previous Context + */ + unsigned int PCS:12; /* Previous Context Section */ + unsigned int PCU:1; /* Previous Context User */ + unsigned int PAB:3; /* Previous AC Block */ + /* + * Memory + */ struct pdp10_vmem vmem; }; diff --git a/sim/pdp10-ea.h b/sim/pdp10-ea.h index 2212df9..e58be19 100644 --- a/sim/pdp10-ea.h +++ b/sim/pdp10-ea.h @@ -24,8 +24,19 @@ /* This performs Effective Address Calculation, but not Instruction Fetch * or looping on XCT instructions; the caller is assumed to handle that. - * Returns (uint64_t)-1 on failure (page fault), a pdp10_uint36_t word on success. + * Returns (uint64_t)-1 on failure (page fault), otherwise a pdp10_vaddr_t + * (30 bits) and a 1-bit local(0)/global(1) flag in the MSB (2^30). */ uint64_t pdp10_ea(struct pdp10_cpu *cpu, uint64_t MB); +static inline int pdp10_ea_is_page_fault(uint64_t ea) +{ + return ea == (uint64_t)-1; +} + +static inline int pdp10_ea_is_global(uint64_t ea) +{ + return ea & (1UL << 30); +} + #endif /* PDP10_EA_H */