open-simh / simh

The Open SIMH simulators package
https://opensimh.org/
Other
485 stars 93 forks source link

pdp11_dh.c doesn't correctly handle byte-wide access to its registers #201

Closed bjorend closed 1 year ago

bjorend commented 1 year ago

;attach tu0 /Users/bkd/projects/2023/bhtapes/bh1/img/bh1_read5_rev_25ips_fixed.tap ;attach tu0 /Users/bkd/projects/2023/bhtapes/bh2/ex/bh2_bh3_unified.tap ;attach tu0 /Users/bkd/projects/2023/bhtapes/bh2/img/bh2_read2.tap ;attach tu0 /Users/bkd/projects/2023/bhtapes/bh3/img/bh3_read2.tap echo echo At the sim> prompt, type 'boot rp0' echo Then into the empty space type 'go' echo echo And then before timesharing starts, type ^E echo and issue the following commands to echo set the clock (assuming you booted echo /unix): echo ! ./time_deposit_cmds.sh echo

<!--- The simulator configuration file, and any other relatively small files can be attached to this issue now or after it is created -->
- #### the expected behavior and the actual behavior
The behavior I see is bizarre results when trying to use DH-11 serial devices. Among these results are:
- processes that write to DH-11 devices hang (as if the kernel is waiting for an interrupt on their behalf that never arrives)
- output, when it happens, can be directed to the wrong device (as seen in the debug logs)
- inability to log in when telneting into a DH-11 port that has login running on it (I never see the login: prompt)

When I make the following change:

bkd@titus simh % git diff PDP11/pdp11_dh.c | dos2unix diff --git a/PDP11/pdp11_dh.c b/PDP11/pdp11_dh.c index 030255cc..a0866d14 100644 --- a/PDP11/pdp11_dh.c +++ b/PDP11/pdp11_dh.c @@ -191,6 +191,17 @@ dh_wr(int32 data, int32 PA, int32 access) switch (PA & 017) { case 000: sim_debug (DBG_IO, &dh_dev, "WRITE DHSCR %06o\n", data);

A couple of other points, if I may:

pkoning2 commented 1 year ago

Here is fine. Thanks Bjoren, that looks like a good fix. The DH-11 manual says clearly this register is byte writable, so this seems like an omission in the original code. It describes one of the others as only word-writable, and it doesn't say about most of the rest.

pkoning2 commented 1 year ago

On the 300 baud thing, yes, another issue would be good. Please show what the code is trying to do and what the resulting registers are.

pkoning2 commented 1 year ago

Judging from a quick test and comparing against a DHU line, it seems that the emulated speed of the DH line is 1200 baud, give or take -- and it doesn't change when I change the speed in the device CSR.

pkoning2 commented 1 year ago

Fixed by PR 204.