mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
Replace TARGET_WORDS_BIGENDIAN
Convert the TARGET_WORDS_BIGENDIAN macro, similarly to what was done with HOST_BIG_ENDIAN. The new TARGET_BIG_ENDIAN macro is either 0 or 1, and thus should always be defined to prevent misuse. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Suggested-by: Halil Pasic <pasic@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220323155743.1585078-8-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e03b56863d
commit
ee3eb3a7ce
83 changed files with 120 additions and 116 deletions
|
@ -202,7 +202,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
|||
}
|
||||
env->pc = regs->pc;
|
||||
env->xregs[31] = regs->sp;
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
env->cp15.sctlr_el[1] |= SCTLR_E0E;
|
||||
for (i = 1; i < 4; ++i) {
|
||||
env->cp15.sctlr_el[i] |= SCTLR_EE;
|
||||
|
|
|
@ -147,7 +147,7 @@ static void target_setup_fpsimd_record(struct target_fpsimd_context *fpsimd,
|
|||
|
||||
for (i = 0; i < 32; i++) {
|
||||
uint64_t *q = aa64_vfp_qreg(env, i);
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
__put_user(q[0], &fpsimd->vregs[i * 2 + 1]);
|
||||
__put_user(q[1], &fpsimd->vregs[i * 2]);
|
||||
#else
|
||||
|
@ -233,7 +233,7 @@ static void target_restore_fpsimd_record(CPUARMState *env,
|
|||
|
||||
for (i = 0; i < 32; i++) {
|
||||
uint64_t *q = aa64_vfp_qreg(env, i);
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
__get_user(q[0], &fpsimd->vregs[i * 2 + 1]);
|
||||
__get_user(q[1], &fpsimd->vregs[i * 2]);
|
||||
#else
|
||||
|
|
|
@ -8,7 +8,7 @@ struct target_pt_regs {
|
|||
uint64_t pstate;
|
||||
};
|
||||
|
||||
#if defined(TARGET_WORDS_BIGENDIAN)
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define UNAME_MACHINE "aarch64_be"
|
||||
#else
|
||||
#define UNAME_MACHINE "aarch64"
|
||||
|
|
|
@ -519,7 +519,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
|||
for(i = 0; i < 16; i++) {
|
||||
env->regs[i] = regs->uregs[i];
|
||||
}
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
/* Enable BE8. */
|
||||
if (EF_ARM_EABI_VERSION(info->elf_flags) >= EF_ARM_EABI_VER4
|
||||
&& (info->elf_flags & EF_ARM_BE8)) {
|
||||
|
|
|
@ -18,7 +18,7 @@ struct target_pt_regs {
|
|||
#define ARM_NR_set_tls (ARM_NR_BASE + 5)
|
||||
#define ARM_NR_get_tls (ARM_NR_BASE + 6)
|
||||
|
||||
#if defined(TARGET_WORDS_BIGENDIAN)
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define UNAME_MACHINE "armv5teb"
|
||||
#else
|
||||
#define UNAME_MACHINE "armv5tel"
|
||||
|
|
|
@ -105,7 +105,7 @@ int info_is_fdpic(struct image_info *info)
|
|||
#define ELIBBAD 80
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define ELF_DATA ELFDATA2MSB
|
||||
#else
|
||||
#define ELF_DATA ELFDATA2LSB
|
||||
|
@ -483,7 +483,7 @@ static const char *get_elf_platform(void)
|
|||
{
|
||||
CPUARMState *env = thread_cpu->env_ptr;
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
# define END "b"
|
||||
#else
|
||||
# define END "l"
|
||||
|
@ -514,7 +514,7 @@ static const char *get_elf_platform(void)
|
|||
|
||||
#define ELF_ARCH EM_AARCH64
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
# define ELF_PLATFORM "aarch64_be"
|
||||
#else
|
||||
# define ELF_PLATFORM "aarch64"
|
||||
|
|
|
@ -215,7 +215,7 @@ static target_ulong get_sigframe(struct target_sigaction *ka,
|
|||
return (oldsp - frame_size) & ~0xFUL;
|
||||
}
|
||||
|
||||
#if defined(TARGET_WORDS_BIGENDIAN) == HOST_BIG_ENDIAN
|
||||
#if TARGET_BIG_ENDIAN == HOST_BIG_ENDIAN
|
||||
#define PPC_VEC_HI 0
|
||||
#define PPC_VEC_LO 1
|
||||
#else
|
||||
|
@ -542,7 +542,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
|
|||
env->nip = (target_ulong) ka->_sa_handler;
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
/* Signal handlers are entered in big-endian mode. */
|
||||
ppc_store_msr(env, env->msr & ~(1ull << MSR_LE));
|
||||
#else
|
||||
|
|
|
@ -59,7 +59,7 @@ struct target_revectored_struct {
|
|||
*/
|
||||
|
||||
#if defined(TARGET_PPC64)
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define UNAME_MACHINE "ppc64"
|
||||
#else
|
||||
#define UNAME_MACHINE "ppc64le"
|
||||
|
|
|
@ -236,7 +236,7 @@ static inline bool access_ok(CPUState *cpu, int type,
|
|||
} while (0)
|
||||
|
||||
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
# define __put_user(x, hptr) __put_user_e(x, hptr, be)
|
||||
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
|
||||
#else
|
||||
|
|
|
@ -8132,7 +8132,7 @@ static int is_proc_myself(const char *filename, const char *entry)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN) || \
|
||||
#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN || \
|
||||
defined(TARGET_SPARC) || defined(TARGET_M68K) || defined(TARGET_HPPA)
|
||||
static int is_proc(const char *filename, const char *entry)
|
||||
{
|
||||
|
@ -8140,7 +8140,7 @@ static int is_proc(const char *filename, const char *entry)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN)
|
||||
#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
|
||||
static int open_net_route(void *cpu_env, int fd)
|
||||
{
|
||||
FILE *fp;
|
||||
|
@ -8226,7 +8226,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
|
|||
{ "stat", open_self_stat, is_proc_myself },
|
||||
{ "auxv", open_self_auxv, is_proc_myself },
|
||||
{ "cmdline", open_self_cmdline, is_proc_myself },
|
||||
#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN)
|
||||
#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
|
||||
{ "/proc/net/route", open_net_route, is_proc },
|
||||
#endif
|
||||
#if defined(TARGET_SPARC) || defined(TARGET_HPPA)
|
||||
|
|
|
@ -41,7 +41,7 @@ const char *cpu_to_uname_machine(void *cpu_env)
|
|||
|
||||
/* in theory, endianness is configurable on some ARM CPUs, but this isn't
|
||||
* used in user mode emulation */
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define utsname_suffix "b"
|
||||
#else
|
||||
#define utsname_suffix "l"
|
||||
|
|
|
@ -115,7 +115,7 @@ static inline int is_error(abi_long ret)
|
|||
#if (TARGET_ABI_BITS == 32) && !defined(TARGET_ABI_MIPSN32)
|
||||
static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
|
||||
{
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
return ((uint64_t)word0 << 32) | word1;
|
||||
#else
|
||||
return ((uint64_t)word1 << 32) | word0;
|
||||
|
|
|
@ -130,7 +130,7 @@ static int setup_sigcontext(struct target_rt_sigframe *frame,
|
|||
|
||||
static void install_sigtramp(uint8_t *tramp)
|
||||
{
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
/* Generate instruction: MOVI a2, __NR_rt_sigreturn */
|
||||
__put_user(0x22, &tramp[0]);
|
||||
__put_user(0x0a, &tramp[1]);
|
||||
|
|
|
@ -15,7 +15,7 @@ struct target_ipc_perm {
|
|||
|
||||
struct target_semid64_ds {
|
||||
struct target_ipc_perm sem_perm;
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
#if TARGET_BIG_ENDIAN
|
||||
abi_ulong __unused1;
|
||||
abi_ulong sem_otime;
|
||||
abi_ulong __unused2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue