aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/macio/cuda.c
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2018-02-09 18:51:32 +0000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-02-10 18:23:11 +1100
commitae14d81757945a8298a34e00e82abe68d90644e7 (patch)
treedca8e0b948209133c0b086adcc9fad8c4ec177f8 /hw/misc/macio/cuda.c
parent8d0ef282ed286076355c02610b5b20e379421a43 (diff)
cuda: don't allow writes to port output pins
Use the direction registers as a mask to ensure that only input pins are updated upon write. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/misc/macio/cuda.c')
-rw-r--r--hw/misc/macio/cuda.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 6631017ca2..eaa8924f49 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -359,11 +359,11 @@ static void cuda_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
switch(addr) {
case CUDA_REG_B:
- s->b = val;
+ s->b = (s->b & ~s->dirb) | (val & s->dirb);
cuda_update(s);
break;
case CUDA_REG_A:
- s->a = val;
+ s->a = (s->a & ~s->dira) | (val & s->dira);
break;
case CUDA_REG_DIRB:
s->dirb = val;