From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiPbW-0006Lq-JA for qemu-devel@nongnu.org; Thu, 08 May 2014 10:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiPbP-0007uZ-49 for qemu-devel@nongnu.org; Thu, 08 May 2014 10:47:22 -0400 Received: from s16892447.onlinehome-server.info ([82.165.15.123]:59789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiPbO-0007oe-Tx for qemu-devel@nongnu.org; Thu, 08 May 2014 10:47:15 -0400 Message-ID: <536B985C.9060207@ilande.co.uk> Date: Thu, 08 May 2014 15:44:44 +0100 From: Mark Cave-Ayland MIME-Version: 1.0 References: <1392800720-2765-1-git-send-email-mark.cave-ayland@ilande.co.uk> <1392800720-2765-2-git-send-email-mark.cave-ayland@ilande.co.uk> <5316F701.5020500@redhat.com> <536A8FD0.6000401@redhat.com> In-Reply-To: <536A8FD0.6000401@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv3 1/2] sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , qemu-devel@nongnu.org, Blue Swirl , Bob Breuer , Anthony Liguori , Artyom Tarasenko On 07/05/14 20:56, Paolo Bonzini wrote: > Il 05/03/2014 11:05, Paolo Bonzini ha scritto: >> Il 19/02/2014 10:05, Mark Cave-Ayland ha scritto: >>> +#define CG3_REG_SIZE 0x20 >>> + >>> +#define CG3_REG_FBC_CTRL 0x10 >>> +#define CG3_REG_FBC_STATUS 0x11 >>> +#define CG3_REG_FBC_CURSTART 0x12 >>> +#define CG3_REG_FBC_CUREND 0x13 >>> +#define CG3_REG_FBC_VCTRL 0x14 >>> + >>> +typedef struct CG3State { >> ... >> >>> + uint8_t regs[16]; >> >> ... >> >>> + case CG3_REG_FBC_CURSTART ... CG3_REG_SIZE: >>> + val = s->regs[addr - 0x10]; >>> + break; >>> + default: >> >> Something weird here, you can access regs[16] if addr == CG3_REG_SIZE. >> >> The same happens in the write path. > > Ping. I cannot fix it without access to the datasheet, though I suspect > you want CG3_REG_SIZE - 1. Hi Paolo, Sorry I didn't think you could access regs[16] since the MemoryRegion size is set to CG3_REG_SIZE too (and so I hope should only handle accesses from 0 to CG3_REG_SIZE - 1). Anyway, I've quickly tried a Solaris 8 boot test replacing CG3_REG_SIZE with CG3_REG_SIZE - 1 for the case statements in both the read and write paths and everything still works, so happy for you to go ahead and fix it. ATB, Mark.