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.
This commit is contained in:
Mark Pizzolato 2013-03-05 11:38:28 -08:00
parent 47bb4c8a19
commit 7b01cd11f2

View file

@ -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;