qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/2] hw/integratorcp: Simplify flash remap co


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH v2 2/2] hw/integratorcp: Simplify flash remap code
Date: Tue, 20 Dec 2011 18:37:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

On 12/20/2011 06:08 PM, Peter Maydell wrote:
> Use the new memory mutator API to simplify the flash remap code;
> this allows us to drop the flash_mapped flag.
>
>  
> -static void integratorcm_do_remap(integratorcm_state *s, int flash)
> +static void integratorcm_do_remap(integratorcm_state *s)
>  {
> -    if (!flash) {
> -        if (s->flash_mapped) {
> -            sysbus_del_memory(&s->busdev, &s->flash);
> -            s->flash_mapped = false;
> -        }
> +    /* Sync memory region state with CM_CTRL REMAP bit:
> +     * bit 0 => flash at address 0; bit 1 => RAM
> +     */
> +    if (s->cm_ctrl & 4) {
> +        memory_region_set_enabled(&s->flash, 0);
>      } else {
> -        if (!s->flash_mapped) {
> -            sysbus_add_memory_overlap(&s->busdev, 0, &s->flash, 1);
> -            s->flash_mapped = true;
> -        }
> +        memory_region_set_enabled(&s->flash, 1);
>      }

  memory_region_set_enabled(&s->flash, !(s->cm_ctrl & 4));

shows that the bit is inverted and passed directly to flash.enabled.

-- 
error compiling committee.c: too many arguments to function




reply via email to

[Prev in Thread] Current Thread [Next in Thread]