On 5 February 2016 at 16:55, Aurelio Remonda
<aurelio.remo...@tallertechnologies.com> 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

Reply via email to