From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRjkE-00018t-GE for qemu-devel@nongnu.org; Fri, 05 Feb 2016 12:00:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRjkD-0000dt-MO for qemu-devel@nongnu.org; Fri, 05 Feb 2016 12:00:30 -0500 Received: from mail-vk0-x22f.google.com ([2607:f8b0:400c:c05::22f]:35939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRjkD-0000df-G0 for qemu-devel@nongnu.org; Fri, 05 Feb 2016 12:00:29 -0500 Received: by mail-vk0-x22f.google.com with SMTP id c3so13790949vkb.3 for ; Fri, 05 Feb 2016 09:00:29 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Fri, 5 Feb 2016 17:00:09 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] Memory on stellaris board List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelio Remonda Cc: QEMU Developers On 5 February 2016 at 16:55, Aurelio Remonda wrote: > Im making something like this: > > if (ram_size == 0x8000000) /* default value, means whitout -m flag */ > { > sram_size = ((board->dc0 >> 18) + * 1024; > } > else if (ram_size >= UINT_MAX) /* more than 4GB */ > sram_size = UINT_MAX; > else > sram_size = ram_size > > So in case someone does not use the -m flag i want to be sure the ram is > calculated like it was before. The right way to do this is to set the MachineClass default_ram_size to what you want your default value to be. Then you should calculate the dc0 etc values to expose to the guest based on the ram size (which might be the default or might be user specified). If the user asks for a value that you can't handle (eg it is too big) then you should report the problem (via error_report()) and exit. thanks -- PMM