Skip to content

Commit

Permalink
sun4m: fix slavio sysctrl and led register sizes
Browse files Browse the repository at this point in the history
These were being incorrectly declared as MISC_SIZE (1 byte) rather than
4 bytes and 2 bytes respectively. As a result accesses clamped to the
real register size would unexpectedly fail.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
CC: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1427987370-15897-1-git-send-email-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
mcayland authored and bonzini committed Apr 27, 2015
1 parent 339240b commit 0e1cd65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hw/misc/slavio_misc.c
Expand Up @@ -68,6 +68,7 @@ typedef struct APCState {
} APCState;

#define MISC_SIZE 1
#define LED_SIZE 2
#define SYSCTRL_SIZE 4

#define AUX1_TC 0x02
Expand Down Expand Up @@ -452,13 +453,13 @@ static int slavio_misc_init1(SysBusDevice *sbd)
/* 16 bit registers */
/* ss600mp diag LEDs */
memory_region_init_io(&s->led_iomem, OBJECT(s), &slavio_led_mem_ops, s,
"leds", MISC_SIZE);
"leds", LED_SIZE);
sysbus_init_mmio(sbd, &s->led_iomem);

/* 32 bit registers */
/* System control */
memory_region_init_io(&s->sysctrl_iomem, OBJECT(s), &slavio_sysctrl_mem_ops, s,
"system-control", MISC_SIZE);
"system-control", SYSCTRL_SIZE);
sysbus_init_mmio(sbd, &s->sysctrl_iomem);

/* AUX 1 (Misc System Functions) */
Expand Down

0 comments on commit 0e1cd65

Please sign in to comment.