Patchwork Fix mask of pte index

login
register
mail settings
Submitter Qiao Nuohan
Date May 22, 2013, 1:21 a.m.
Message ID <519C1D80.6090707@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/245475/
State New
Headers show

Comments

Qiao Nuohan - May 22, 2013, 1:21 a.m.
Function walk_pte needs pte index to calculate virtual address. However, pte
index of PAE paging or IA-32e paging is 9 bit, so the mask should be 0x1ff.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
---
  target-i386/arch_memory_mapping.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

      }
Qiao Nuohan - May 22, 2013, 1:25 a.m.
On 05/22/2013 09:21 AM, Qiao Nuohan wrote:
> Function walk_pte needs pte index to calculate virtual address. However,
> pte
> index of PAE paging or IA-32e paging is 9 bit, so the mask should be 0x1ff.
>
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>

Reviewed by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>

> ---
> target-i386/arch_memory_mapping.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-i386/arch_memory_mapping.c
> b/target-i386/arch_memory_mapping.c
> index 844893f..a2eb7e7 100644
> --- a/target-i386/arch_memory_mapping.c
> +++ b/target-i386/arch_memory_mapping.c
> @@ -38,7 +38,7 @@ static void walk_pte(MemoryMappingList *list, hwaddr
> pte_start_addr,
> continue;
> }
>
> - start_vaddr = start_line_addr | ((i & 0x1fff) << 12);
> + start_vaddr = start_line_addr | ((i & 0x1ff) << 12);
> memory_mapping_list_add_merge_sorted(list, start_paddr,
> start_vaddr, 1 << 12);
> }
Andreas Färber - May 22, 2013, 12:48 p.m.
Am 22.05.2013 03:25, schrieb Qiao Nuohan:
> On 05/22/2013 09:21 AM, Qiao Nuohan wrote:
>> Function walk_pte needs pte index to calculate virtual address. However,
>> pte
>> index of PAE paging or IA-32e paging is 9 bit, so the mask should be
>> 0x1ff.
>>
>> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> 
> Reviewed by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>

Thanks, applied to qom-cpu (with change to subject):
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Note that this patch did not apply, but the original one did.

Regards,
Andreas

Patch

diff --git a/target-i386/arch_memory_mapping.c 
b/target-i386/arch_memory_mapping.c
index 844893f..a2eb7e7 100644
--- a/target-i386/arch_memory_mapping.c
+++ b/target-i386/arch_memory_mapping.c
@@ -38,7 +38,7 @@  static void walk_pte(MemoryMappingList *list, hwaddr 
pte_start_addr,
              continue;
          }

-        start_vaddr = start_line_addr | ((i & 0x1fff) << 12);
+        start_vaddr = start_line_addr | ((i & 0x1ff) << 12);
          memory_mapping_list_add_merge_sorted(list, start_paddr,
                                               start_vaddr, 1 << 12);