On Mon, Sep 15, 2008 at 10:29:14AM -0500, Anthony Liguori wrote:
> Eduardo Habkost wrote:
<snip>
>>
>> New patch, reusing the range check from page_find_alloc() on
>> page_find(). Untested.
>>   
>
> Have you tested this patch yet?  I like to avoid being the first one to  
> test something when it's not my code :-)

I've tested it now, both with KVM enabled and with KVM disabled. My
machine didn't explode yet, so it seems to be fine.  :)

>
> Regards,
>
> Anthony Liguori
>
>> Signed-off-by: Eduardo Habkost <[EMAIL PROTECTED]>
>> ---
>> Index: qemu/exec.c
>> ===================================================================
>> --- qemu/exec.c      (revisão 5200)
>> +++ qemu/exec.c      (cópia de trabalho)
>> @@ -279,17 +279,24 @@ static void page_init(void)
>>  #endif
>>  }
>>  -static inline PageDesc *page_find_alloc(target_ulong index)
>> +static inline PageDesc **page_l1_map(target_ulong index)
>>  {
>> -    PageDesc **lp, *p;
>> -
>>  #if TARGET_LONG_BITS > 32
>>      /* Host memory outside guest VM.  For 32-bit targets we have already
>>         excluded high addresses.  */
>>      if (index > ((target_ulong)L2_SIZE * L1_SIZE))
>>          return NULL;
>>  #endif
>> -    lp = &l1_map[index >> L2_BITS];
>> +    return &l1_map[index >> L2_BITS];
>> +}
>> +
>> +static inline PageDesc *page_find_alloc(target_ulong index)
>> +{
>> +    PageDesc **lp, *p;
>> +    lp = page_l1_map(index);
>> +    if (!lp)
>> +        return NULL;
>> +
>>      p = *lp;
>>      if (!p) {
>>          /* allocate if not found */
>> @@ -316,9 +323,12 @@ static inline PageDesc *page_find_alloc(
>>   static inline PageDesc *page_find(target_ulong index)
>>  {
>> -    PageDesc *p;
>> +    PageDesc **lp, *p;
>> +    lp = page_l1_map(index);
>> +    if (!lp)
>> +        return NULL;
>>  -    p = l1_map[index >> L2_BITS];
>> +    p = *lp;
>>      if (!p)
>>          return 0;
>>      return p + (index & (L2_SIZE - 1));
>>
>>
>>   
>
>

-- 
Eduardo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to