From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU77B-0005LI-Kv for qemu-devel@nongnu.org; Mon, 14 May 2012 22:03:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SU779-0003NS-R3 for qemu-devel@nongnu.org; Mon, 14 May 2012 22:03:53 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:41573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU779-0003MB-M0 for qemu-devel@nongnu.org; Mon, 14 May 2012 22:03:51 -0400 Received: by obbwd20 with SMTP id wd20so10097048obb.4 for ; Mon, 14 May 2012 19:03:50 -0700 (PDT) Message-ID: <4FB1B983.5040507@codemonkey.ws> Date: Mon, 14 May 2012 21:03:47 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1336625347-10169-1-git-send-email-benh@kernel.crashing.org> <1336625347-10169-3-git-send-email-benh@kernel.crashing.org> <4FB1A658.3050601@codemonkey.ws> <20120515012335.GD30229@truffala.fritz.box> In-Reply-To: <20120515012335.GD30229@truffala.fritz.box> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/13] Implement cpu_physical_memory_zero() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt , qemu-devel@nongnu.org, David Gibson On 05/14/2012 08:23 PM, David Gibson wrote: > On Mon, May 14, 2012 at 07:42:00PM -0500, Anthony Liguori wrote: >> On 05/09/2012 11:48 PM, Benjamin Herrenschmidt wrote: >>> From: David Gibson > [snip] >>> @@ -3581,6 +3581,59 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, >>> } >>> } >>> >>> +void cpu_physical_memory_zero(target_phys_addr_t addr, int len) >>> +{ >> >> I'd think a memset() like interface would be better but... > > I can work with that. > >> We should definitely implement this function in terms of >> cpu_physical_memory_write instead of open coding the logic again. > > Hrm. Having solved merge conflicts several times by recopying the > cpu_physical_memory_rw() logic, I can certainly see the attraction in > that. However, the point of this function is *not* to have to > allocate a temporary buffer, and I don't really see how to combine the > logic without that. Just use a fixed buffer (uint8_t buffer[512]) and call cpu_physical_memory_rw multiple times with an offset. Regards, Anthony Liguori >