[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL] Urgent memory fix for kvm with unaligned memory
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [PULL] Urgent memory fix for kvm with unaligned memory slots |
Date: |
Thu, 01 Mar 2012 19:03:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 |
On 03/01/2012 06:51 PM, Bobby Powers wrote:
> > /* kvm works in page size chunks, but the function may be called
> > with sub-page size and unaligned start address. */
> > - size = TARGET_PAGE_ALIGN(size);
> > - start_addr = TARGET_PAGE_ALIGN(start_addr);
> > + delta = TARGET_PAGE_ALIGN(size) - size;
> > + if (delta > size) {
> > + return;
> > + }
> > + start_addr += delta;
> > + size -= delta;
> > + size &= TARGET_PAGE_MASK;
> > + if (!size || (start_addr & ~TARGET_PAGE_MASK)) {
> > + return;
> > + }
> >
> > if (!memory_region_is_ram(mr)) {
> > return;
> > }
> >
> > - ram = memory_region_get_ram_ptr(mr) + section->offset_within_region;
> > + ram = memory_region_get_ram_ptr(mr) + section->offset_within_region
> > + delta;
>
> Am I crazy, or does this look wrong?
Could be both. Why do you thing it is wrong?
--
error compiling committee.c: too many arguments to function