Commit d9d7210c7dc2975f27e8d97e10f2ab3ff648d373

Authored by j_mayer
1 parent e2b577e5

Fix PowerPC 32 emulation on 64 bits hosts:

we can use 64 bits registers but not pretend page is 1kB long
As it seems most Linux programs assume page-size is 4kB, never allow
1kB pages for user-mode only emulation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3182 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 20 additions and 12 deletions
target-ppc/cpu.h
... ... @@ -23,19 +23,10 @@
23 23 #include "config.h"
24 24 #include <inttypes.h>
25 25  
26   -#if !defined(TARGET_PPCEMB)
27   -#if defined(TARGET_PPC64) || (HOST_LONG_BITS >= 64)
28   -/* When using 64 bits temporary registers,
29   - * we can use 64 bits GPR with no extra cost
30   - */
31   -#define TARGET_PPCEMB
32   -#endif
33   -#endif
34   -
35 26 #if defined (TARGET_PPC64)
36 27 typedef uint64_t ppc_gpr_t;
37   -#define TARGET_LONG_BITS 64
38 28 #define TARGET_GPR_BITS 64
  29 +#define TARGET_LONG_BITS 64
39 30 #define REGX "%016" PRIx64
40 31 #define TARGET_PAGE_BITS 12
41 32 #elif defined(TARGET_PPCEMB)
... ... @@ -43,15 +34,32 @@ typedef uint64_t ppc_gpr_t;
43 34 #define TARGET_PHYS_ADDR_BITS 64
44 35 /* GPR are 64 bits: used by vector extension */
45 36 typedef uint64_t ppc_gpr_t;
46   -#define TARGET_LONG_BITS 32
47 37 #define TARGET_GPR_BITS 64
  38 +#define TARGET_LONG_BITS 32
48 39 #define REGX "%016" PRIx64
  40 +#if defined(CONFIG_USER_ONLY)
  41 +/* It looks like a lot of Linux programs assume page size
  42 + * is 4kB long. This is evil, but we have to deal with it...
  43 + */
  44 +#define TARGET_PAGE_BITS 12
  45 +#else
49 46 /* Pages can be 1 kB small */
50 47 #define TARGET_PAGE_BITS 10
  48 +#endif
  49 +#else
  50 +#if (HOST_LONG_BITS >= 64)
  51 +/* When using 64 bits temporary registers,
  52 + * we can use 64 bits GPR with no extra cost
  53 + * It's even an optimization as it will prevent
  54 + * the compiler to do unuseful masking in the micro-ops.
  55 + */
  56 +typedef uint64_t ppc_gpr_t;
  57 +#define TARGET_GPR_BITS 64
51 58 #else
52 59 typedef uint32_t ppc_gpr_t;
53   -#define TARGET_LONG_BITS 32
54 60 #define TARGET_GPR_BITS 32
  61 +#endif
  62 +#define TARGET_LONG_BITS 32
55 63 #define REGX "%08" PRIx32
56 64 #define TARGET_PAGE_BITS 12
57 65 #endif
... ...