提交 6c8df7a3 编写于 作者: A Anthony Liguori

Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Luiz Capitulino (1) and others
# Via Luiz Capitulino
* luiz/queue/qmp:
  target-i386: Fix mask of pte index in memory mapping
  target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses
  qapi: pad GenericList value fields to 64 bits

Message-id: 1370009905-4255-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
typedef struct GenericList typedef struct GenericList
{ {
void *value; union {
void *value;
uint64_t padding;
};
struct GenericList *next; struct GenericList *next;
} GenericList; } GenericList;
......
...@@ -22,7 +22,10 @@ def generate_fwd_struct(name, members, builtin_type=False): ...@@ -22,7 +22,10 @@ def generate_fwd_struct(name, members, builtin_type=False):
typedef struct %(name)sList typedef struct %(name)sList
{ {
%(type)s value; union {
%(type)s value;
uint64_t padding;
};
struct %(name)sList *next; struct %(name)sList *next;
} %(name)sList; } %(name)sList;
''', ''',
...@@ -35,7 +38,10 @@ typedef struct %(name)s %(name)s; ...@@ -35,7 +38,10 @@ typedef struct %(name)s %(name)s;
typedef struct %(name)sList typedef struct %(name)sList
{ {
%(name)s *value; union {
%(name)s *value;
uint64_t padding;
};
struct %(name)sList *next; struct %(name)sList *next;
} %(name)sList; } %(name)sList;
''', ''',
......
...@@ -38,7 +38,7 @@ static void walk_pte(MemoryMappingList *list, hwaddr pte_start_addr, ...@@ -38,7 +38,7 @@ static void walk_pte(MemoryMappingList *list, hwaddr pte_start_addr,
continue; 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, memory_mapping_list_add_merge_sorted(list, start_paddr,
start_vaddr, 1 << 12); start_vaddr, 1 << 12);
} }
...@@ -75,6 +75,8 @@ static void walk_pte2(MemoryMappingList *list, ...@@ -75,6 +75,8 @@ static void walk_pte2(MemoryMappingList *list,
} }
/* PAE Paging or IA-32e Paging */ /* PAE Paging or IA-32e Paging */
#define PLM4_ADDR_MASK 0xffffffffff000 /* selects bits 51:12 */
static void walk_pde(MemoryMappingList *list, hwaddr pde_start_addr, static void walk_pde(MemoryMappingList *list, hwaddr pde_start_addr,
int32_t a20_mask, target_ulong start_line_addr) int32_t a20_mask, target_ulong start_line_addr)
{ {
...@@ -105,7 +107,7 @@ static void walk_pde(MemoryMappingList *list, hwaddr pde_start_addr, ...@@ -105,7 +107,7 @@ static void walk_pde(MemoryMappingList *list, hwaddr pde_start_addr,
continue; continue;
} }
pte_start_addr = (pde & ~0xfff) & a20_mask; pte_start_addr = (pde & PLM4_ADDR_MASK) & a20_mask;
walk_pte(list, pte_start_addr, a20_mask, line_addr); walk_pte(list, pte_start_addr, a20_mask, line_addr);
} }
} }
...@@ -208,7 +210,7 @@ static void walk_pdpe(MemoryMappingList *list, ...@@ -208,7 +210,7 @@ static void walk_pdpe(MemoryMappingList *list,
continue; continue;
} }
pde_start_addr = (pdpe & ~0xfff) & a20_mask; pde_start_addr = (pdpe & PLM4_ADDR_MASK) & a20_mask;
walk_pde(list, pde_start_addr, a20_mask, line_addr); walk_pde(list, pde_start_addr, a20_mask, line_addr);
} }
} }
...@@ -231,7 +233,7 @@ static void walk_pml4e(MemoryMappingList *list, ...@@ -231,7 +233,7 @@ static void walk_pml4e(MemoryMappingList *list,
} }
line_addr = ((i & 0x1ffULL) << 39) | (0xffffULL << 48); line_addr = ((i & 0x1ffULL) << 39) | (0xffffULL << 48);
pdpe_start_addr = (pml4e & ~0xfff) & a20_mask; pdpe_start_addr = (pml4e & PLM4_ADDR_MASK) & a20_mask;
walk_pdpe(list, pdpe_start_addr, a20_mask, line_addr); walk_pdpe(list, pdpe_start_addr, a20_mask, line_addr);
} }
} }
...@@ -249,7 +251,7 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) ...@@ -249,7 +251,7 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env)
if (env->hflags & HF_LMA_MASK) { if (env->hflags & HF_LMA_MASK) {
hwaddr pml4e_addr; hwaddr pml4e_addr;
pml4e_addr = (env->cr[3] & ~0xfff) & env->a20_mask; pml4e_addr = (env->cr[3] & PLM4_ADDR_MASK) & env->a20_mask;
walk_pml4e(list, pml4e_addr, env->a20_mask); walk_pml4e(list, pml4e_addr, env->a20_mask);
} else } else
#endif #endif
......
...@@ -295,7 +295,10 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data, ...@@ -295,7 +295,10 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
typedef struct TestStructList typedef struct TestStructList
{ {
TestStruct *value; union {
TestStruct *value;
uint64_t padding;
};
struct TestStructList *next; struct TestStructList *next;
} TestStructList; } TestStructList;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册