diff options
author | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-18 11:17:30 +0000 |
---|---|---|
committer | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-18 11:17:30 +0000 |
commit | d9d7210c7dc2975f27e8d97e10f2ab3ff648d373 (patch) | |
tree | 4f26150b9a8ebd646fa6aaf685e546b8aba1c357 /target-ppc/cpu.h | |
parent | e2b577e5e548b58740ed5b1d9d12015cb7b233ff (diff) |
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
Diffstat (limited to 'target-ppc/cpu.h')
-rw-r--r-- | target-ppc/cpu.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 1ff32fd432..75aefb051b 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -23,19 +23,10 @@ #include "config.h" #include <inttypes.h> -#if !defined(TARGET_PPCEMB) -#if defined(TARGET_PPC64) || (HOST_LONG_BITS >= 64) -/* When using 64 bits temporary registers, - * we can use 64 bits GPR with no extra cost - */ -#define TARGET_PPCEMB -#endif -#endif - #if defined (TARGET_PPC64) typedef uint64_t ppc_gpr_t; -#define TARGET_LONG_BITS 64 #define TARGET_GPR_BITS 64 +#define TARGET_LONG_BITS 64 #define REGX "%016" PRIx64 #define TARGET_PAGE_BITS 12 #elif defined(TARGET_PPCEMB) @@ -43,15 +34,32 @@ typedef uint64_t ppc_gpr_t; #define TARGET_PHYS_ADDR_BITS 64 /* GPR are 64 bits: used by vector extension */ typedef uint64_t ppc_gpr_t; -#define TARGET_LONG_BITS 32 #define TARGET_GPR_BITS 64 +#define TARGET_LONG_BITS 32 #define REGX "%016" PRIx64 +#if defined(CONFIG_USER_ONLY) +/* It looks like a lot of Linux programs assume page size + * is 4kB long. This is evil, but we have to deal with it... + */ +#define TARGET_PAGE_BITS 12 +#else /* Pages can be 1 kB small */ #define TARGET_PAGE_BITS 10 +#endif +#else +#if (HOST_LONG_BITS >= 64) +/* When using 64 bits temporary registers, + * we can use 64 bits GPR with no extra cost + * It's even an optimization as it will prevent + * the compiler to do unuseful masking in the micro-ops. + */ +typedef uint64_t ppc_gpr_t; +#define TARGET_GPR_BITS 64 #else typedef uint32_t ppc_gpr_t; -#define TARGET_LONG_BITS 32 #define TARGET_GPR_BITS 32 +#endif +#define TARGET_LONG_BITS 32 #define REGX "%08" PRIx32 #define TARGET_PAGE_BITS 12 #endif |