From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42861 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Po1Uc-0004EC-QQ for qemu-devel@nongnu.org; Fri, 11 Feb 2011 17:29:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Po1Ub-0003pN-R3 for qemu-devel@nongnu.org; Fri, 11 Feb 2011 17:29:34 -0500 Received: from mail.serverraum.org ([78.47.150.89]:49815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Po1Ub-0003pJ-Ib for qemu-devel@nongnu.org; Fri, 11 Feb 2011 17:29:33 -0500 From: Michael Walle Subject: Re: [Qemu-devel] [PATCH 09/17] lm32: timer model Date: Fri, 11 Feb 2011 23:29:31 +0100 References: <1297379530-23487-1-git-send-email-michael@walle.cc> <1297379530-23487-10-git-send-email-michael@walle.cc> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201102112329.31258.michael@walle.cc> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: "Edgar E. Iglesias" , Richard Henderson , qemu-devel@nongnu.org, Alexander Graf Am Freitag 11 Februar 2011, 22:22:32 schrieb Blue Swirl: > > +static uint32_t timer_read(void *opaque, target_phys_addr_t addr) > > +{ > > + LM32TimerState *s = opaque; > > + uint32_t r = 0; > > + > > + addr >>= 2; > > + switch (addr) { > > + case R_SR: > > + case R_CR: > > + case R_PERIOD: > > + r = s->regs[addr]; > > + break; > > + case R_SNAPSHOT: > > + r = (uint32_t)ptimer_get_count(s->ptimer); > > + break; > > + > > + default: > > + hw_error("lm32_timer: read access to unkown register 0x" > > + TARGET_FMT_plx, addr << 2); > > Insecure, please fix also others. Many devices in hw/ treat memory access to unknown registers in that way. Are there any 'good' example models, where i can look at? I guess i should print a warning instead? -- Michael