From 7b01cd11f2a51e13e8c3e652a0a7c7b90d6c4f2b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 5 Mar 2013 11:38:28 -0800 Subject: [PATCH] Fix identified by Mikulas Patocka. The problem is that Map_ReadW reads 16-bit words from guest's memory and stores them in host-endian-byte-order in xq_turbo_init_block. Most entries in xq_turbo_init_block are 16-bit words (thus it is ok that they are stored in host-endian-byte-order), but there are three fields in this data structure which are referenced as byte oriented fields. (phys, hash_filter and bootpassword). These fields need to be handled in byte order to be properly interpreted. --- PDP11/pdp11_xq.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PDP11/pdp11_xq.c b/PDP11/pdp11_xq.c index f5baf920..19412b46 100644 --- a/PDP11/pdp11_xq.c +++ b/PDP11/pdp11_xq.c @@ -2289,6 +2289,11 @@ t_stat xq_wr_srqr(CTLR* xq, int32 data) } else { uint32 saved_debug = xq->dev->dctrl; + /* Correct byte ordering of non word fields for Big Endian platforms */ + sim_buf_swap_data (xq->var->init.phys, sizeof(uint16), sizeof(xq->var->init.phys)); + sim_buf_swap_data (xq->var->init.hash_filter, sizeof(uint16), sizeof(xq->var->init.hash_filter)); + sim_buf_swap_data (xq->var->init.bootpassword, sizeof(uint16), sizeof(xq->var->init.bootpassword)); + /* temporarily turn on Ethernet debugging if setup debugging is enabled */ if (xq->dev->dctrl & DBG_SET) xq->dev->dctrl |= DBG_ETH;