]> git.proxmox.com Git - qemu.git/commit
hw/ds1338: Fix mishandling of register pointer
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 12 Oct 2012 10:54:38 +0000 (11:54 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 12 Oct 2012 10:54:38 +0000 (11:54 +0100)
commitba4906a9b64e165a958e12f6208ca834dc7a36dc
tree69e11bc30e8a212b1dd5f39f638431d936ecae49
parent9ab1b6053f03d58ba8e7accc8f19c882fbffb66f
hw/ds1338: Fix mishandling of register pointer

Correct several deficiencies in the handling of the register pointer:
 * it should wrap around after 0x3f, not 0xff
 * guard against the caller handing us an out of range pointer
   (on h/w this can never happen, because only a 7 bit value is
   transferred over the I2C bus)
 * there was confusion over whether nvram[] holds only the 56 bytes
   of guest-accessible NVRAM, or also the secondary registers
   which hold the value of the clock captured at the start of a
   multibyte read. Correct to consistently be the latter, by fixing
   the array size and the offset used for NVRAM writes.
 * ds1338_send was attempting to use 'data' as both the data and
   the register offset simultaneously, which meant that writes to
   any register were broken; fix to use the register pointer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/ds1338.c