-CFLAGS=-g -O3 -std=c99 -U__STRICT_ANSI__ -IdecNumber -Idps8 -D_GNU_SOURCE -DUSE_READER_THREAD -DUSE_INT64 -Wno-unused-result
+CFLAGS=-g -std=c99 -U__STRICT_ANSI__ -IdecNumber -Idps8 -D_GNU_SOURCE -DUSE_READER_THREAD -DUSE_INT64 -DTESTING -Wno-unused-result
+#-O3
multics_sim: \
multics_sim.o \
void cpu_reset_unit_idx (UNUSED uint cpun, bool clear_mem)
{
uint save = set_cpu_idx (cpun);
- if (clear_mem)
- {
-#ifdef SCUMEM
- for (int cpu_port_num = 0; cpu_port_num < N_CPU_PORTS; cpu_port_num ++)
- {
- if (get_scu_in_use (current_running_cpu_idx, cpu_port_num))
- {
- uint sci_unit_idx = get_scu_idx (current_running_cpu_idx, cpu_port_num);
- // Clear lock bits
- for (uint i = 0; i < SCU_MEM_SIZE; i ++)
- {
- //scu [sci_unit_idx].M[i] = MEM_UNINITIALIZED;
- scu [sci_unit_idx].M[i] &= (MASK36 | MEM_UNINITIALIZED);
- }
- }
- }
-#else
- for (uint i = 0; i < MEMSIZE; i ++)
- {
- //M [i] = MEM_UNINITIALIZED;
- M[i] &= (MASK36 | MEM_UNINITIALIZED);
- }
-#endif
- }
+// if (clear_mem)
+// {
+//#ifdef SCUMEM
+// for (int cpu_port_num = 0; cpu_port_num < N_CPU_PORTS; cpu_port_num ++)
+// {
+// if (get_scu_in_use (current_running_cpu_idx, cpu_port_num))
+// {
+// uint sci_unit_idx = get_scu_idx (current_running_cpu_idx, cpu_port_num);
+// // Clear lock bits
+// for (uint i = 0; i < SCU_MEM_SIZE; i ++)
+// {
+// //scu [sci_unit_idx].M[i] = MEM_UNINITIALIZED;
+// scu [sci_unit_idx].M[i] &= (MASK36 | MEM_UNINITIALIZED);
+// }
+// }
+// }
+//#else
+// for (uint i = 0; i < MEMSIZE; i ++)
+// {
+// //M [i] = MEM_UNINITIALIZED;
+// M[i] &= (MASK36 | MEM_UNINITIALIZED);
+// }
+//#endif
+// }
cpu.rA = 0;
cpu.rQ = 0;
core_read (addr, & w, __func__);
*vptr = w;
#else
- *vptr = M[addr] & DMASK;
+ *vptr = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
#endif
}
return SCPE_OK;
word36 w = val & DMASK;
core_write (addr, w, __func__);
#else
- M[addr] = val & DMASK;
+ M[(addr >> 18) & 077777][addr & 0777777] = val & DMASK;
#endif
return SCPE_OK;
}
}
#else
#ifndef LOCKLESS
- if (M[addr] & MEM_UNINITIALIZED)
+ if (M[(addr >> 18) & 077777][addr & 0777777] & MEM_UNINITIALIZED)
{
sim_debug (DBG_WARN, & cpu_dev,
"Unitialized memory accessed at address %08o; "
{
sim_msg ("WATCH [%"PRId64"] %05o:%06o read %08o %012"PRIo64" "
"(%s)\n",
- cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr, M [addr],
+ cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr, M[(addr >> 18) & 077777][addr & 0777777],
ctx);
traceInstruction (0);
}
*data = v & DMASK;
#else
LOCK_MEM_RD;
- *data = M[addr] & DMASK;
+ *data = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
UNLOCK_MEM;
#endif
STORE_REL_CORE_WORD(addr, data);
#else
LOCK_MEM_WR;
- M[addr] = data & DMASK;
+ M[(addr >> 18) & 077777][addr & 0777777] = data & DMASK;
UNLOCK_MEM;
#endif
#ifndef SPEED
{
sim_msg ("WATCH [%"PRId64"] %05o:%06o write %08o %012"PRIo64" "
"(%s)\n", cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr,
- M [addr], ctx);
+ M[(addr >> 18) & 077777][addr & 0777777], ctx);
traceInstruction (0);
}
#endif
sim_warn ("core_unlock_all: locked %08o %c %05o:%06o\n",
cpu.locked_addr, current_running_cpu_idx + 'A',
cpu.PPR.PSR, cpu.PPR.IC);
- STORE_REL_CORE_WORD(cpu.locked_addr, M[cpu.locked_addr]);
+ STORE_REL_CORE_WORD(cpu.locked_addr, M[(cpu.locked_addr >> 18) & 077777][cpu.locked_addr & 0777777]);
cpu.locked_addr = 0;
}
return 0;
nem_check (addr, "core_read nem");
#endif
LOCK_MEM_WR;
- M[addr] = (M[addr] & ~cpu.zone) | (data & cpu.zone);
+ M[(addr >> 18) & 077777][addr & 0777777] = (M[(addr >> 18) & 077777][addr & 0777777] & ~cpu.zone) | (data & cpu.zone);
UNLOCK_MEM;
#endif
cpu.useZone = false; // Safety
{
sim_msg ("WATCH [%"PRId64"] %05o:%06o writez %08o %012"PRIo64" "
"(%s)\n", cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr,
- M [addr], ctx);
+ M[(addr >> 18) & 077777][addr & 0777777], ctx);
traceInstruction (0);
}
#endif
addr+1, * odd, ctx);
#else
#ifndef LOCKLESS
- if (M[addr] & MEM_UNINITIALIZED)
+ if (M[(addr >> 18) & 077777][addr & 0777777] & MEM_UNINITIALIZED)
{
sim_debug (DBG_WARN, & cpu_dev,
"Unitialized memory accessed at address %08o; "
{
sim_msg ("WATCH [%"PRId64"] %05o:%06o read2 %08o %012"PRIo64" "
"(%s)\n", cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr,
- M [addr], ctx);
+ M[(addr >> 18) & 077777][addr & 0777777], ctx);
traceInstruction (0);
}
#endif
addr++;
#else
LOCK_MEM_RD;
- *even = M[addr++] & DMASK;
+ *even = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
+ addr++;
UNLOCK_MEM;
#endif
sim_debug (DBG_CORE, & cpu_dev,
// if the even address is OK, the odd will be
//nem_check (addr, "core_read2 nem");
#ifndef LOCKLESS
- if (M[addr] & MEM_UNINITIALIZED)
+ if (M[(addr >> 18) & 077777][addr & 0777777] & MEM_UNINITIALIZED)
{
sim_debug (DBG_WARN, & cpu_dev,
"Unitialized memory accessed at address %08o; "
{
sim_msg ("WATCH [%"PRId64"] %05o:%06o read2 %08o %012"PRIo64" "
"(%s)\n", cpu.cycleCnt, cpu.PPR.PSR, cpu.PPR.IC, addr,
- M [addr], ctx);
+ M[(addr >> 18) & 077777][addr & 0777777], ctx);
traceInstruction (0);
}
#endif
*odd = v & DMASK;
#else
LOCK_MEM_RD;
- *odd = M[addr] & DMASK;
+ *odd = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
UNLOCK_MEM;
#endif
sim_debug (DBG_CORE, & cpu_dev,
addr++;
#else
LOCK_MEM_WR;
- M[addr++] = even & DMASK;
+ M[(addr >> 18) & 077777][addr & 0777777] = even & DMASK;
+ addr++;
UNLOCK_MEM;
#endif
sim_debug (DBG_CORE, & cpu_dev,
STORE_REL_CORE_WORD(addr, odd);
#else
LOCK_MEM_WR;
- M[addr] = odd & DMASK;
+ M[(addr >> 18) & 077777][addr & 0777777] = odd & DMASK;
UNLOCK_MEM;
#endif
#endif
UNLOCK_MEM;
#else
LOCK_MEM_RD;
- *data = M[addr] & DMASK;
+ *data = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
UNLOCK_MEM;
#endif
#ifdef TR_WORK_MEM
UNLOCK_MEM;
#else
LOCK_MEM_WR;
- M[addr] = data & DMASK;
+ M[(addr >> 18) & 077777][addr & 0777777] = data & DMASK;
UNLOCK_MEM;
#endif
#ifdef TR_WORK_MEM
UNLOCK_MEM;
#else
LOCK_MEM_WR;
- M[addr] = (M[addr] & ~cpu.zone) | (data & cpu.zone);
+ M[(addr >> 18) & 077777][addr & 0777777] = (M[(addr >> 18) & 077777][addr & 0777777] & ~cpu.zone) | (data & cpu.zone);
cpu.useZone = false; // Safety
UNLOCK_MEM;
#endif
UNLOCK_MEM;
#else
LOCK_MEM_WR;
- *even = M[addr++] & DMASK;
- *odd = M[addr] & DMASK;
+ *even = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
+ addr++;
+ *odd = M[(addr >> 18) & 077777][addr & 0777777] & DMASK;
UNLOCK_MEM;
#endif
#ifdef TR_WORK_MEM
UNLOCK_MEM;
#else
LOCK_MEM_WR;
- M[addr++] = even;
- M[addr] = odd;
+ M[(addr >> 18) & 077777][addr & 0777777] = even;
+ addr++;
+ M[(addr >> 18) & 077777][addr & 0777777] = odd;
UNLOCK_MEM;
#endif
PNL (trackport (addr - 1, even);)
do \
{ \
unsigned int i = DEADLOCK_DETECT; \
- while ( atomic_testandset_64((volatile u_long *)&M[addr], MEM_LOCKED_BIT) == 1 && i > 0) \
+ while ( atomic_testandset_64((volatile u_long *)&M[(addr >> 18) & 077777][addr & 0777777], MEM_LOCKED_BIT) == 1 && i > 0) \
{ \
i--; \
if ((i & 0xff) == 0) { \
#define LOAD_ACQ_CORE_WORD(res, addr) \
do \
{ \
- res = atomic_load_acq_64((volatile u_long *)&M[addr]); \
+ res = atomic_load_acq_64((volatile u_long *)&M[(addr >> 18) & 077777][addr & 0777777]); \
} \
while (0)
#define STORE_REL_CORE_WORD(addr, data) \
do \
{ \
- atomic_store_rel_64((volatile u_long *)&M[addr], data & DMASK); \
+ atomic_store_rel_64((volatile u_long *)&M[(addr >> 18) & 077777][addr & 0777777], data & DMASK); \
} \
while (0)
do \
{ \
unsigned int i = DEADLOCK_DETECT; \
- while ((__sync_fetch_and_or((volatile u_long *)&M[addr], MEM_LOCKED) & MEM_LOCKED) \
+ while ((__sync_fetch_and_or((volatile u_long *)&M[(addr >> 18) & 077777][addr & 0777777], MEM_LOCKED) & MEM_LOCKED) \
&& i > 0) \
{ \
i--; \
#define LOAD_ACQ_CORE_WORD(res, addr) \
do \
{ \
- res = M[addr]; \
+ res = M[(addr >> 18) & 077777][addr & 0777777]; \
MEM_BARRIER(); \
} \
while (0)
do \
{ \
MEM_BARRIER(); \
- M[addr] = data & DMASK; \
+ M[(addr >> 18) & 077777][addr & 0777777] = data & DMASK; \
} \
while (0)
cpu.cu.IRODD = cpu.cu.IWB;
}
}
+ //printf("PSR %05o IC %06o IWB %012llo\n", cpu.PPR.PSR, cpu.PPR.IC, cpu.cu.IWB);
}
#ifdef TESTING
force:;
char * compname;
word18 compoffset;
- char * where = lookup_address (cpu.PPR.PSR, cpu.PPR.IC, & compname,
- & compoffset);
+ char *where = "somewhere";
+ // char * where = lookup_address (cpu.PPR.PSR, cpu.PPR.IC, & compname,
+ // & compoffset);
bool isBAR = TST_I_NBAR ? false : true;
if (where)
{
cpu.PPR.PSR, cpu.PPR.IC, where);
}
}
- list_source (compname, compoffset, flag);
+ // list_source (compname, compoffset, flag);
}
if (get_addr_mode () == ABSOLUTE_mode)
{
#endif
#endif // PANEL
+ //printf("opcode10 %03o\n", opcode10);
switch (opcode10)
{
#endif
#endif
-#ifdef SPEED
-#define if_sim_debug(dbits, dptr) if ((0))
-
-#else
- // ((dptr != & cpu_dev) || current_running_cpu_idx == 1) &&
-
-#define if_sim_debug(dbits, dptr) \
- if ( \
- sim_deb && \
- isISOLTS && \
- (((dptr)->dctrl & (dbits)) || (dbits) == 0) && \
- ((dptr != & cpu_dev) || ((1 << current_running_cpu_idx) & dbgCPUMask)) && \
- ((dptr != & cpu_dev) || (((dptr)->dctrl & (DBG_INTR | DBG_FAULT))) || (! sim_deb_segno_on) || sim_deb_segno[cpu.PPR.PSR & (DEBUG_SEGNO_LIMIT - 1)]) && \
- ((dptr != & cpu_dev) || sim_deb_ringno == NO_SUCH_RINGNO || sim_deb_ringno == cpu . PPR. PRR) && \
- ((dptr != & cpu_dev) || (! sim_deb_bar) || (! TST_I_NBAR)) && \
- cpu.cycleCnt >= sim_deb_start && \
- (sim_deb_stop == 0 || cpu.cycleCnt < sim_deb_stop) && \
- (sim_deb_mme_cntdwn == 0) && \
- ((dptr != & cpu_dev) | (((dbits) & DBG_TRACE) ? (sim_deb_skip_cnt ++ >= sim_deb_skip_limit) : (sim_deb_skip_cnt >= sim_deb_skip_limit))) \
- )
-#endif
-
-#if !defined(THREADZ) && !defined(LOCKLESS)
-#define dps8_sim_debug _sim_debug
-#endif
-
-#undef sim_debug
-#if defined(THREADZ) || defined(LOCKLESS)
-#define sim_debug(dbits, dptr, ...) \
- if_sim_debug((dbits), dptr) \
- dps8_sim_debug ((dbits), dptr, DBG_CTR, __VA_ARGS__); \
- else \
- (void) 0
-#else
-#define sim_debug(dbits, dptr, ...) \
- if_sim_debug((dbits), dptr) \
- dps8_sim_debug ((dbits), dptr, __VA_ARGS__); \
- else \
- (void) 0
-#endif
+#define if_sim_debug(dbits, dptr)
+//#ifdef SPEED
+//#define if_sim_debug(dbits, dptr) if ((0))
+//
+//#else
+// // ((dptr != & cpu_dev) || current_running_cpu_idx == 1) &&
+//
+//#define if_sim_debug(dbits, dptr) \
+// if ( \
+// sim_deb && \
+// isISOLTS && \
+// (((dptr)->dctrl & (dbits)) || (dbits) == 0) && \
+// ((dptr != & cpu_dev) || ((1 << current_running_cpu_idx) & dbgCPUMask)) && \
+// ((dptr != & cpu_dev) || (((dptr)->dctrl & (DBG_INTR | DBG_FAULT))) || (! sim_deb_segno_on) || sim_deb_segno[cpu.PPR.PSR & (DEBUG_SEGNO_LIMIT - 1)]) && \
+// ((dptr != & cpu_dev) || sim_deb_ringno == NO_SUCH_RINGNO || sim_deb_ringno == cpu . PPR. PRR) && \
+// ((dptr != & cpu_dev) || (! sim_deb_bar) || (! TST_I_NBAR)) && \
+// cpu.cycleCnt >= sim_deb_start && \
+// (sim_deb_stop == 0 || cpu.cycleCnt < sim_deb_stop) && \
+// (sim_deb_mme_cntdwn == 0) && \
+// ((dptr != & cpu_dev) | (((dbits) & DBG_TRACE) ? (sim_deb_skip_cnt ++ >= sim_deb_skip_limit) : (sim_deb_skip_cnt >= sim_deb_skip_limit))) \
+// )
+//#endif
+//
+//#if !defined(THREADZ) && !defined(LOCKLESS)
+//#define dps8_sim_debug _sim_debug
+//#endif
+//
+//#undef sim_debug
+//#if defined(THREADZ) || defined(LOCKLESS)
+//#define sim_debug(dbits, dptr, ...) \
+// if_sim_debug((dbits), dptr) \
+// dps8_sim_debug ((dbits), dptr, DBG_CTR, __VA_ARGS__); \
+// else \
+// (void) 0
+//#else
+//#define sim_debug(dbits, dptr, ...) \
+// if_sim_debug((dbits), dptr) \
+// dps8_sim_debug ((dbits), dptr, __VA_ARGS__); \
+// else \
+// (void) 0
+//#endif
/* scp Debug flags */
+#include <stdarg.h>
+#include <stdio.h>
#include "dps8_sys.h"
FILE *sim_log;
#ifndef SCUMEM
-/*vol*/ word36 * M;
+/*vol*/ word36 *M[0100000];
#endif
+
+uint64 sim_deb_mme_cntdwn = 0;
extern FILE *sim_log;
#ifndef SCUMEM
-extern /*vol*/ word36 * M;
+extern /*vol*/ word36 *M[0100000];
#endif
+extern uint64 sim_deb_mme_cntdwn;
+
#endif
+++ /dev/null
-dps8_addrmods.c: In function ‘do_caf’:
-dps8_addrmods.c:561:9: warning: implicit declaration of function ‘ReadIndirect’ [-Wimplicit-function-declaration]
- ReadIndirect ();
- ^~~~~~~~~~~~
-dps8_addrmods.c:850:17: warning: implicit declaration of function ‘Read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
- Read (indaddr, & indword, APU_DATA_READ);
- ^~~~
- fread
-dps8_addrmods.c:1019:21: warning: implicit declaration of function ‘Write’; did you mean ‘fwrite’? [-Wimplicit-function-declaration]
- Write (indaddr, indword, APU_DATA_STORE);
- ^~~~~
- fwrite
-dps8_cpu.c: In function ‘cpu_show_config’:
-dps8_cpu.c:133:17: error: ‘scu’ undeclared (first use in this function)
- scu [0].steady_clock);
- ^~~
-dps8_cpu.c:133:17: note: each undeclared identifier is reported only once for each function it appears in
-dps8_cpu.c: In function ‘cpu_set_config’:
-dps8_cpu.c:419:11: error: ‘scu’ undeclared (first use in this function)
- scu [0].steady_clock = (uint) v;
- ^~~
-dps8_cpu.c: In function ‘cpu_show_stall’:
-dps8_cpu.c:517:40: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long long int’ [-Wformat=]
- sim_printf ("%2d %05o:%06o %6u\n", i, stall_points[i].segno, stall_points[i].offset, stall_points[i].time);
- ~~^ ~~~~~~~~~~~~~~~~~~~~
- %6llu
-dps8_cpu.c: In function ‘cpu_reset_unit_idx’:
-dps8_cpu.c:647:13: error: ‘M’ undeclared (first use in this function)
- M[i] &= (MASK36 | MEM_UNINITIALIZED);
- ^
-dps8_cpu.c: At top level:
-dps8_cpu.c:746:8: error: unknown type name ‘uv_loop_t’
- static uv_loop_t * ev_poll_loop;
- ^~~~~~~~~
-dps8_cpu.c:747:8: error: unknown type name ‘uv_timer_t’
- static uv_timer_t ev_poll_handle;
- ^~~~~~~~~~
-dps8_cpu.c: In function ‘setup_scbank_map’:
-dps8_cpu.c:969:15: error: ‘cables’ undeclared (first use in this function); did you mean ‘mblen’?
- if (! cables->cpu_to_scu[current_running_cpu_idx][port_num].in_use)
- ^~~~~~
- mblen
-dps8_cpu.c: At top level:
-dps8_cpu.c:1155:25: error: unknown type name ‘uv_timer_t’; did you mean ‘__timer_t’?
- static void ev_poll_cb (uv_timer_t * UNUSED handle)
- ^~~~~~~~~~
- __timer_t
-dps8_cpu.c: In function ‘cpu_init’:
-dps8_cpu.c:1228:5: error: ‘M’ undeclared (first use in this function)
- M = system_state->M;
- ^
-dps8_cpu.c:1228:9: error: ‘system_state’ undeclared (first use in this function); did you mean ‘setstate’?
- M = system_state->M;
- ^~~~~~~~~~~~
- setstate
-dps8_cpu.c:1245:20: warning: implicit declaration of function ‘uv_default_loop’; did you mean ‘set_default_cmd’? [-Wimplicit-function-declaration]
- ev_poll_loop = uv_default_loop ();
- ^~~~~~~~~~~~~~~
- set_default_cmd
-dps8_cpu.c:1245:18: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
- ev_poll_loop = uv_default_loop ();
- ^
-dps8_cpu.c:1246:5: warning: implicit declaration of function ‘uv_timer_init’ [-Wimplicit-function-declaration]
- uv_timer_init (ev_poll_loop, & ev_poll_handle);
- ^~~~~~~~~~~~~
-dps8_cpu.c:1248:5: warning: implicit declaration of function ‘uv_timer_start’; did you mean ‘futimesat’? [-Wimplicit-function-declaration]
- uv_timer_start (& ev_poll_handle, ev_poll_cb, sys_opts.sys_poll_interval, sys_opts.sys_poll_interval);
- ^~~~~~~~~~~~~~
- futimesat
-dps8_cpu.c:1248:39: error: ‘ev_poll_cb’ undeclared (first use in this function); did you mean ‘ev_poll_loop’?
- uv_timer_start (& ev_poll_handle, ev_poll_cb, sys_opts.sys_poll_interval, sys_opts.sys_poll_interval);
- ^~~~~~~~~~
- ev_poll_loop
-dps8_cpu.c:1248:51: error: ‘sys_opts’ undeclared (first use in this function); did you mean ‘sim_puts’?
- uv_timer_start (& ev_poll_handle, ev_poll_cb, sys_opts.sys_poll_interval, sys_opts.sys_poll_interval);
- ^~~~~~~~
- sim_puts
-dps8_cpu.c: In function ‘cpu_ex’:
-dps8_cpu.c:1309:17: error: ‘M’ undeclared (first use in this function)
- *vptr = M[addr] & DMASK;
- ^
-dps8_cpu.c: In function ‘cpu_dep’:
-dps8_cpu.c:1325:5: error: ‘M’ undeclared (first use in this function)
- M[addr] = val & DMASK;
- ^
-dps8_cpu.c: In function ‘get_highest_intr’:
-dps8_cpu.c:1418:18: warning: implicit declaration of function ‘scu_get_highest_intr’; did you mean ‘get_highest_intr’? [-Wimplicit-function-declaration]
- fp = scu_get_highest_intr (scu_unit_idx); // CALLED WITH SCU LOCK
- ^~~~~~~~~~~~~~~~~~~~
- get_highest_intr
-dps8_cpu.c: In function ‘simh_hooks’:
-dps8_cpu.c:1443:9: error: ‘breakEnable’ undeclared (first use in this function)
- if (breakEnable && stop_cpu)
- ^~~~~~~~~~~
-dps8_cpu.c: In function ‘sim_instr’:
-dps8_cpu.c:1915:39: error: ‘sys_opts’ undeclared (first use in this function); did you mean ‘sim_puts’?
- if (fast_queue_subsample ++ > sys_opts.sys_poll_check_rate) // ~ 1KHz
- ^~~~~~~~
- sim_puts
-dps8_cpu.c:1923:13: warning: implicit declaration of function ‘uv_run’ [-Wimplicit-function-declaration]
- uv_run (ev_poll_loop, UV_RUN_NOWAIT);
- ^~~~~~
-dps8_cpu.c:1923:35: error: ‘UV_RUN_NOWAIT’ undeclared (first use in this function)
- uv_run (ev_poll_loop, UV_RUN_NOWAIT);
- ^~~~~~~~~~~~~
-dps8_cpu.c:1972:28: warning: implicit declaration of function ‘check_attn_key’; did you mean ‘check_events’? [-Wimplicit-function-declaration]
- int con_unit_idx = check_attn_key ();
- ^~~~~~~~~~~~~~
- check_events
-dps8_cpu.c:1974:11: warning: implicit declaration of function ‘console_attn_idx’ [-Wimplicit-function-declaration]
- console_attn_idx (con_unit_idx);
- ^~~~~~~~~~~~~~~~
-dps8_cpu.c:2270:20: error: ‘luf_flag’ undeclared (first use in this function); did you mean ‘opc_flag’?
- if (! (luf_flag && tmp_priv_mode))
- ^~~~~~~~
- opc_flag
-dps8_cpu.c: In function ‘read_operand’:
-dps8_cpu.c:2980:13: warning: implicit declaration of function ‘Read’; did you mean ‘read’? [-Wimplicit-function-declaration]
- Read (addr, & cpu.CY, cyctyp);
- ^~~~
- read
-dps8_cpu.c:2985:13: warning: implicit declaration of function ‘Read2’; did you mean ‘read’? [-Wimplicit-function-declaration]
- Read2 (addr, cpu.Ypair, cyctyp);
- ^~~~~
- read
-dps8_cpu.c:2990:13: warning: implicit declaration of function ‘Read8’; did you mean ‘read’? [-Wimplicit-function-declaration]
- Read8 (addr, cpu.Yblock8, cpu.currentInstruction.b29);
- ^~~~~
- read
-dps8_cpu.c:2995:13: warning: implicit declaration of function ‘Read16’; did you mean ‘read’? [-Wimplicit-function-declaration]
- Read16 (addr, cpu.Yblock16);
- ^~~~~~
- read
-dps8_cpu.c: In function ‘write_operand’:
-dps8_cpu.c:3019:13: warning: implicit declaration of function ‘Write’; did you mean ‘write’? [-Wimplicit-function-declaration]
- Write (addr, cpu.CY, OPERAND_STORE);
- ^~~~~
- write
-dps8_cpu.c:3024:13: warning: implicit declaration of function ‘Write2’; did you mean ‘write’? [-Wimplicit-function-declaration]
- Write2 (addr + 0, cpu.Ypair, OPERAND_STORE);
- ^~~~~~
- write
-dps8_cpu.c:3029:13: warning: implicit declaration of function ‘Write8’; did you mean ‘write’? [-Wimplicit-function-declaration]
- Write8 (addr, cpu.Yblock8, cpu.currentInstruction.b29);
- ^~~~~~
- write
-dps8_cpu.c:3034:13: warning: implicit declaration of function ‘Write16’; did you mean ‘write’? [-Wimplicit-function-declaration]
- Write16 (addr, cpu.Yblock16);
- ^~~~~~~
- write
-dps8_cpu.c:3041:13: warning: implicit declaration of function ‘Write32’; did you mean ‘write’? [-Wimplicit-function-declaration]
- Write32 (addr, cpu.Yblock32);
- ^~~~~~~
- write
-dps8_cpu.c: In function ‘core_read’:
-dps8_cpu.c:3169:9: error: ‘M’ undeclared (first use in this function)
- if (M[addr] & MEM_UNINITIALIZED)
- ^
-dps8_cpu.c: In function ‘core_write’:
-dps8_cpu.c:3293:5: error: ‘M’ undeclared (first use in this function)
- M[addr] = data & DMASK;
- ^
-dps8_cpu.c: In function ‘core_write_zone’:
-dps8_cpu.c:3416:5: error: ‘M’ undeclared (first use in this function)
- M[addr] = (M[addr] & ~cpu.zone) | (data & cpu.zone);
- ^
-dps8_cpu.c: In function ‘core_read2’:
-dps8_cpu.c:3518:9: error: ‘M’ undeclared (first use in this function)
- if (M[addr] & MEM_UNINITIALIZED)
- ^
-dps8_cpu.c: In function ‘core_write2’:
-dps8_cpu.c:3672:5: error: ‘M’ undeclared (first use in this function)
- M[addr++] = even & DMASK;
- ^
-dps8_cpu.c: In function ‘get_serial_number’:
-dps8_cpu.c:1089:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
- fgets (buffer, sizeof (buffer), fp);
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-dps8_eis.c: In function ‘EISWriteCache’:
-dps8_eis.c:549:13: warning: implicit declaration of function ‘Write8’; did you mean ‘fwrite’? [-Wimplicit-function-declaration]
- Write8 (p->cachedAddr, p -> cachedParagraph, true);
- ^~~~~~
- fwrite
-dps8_eis.c: In function ‘EISReadCache’:
-dps8_eis.c:620:9: warning: implicit declaration of function ‘Read8’; did you mean ‘seed48’? [-Wimplicit-function-declaration]
- Read8 (paragraphAddress, p -> cachedParagraph, true);
- ^~~~~
- seed48
-dps8_eis.c: In function ‘EISReadPage’:
-dps8_eis.c:786:9: warning: implicit declaration of function ‘ReadPage’; did you mean ‘EISReadPage’? [-Wimplicit-function-declaration]
- ReadPage (addressN, data, true);
- ^~~~~~~~
- EISReadPage
-dps8_eis.c: In function ‘EISWritePage’:
-dps8_eis.c:848:9: warning: implicit declaration of function ‘WritePage’; did you mean ‘EISWritePage’? [-Wimplicit-function-declaration]
- WritePage (addressN, data, true);
- ^~~~~~~~~
- EISWritePage
-dps8_ins.c: In function ‘writeOperands’:
-dps8_ins.c:134:9: warning: implicit declaration of function ‘Write’; did you mean ‘fwrite’? [-Wimplicit-function-declaration]
- Write (cpu.ou.character_address, cpu.ou.character_data, OPERAND_STORE);
- ^~~~~
- fwrite
-dps8_ins.c: In function ‘read_tra_op’:
-dps8_ins.c:244:7: warning: implicit declaration of function ‘Read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
- Read (cpu.TPR.CA, &cpu.CY, OPERAND_READ);
- ^~~~
- fread
-dps8_ins.c:246:7: warning: implicit declaration of function ‘Read2’ [-Wimplicit-function-declaration]
- Read2 (cpu.TPR.CA, cpu.Ypair, OPERAND_READ);
- ^~~~~
-dps8_ins.c: In function ‘doInstruction’:
-dps8_ins.c:6669:19: warning: implicit declaration of function ‘get_scu_in_use’; did you mean ‘get_iwb_info’? [-Wimplicit-function-declaration]
- if (! get_scu_in_use (current_running_cpu_idx, cpu_port_num))
- ^~~~~~~~~~~~~~
- get_iwb_info
-dps8_ins.c:6675:31: warning: implicit declaration of function ‘get_scu_idx’; did you mean ‘set_cpu_idx’? [-Wimplicit-function-declaration]
- uint scuUnitIdx = get_scu_idx (current_running_cpu_idx, cpu_port_num);
- ^~~~~~~~~~~
- set_cpu_idx
-dps8_ins.c:6677:25: warning: implicit declaration of function ‘scu_rscr’; did you mean ‘strstr’? [-Wimplicit-function-declaration]
- t_stat rc = scu_rscr ((uint) scuUnitIdx, current_running_cpu_idx,
- ^~~~~~~~
- strstr
-dps8_ins.c:7976:25: warning: implicit declaration of function ‘scu_rmcm’ [-Wimplicit-function-declaration]
- t_stat rc = scu_rmcm ((uint) scuUnitIdx,
- ^~~~~~~~
-dps8_ins.c:8570:13: warning: implicit declaration of function ‘scu_cioc’ [-Wimplicit-function-declaration]
- scu_cioc (current_running_cpu_idx, (uint) scuUnitIdx, scu_port_num,
- ^~~~~~~~
-dps8_ins.c:8594:25: warning: implicit declaration of function ‘scu_smcm’ [-Wimplicit-function-declaration]
- t_stat rc = scu_smcm ((uint) scuUnitIdx,
- ^~~~~~~~
-dps8_ins.c:8637:25: warning: implicit declaration of function ‘scu_smic’ [-Wimplicit-function-declaration]
- t_stat rc = scu_smic ((uint) scuUnitIdx, current_running_cpu_idx,
- ^~~~~~~~
-dps8_ins.c:8668:25: warning: implicit declaration of function ‘scu_sscr’ [-Wimplicit-function-declaration]
- t_stat rc = scu_sscr ((uint) scuUnitIdx, current_running_cpu_idx,
- ^~~~~~~~
void sim_debug (uint32 dbits, DEVICE* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4);\r
#else\r
void _sim_debug (uint32 dbits, DEVICE* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4);\r
-#define sim_debug(dbits, dptr, ...) do { if (sim_deb && dptr && ((dptr)->dctrl & dbits)) _sim_debug (dbits, dptr, __VA_ARGS__);} while (0)\r
+//#define sim_debug(dbits, dptr, ...) do { if (sim_deb && dptr && ((dptr)->dctrl & dbits)) _sim_debug (dbits, dptr, __VA_ARGS__);} while (0)\r
+#define sim_debug(dbits, dptr, ...) printf(__VA_ARGS__)\r
#endif\r
#endif\r
void fprint_stopped_gen (FILE *st, t_stat v, REG *pc, DEVICE *dptr);\r
#include "definition_dcls.h"
#include "dps8/dps8.h"
#include "dps8/dps8_cpu.h"
+#include "dps8/dps8_sys.h"
#include "object_map.h"
#include "rassert.h"
}
}
+ // initialize CPU
+ cpu_reset_unit_idx(0, false);
+
+ // initialize memory
+ uint64_t *null_segment = mmap(
+ NULL,
+ 01000000 * sizeof(uint64_t),
+ PROT_NONE,
+ MAP_ANONYMOUS | MAP_PRIVATE,
+ -1,
+ (off_t)0
+ );
+ rassert(null_segment != (uint64_t *)-1);
+ for (int i = 0; i < 0100000; ++i)
+ M[i] = (word36 *)null_segment;
+
+ // search for object segment
int fd;
int path_index;
for (path_index = 0; path_index < N_PATHS; ++path_index) {
);
rassert(object_segment != (uint64_t *)-1);
+ // search for entry point in object segment
uint64_t bitcount;
{
char index_name[0x1000];
found_entry:
;
- cpu_reset_unit_idx(0, false);
- cpu.PPR.IC =
- (object_map->text_offset + definition->thing_relp) & 0777777;
+ // map in segment and start executing
+ M[0] = (word36 *)object_segment;
+ cpu.PPR.PRR = 3; // ring
+ cpu.PPR.PSR = 0; // segment
+ cpu.PPR.P = 0; // privilege
+ cpu.PPR.IC = (object_map->text_offset + definition->thing_relp) & 0777777;
printf(
- "entry %s$%s at %06o -> %012lo\n",
+ "entry %s$%s at %06o -> %012llo\n",
entry_segment,
entry_name,
cpu.PPR.IC,
- object_segment[cpu.PPR.IC]
+ M[cpu.PPR.PSR][cpu.PPR.IC]
);
+ sim_instr();
return 0;
}