diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-05-31 11:32:32 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-05-31 11:32:32 -0500 |
commit | 6c8df7a33ade90c8c96b01655520c7e9b69b46c0 (patch) | |
tree | 89f190b13b95255c228a7fbaed3f6dedf4bf06a5 | |
parent | cdf79b6454abe13aec89d4be7cf59b3e841a7faf (diff) | |
parent | bff63471ced94e3a6de76b1a7375a875178d6cdc (diff) | |
download | qemu-6c8df7a33ade90c8c96b01655520c7e9b69b46c0.tar.gz qemu-6c8df7a33ade90c8c96b01655520c7e9b69b46c0.tar.bz2 qemu-6c8df7a33ade90c8c96b01655520c7e9b69b46c0.zip |
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: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | include/qapi/visitor.h | 5 | ||||
-rw-r--r-- | scripts/qapi-types.py | 10 | ||||
-rw-r--r-- | target-i386/arch_memory_mapping.c | 12 | ||||
-rw-r--r-- | tests/test-qmp-output-visitor.c | 5 |
4 files changed, 23 insertions, 9 deletions
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 1fef18c08f..28c21d8338 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -18,7 +18,10 @@ typedef struct GenericList { - void *value; + union { + void *value; + uint64_t padding; + }; struct GenericList *next; } GenericList; diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index fd42d71da1..ddcfed9f4b 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -22,7 +22,10 @@ def generate_fwd_struct(name, members, builtin_type=False): typedef struct %(name)sList { - %(type)s value; + union { + %(type)s value; + uint64_t padding; + }; struct %(name)sList *next; } %(name)sList; ''', @@ -35,7 +38,10 @@ typedef struct %(name)s %(name)s; typedef struct %(name)sList { - %(name)s *value; + union { + %(name)s *value; + uint64_t padding; + }; struct %(name)sList *next; } %(name)sList; ''', diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index 844893f44d..5096fbdf44 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); } @@ -75,6 +75,8 @@ static void walk_pte2(MemoryMappingList *list, } /* 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, int32_t a20_mask, target_ulong start_line_addr) { @@ -105,7 +107,7 @@ static void walk_pde(MemoryMappingList *list, hwaddr pde_start_addr, 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); } } @@ -208,7 +210,7 @@ static void walk_pdpe(MemoryMappingList *list, 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); } } @@ -231,7 +233,7 @@ static void walk_pml4e(MemoryMappingList *list, } 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); } } @@ -249,7 +251,7 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) if (env->hflags & HF_LMA_MASK) { 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); } else #endif diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index 0942a41875..b2fa9a74f6 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -295,7 +295,10 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data, typedef struct TestStructList { - TestStruct *value; + union { + TestStruct *value; + uint64_t padding; + }; struct TestStructList *next; } TestStructList; |