Simulator: fix word write on unaligned address
When writing a word to an unaligned address, the least significant bit is simply ignored, causing the real write address to be automatically aligned. Signed-off-by: Radu Rendec <radu.rendec@cloudbit.ro>
This commit is contained in:
parent
2aed1b90a4
commit
428f274f43
4
sim.c
4
sim.c
|
@ -47,8 +47,8 @@ struct sim_device {
|
|||
((dev)->memory[(offset + 1) & 0xffff] << 8))
|
||||
#define MEM_SETW(dev, offset, value) \
|
||||
do { \
|
||||
(dev)->memory[offset] = (value) & 0xff; \
|
||||
(dev)->memory[(offset + 1) & 0xffff] = (value) >> 8; \
|
||||
(dev)->memory[offset & ~1] = (value) & 0xff; \
|
||||
(dev)->memory[offset | 1] = (value) >> 8; \
|
||||
} while (0);
|
||||
|
||||
static int fetch_operand(struct sim_device *dev,
|
||||
|
|
Loading…
Reference in New Issue