From f59d86d7c078b1e2512bc68dac36415e6ba63e8f Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 10 Nov 2013 13:04:28 -0800 Subject: [PATCH] VAX: Fix for unaligned longword access to Qbus space from Matt Burke for issue #88 When the conversational boot is waiting for input it uses a BLBC instruction to read the DUART status register and test the RXR bit. This generates an unaligned longword read in Qbus I/O space (Yuk!). I realised that the code to read unaligned data in vax_mmu is broken. It attempts to read the aligned longwords that the data spans, but there was no code to convert the unaligned pa passed in to it's aligned form, thus the wrong bytes are returned and the BLBC never sees the RXR bit. --- VAX/vax_mmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/VAX/vax_mmu.c b/VAX/vax_mmu.c index c3ffcd8e..e98eacf0 100644 --- a/VAX/vax_mmu.c +++ b/VAX/vax_mmu.c @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 09-Nov-13 MB Fixed reading/writing of unaligned data 24-Oct-12 MB Added support for KA620 virtual addressing 21-Jul-08 RMS Removed inlining support 28-May-08 RMS Inlined physical memory routines @@ -202,6 +203,8 @@ if (mapen && ((uint32)(off + lnt) > VA_PAGSIZE)) { /* cross page? */ } else pa1 = (pa + 4) & PAMASK; /* not cross page */ bo = pa & 3; +pa = pa & ~3; /* convert to aligned */ +pa1 = pa1 & ~3; if (lnt >= L_LONG) { /* lw unaligned? */ sc = bo << 3; wl = ReadL (pa); /* read both lw */ @@ -268,6 +271,8 @@ if (mapen && ((uint32)(off + lnt) > VA_PAGSIZE)) { } else pa1 = (pa + 4) & PAMASK; bo = pa & 3; +pa = pa & ~3; /* convert to aligned */ +pa1 = pa1 & ~3; wl = ReadL (pa); if (lnt >= L_LONG) { sc = bo << 3;