Skip to contentSkip to conversation

Fix mask of pte index

PATCH Applied Qiao Nuohan 3 participants 8 messages May 21, 2013 – May 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix mask of pte index

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.

---
 target-i386/arch_memory_mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/arch_memory_mapping.c +1 -1
index 844893f..a2eb7e7 100644
@@ -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);
     }
Signature · 1 line
1.7.1
#1 lore raw
Quoted 12 lines · Qiao Nuohan

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.

---
 target-i386/arch_memory_mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/arch_memory_mapping.c +0 -0
index 844893f..a2eb7e7 100644

target-i386/arch_memory_mapping.c static void walk_pte(MemoryMappingList *list, hwaddr pte_start_addr, · line 44

Quoted 8 lines
target-i386/arch_memory_mapping.c +1 -1
@@ -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);
     }

Verified that this agrees with the spec for IA-32e/PAE paging. Note that walk_pte2() is correct; only walk_pte() has the typo.

Reviewed by: Jesse Larrew <[email protected]>

Jesse Larrew
Software Engineer, KVM Team
IBM Linux Technology Center
Phone: (512) 973-2052 (T/L: 363-2052)
[email protected]

#2 lore raw

Nuohan,

Am 21.05.2013 08:16, schrieb Jesse Larrew:

Quoted 25 lines · Qiao Nuohan
Quoted 12 lines

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.

---
 target-i386/arch_memory_mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/arch_memory_mapping.c +0 -0
index 844893f..a2eb7e7 100644

target-i386/arch_memory_mapping.c static void walk_pte(MemoryMappingList *list, hwaddr pte_start_addr, · line 44

Quoted 8 lines
target-i386/arch_memory_mapping.c +1 -1
@@ -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);
     }

Verified that this agrees with the spec for IA-32e/PAE paging. Note that walk_pte2() is correct; only walk_pte() has the typo.

Quoted 1 line

Reviewed by: Jesse Larrew <[email protected]>

This patch is missing a Signed-off-by!

If you can reply with one, I'd fix up the subject for you (it should indicate where you are fixing it) and queue it together with my CPU'ish memory_mapping refactorings, if no one objects.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 1 line · Andreas Färber

This patch is missing a Signed-off-by!

Ha! I forgot it.

Quoted 4 lines

If you can reply with one, I'd fix up the subject for you (it should indicate where you are fixing it) and queue it together with my CPU'ish memory_mapping refactorings, if no one objects.

Well, I have got no reason to object. And thanks.

Signature · 2 lines
Regards
Qiao Nuohan
#4 lore raw

Am 21.05.2013 14:05, schrieb Qiao Nuohan:

Quoted 11 lines · Andreas Färber
Quoted 1 line

This patch is missing a Signed-off-by!

Ha! I forgot it.

Quoted 4 lines

If you can reply with one, I'd fix up the subject for you (it should indicate where you are fixing it) and queue it together with my CPU'ish memory_mapping refactorings, if no one objects.

Well, I have got no reason to object. And thanks.

Still no Signed-off-by line in your reply nor a resend on the list, so I can't do anything yet - did you forget? Or do you intend to send a v2?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw

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.

---
 target-i386/arch_memory_mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/arch_memory_mapping.c +1 -1
index 844893f..a2eb7e7 100644
@@ -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);
     }
Signature · 1 line
1.7.1
#6 lore raw
Quoted 5 lines · Qiao Nuohan

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.

Reviewed by: Jesse Larrew <[email protected]>

Quoted 19 lines

---
target-i386/arch_memory_mapping.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/arch_memory_mapping.c +1 -1
index 844893f..a2eb7e7 100644
@@ -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);

}

#7 lore raw

Am 22.05.2013 03:25, schrieb Qiao Nuohan:

Quoted 9 lines · Qiao Nuohan
Quoted 6 lines

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.

Reviewed by: Jesse Larrew <[email protected]>

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg