qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: phys_page_find bug?


From: Artyom Tarasenko
Subject: Re: [Qemu-devel] Re: phys_page_find bug?
Date: Fri, 4 Feb 2011 12:44:38 +0100

Tested-by: Artyom Tarasenko <address@hidden>

> There's two bugs in phys_page_find_alloc().  When the bottom level L2
> table is populated with IO_MEM_UNASSIGNED, region_offset is then used
> for reporting the physical address.  First, region_offset may not be
> aligned to the base address of the L2 region.  And second, region_offset
> won't hold the full 36-bit address on a 32-bit host.
>
> It seems that both can be fixed by returning NULL for unassigned
> addresses from phys_page_find().  All callers already handle a NULL
> return value.  Would this allow any further optimizations to be made?
>
> Here's a patch to try:
>
> diff --git a/exec.c b/exec.c
> index 49c28b1..77b49c8 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -434,7 +434,11 @@ static PhysPageDesc
> *phys_page_find_alloc(target_phys_addr_t index, int alloc)
>
>  static inline PhysPageDesc *phys_page_find(target_phys_addr_t index)
>  {
> -    return phys_page_find_alloc(index, 0);
> +    PhysPageDesc *pd = phys_page_find_alloc(index, 0);
> +    if (pd && pd->phys_offset == IO_MEM_UNASSIGNED) {
> +        return NULL;
> +    }
> +    return pd;
>  }
>
>  static void tlb_protect_code(ram_addr_t ram_addr);
>
>
>



-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/



reply via email to

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