]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Correct AUXV Cache Line Sizes for PowerPC
authorTom Musta <tommusta@gmail.com>
Mon, 16 Jun 2014 16:03:19 +0000 (11:03 -0500)
committerAlexander Graf <agraf@suse.de>
Fri, 27 Jun 2014 11:48:21 +0000 (13:48 +0200)
Set the AT_ICACHEBSIZE and AT_DCACHEBSIZE entries of the AUXV to match the
CPU model's cache line sizes.  This fixes memory clobbering problems on more
recent Book 3s implementations; memset(p, 0, N) will use the dcbz instruction
when N is sufficiently large and many of the newer server CPUs have cache lines
sizes of 128 bytes.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
linux-user/elfload.c

index 1248eda27222492835033ad0bc7747042c404508..64d23fa647400018c9929800d76c848b1f5eb06a 100644 (file)
@@ -774,8 +774,9 @@ static uint32_t get_elf_hwcap(void)
 #define DLINFO_ARCH_ITEMS       5
 #define ARCH_DLINFO                                     \
     do {                                                \
-        NEW_AUX_ENT(AT_DCACHEBSIZE, 0x20);              \
-        NEW_AUX_ENT(AT_ICACHEBSIZE, 0x20);              \
+        PowerPCCPU *cpu = POWERPC_CPU(thread_cpu);              \
+        NEW_AUX_ENT(AT_DCACHEBSIZE, cpu->env.dcache_line_size); \
+        NEW_AUX_ENT(AT_ICACHEBSIZE, cpu->env.icache_line_size); \
         NEW_AUX_ENT(AT_UCACHEBSIZE, 0);                 \
         /*                                              \
          * Now handle glibc compatibility.              \