diff options
41 files changed, 1042 insertions, 997 deletions
diff --git a/Makefile.target b/Makefile.target index e264919..f5b6447 100644 --- a/Makefile.target +++ b/Makefile.target @@ -31,7 +31,10 @@ CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) endif ifdef CONFIG_LINUX_USER VPATH+=:$(SRC_PATH)/linux-user -CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) +ifndef TARGET_ABI_DIR + TARGET_ABI_DIR=$(TARGET_ARCH) +endif +CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) endif BASE_CFLAGS= BASE_LDFLAGS= @@ -66,6 +69,11 @@ ifeq ($(TARGET_ARCH),mips64) TARGET_ARCH2=mips64el endif endif +ifeq ($(TARGET_ARCH),sparc64) + ifeq ($(TARGET_ABI_DIR),sparc) + TARGET_ARCH2=sparc32plus + endif +endif QEMU_USER=qemu-$(TARGET_ARCH2) # system emulator name ifdef CONFIG_SOFTMMU @@ -504,7 +504,7 @@ if test -z "$target_list" ; then fi # the following are Linux specific if [ "$linux_user" = "yes" ] ; then - target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user ppc-linux-user ppc64-linux-user x86_64-linux-user cris-linux-user $target_list" + target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user ppc-linux-user ppc64-linux-user x86_64-linux-user cris-linux-user $target_list" fi # the following are Darwin specific if [ "$darwin_user" = "yes" ] ; then @@ -933,6 +933,7 @@ target_bigendian="no" [ "$target_cpu" = "armeb" ] && target_bigendian=yes [ "$target_cpu" = "sparc" ] && target_bigendian=yes [ "$target_cpu" = "sparc64" ] && target_bigendian=yes +[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes @@ -1026,6 +1027,13 @@ elif test "$target_cpu" = "sparc64" ; then echo "#define TARGET_SPARC 1" >> $config_h echo "#define TARGET_SPARC64 1" >> $config_h elfload32="yes" +elif test "$target_cpu" = "sparc32plus" ; then + echo "TARGET_ARCH=sparc64" >> $config_mak + echo "TARGET_ABI_DIR=sparc" >> $config_mak + echo "#define TARGET_ARCH \"sparc64\"" >> $config_h + echo "#define TARGET_SPARC 1" >> $config_h + echo "#define TARGET_SPARC64 1" >> $config_h + echo "#define TARGET_ABI32 1" >> $config_h elif test "$target_cpu" = "ppc" ; then echo "TARGET_ARCH=ppc" >> $config_mak echo "#define TARGET_ARCH \"ppc\"" >> $config_h @@ -1113,7 +1121,7 @@ if test "$target_darwin_user" = "yes" ; then echo "#define CONFIG_DARWIN_USER 1" >> $config_h fi -if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then +if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "sparc32plus" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then echo "CONFIG_SOFTFLOAT=yes" >> $config_mak echo "#define CONFIG_SOFTFLOAT 1" >> $config_h fi diff --git a/linux-user/alpha/syscall.h b/linux-user/alpha/syscall.h index 6435817..394afec 100644 --- a/linux-user/alpha/syscall.h +++ b/linux-user/alpha/syscall.h @@ -2,40 +2,40 @@ #define __USER_DS (1) struct target_pt_regs { - target_ulong r0; - target_ulong r1; - target_ulong r2; - target_ulong r3; - target_ulong r4; - target_ulong r5; - target_ulong r6; - target_ulong r7; - target_ulong r8; - target_ulong r19; - target_ulong r20; - target_ulong r21; - target_ulong r22; - target_ulong r23; - target_ulong r24; - target_ulong r25; - target_ulong r26; - target_ulong r27; - target_ulong r28; - target_ulong hae; + abi_ulong r0; + abi_ulong r1; + abi_ulong r2; + abi_ulong r3; + abi_ulong r4; + abi_ulong r5; + abi_ulong r6; + abi_ulong r7; + abi_ulong r8; + abi_ulong r19; + abi_ulong r20; + abi_ulong r21; + abi_ulong r22; + abi_ulong r23; + abi_ulong r24; + abi_ulong r25; + abi_ulong r26; + abi_ulong r27; + abi_ulong r28; + abi_ulong hae; /* JRP - These are the values provided to a0-a2 by PALcode */ - target_ulong trap_a0; - target_ulong trap_a1; - target_ulong trap_a2; + abi_ulong trap_a0; + abi_ulong trap_a1; + abi_ulong trap_a2; /* These are saved by PAL-code: */ - target_ulong ps; - target_ulong pc; - target_ulong gp; - target_ulong r16; - target_ulong r17; - target_ulong r18; + abi_ulong ps; + abi_ulong pc; + abi_ulong gp; + abi_ulong r16; + abi_ulong r17; + abi_ulong r18; /* Those is needed by qemu to temporary store the user stack pointer */ - target_ulong usp; - target_ulong unique; + abi_ulong usp; + abi_ulong unique; }; #define UNAME_MACHINE "alpha" diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 7618c3e..2382ffd 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 4096 #define TARGET_SIGSTKSZ 16384 -static inline target_ulong get_sp_from_cpustate(CPUAlphaState *state) +static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state) { return state->ir[IR_SP]; } diff --git a/linux-user/arm/syscall.h b/linux-user/arm/syscall.h index 1d508f0..e7f2e8d 100644 --- a/linux-user/arm/syscall.h +++ b/linux-user/arm/syscall.h @@ -3,7 +3,7 @@ stack during a system call. */ struct target_pt_regs { - target_long uregs[18]; + abi_long uregs[18]; }; #define ARM_cpsr uregs[16] diff --git a/linux-user/arm/target_signal.h b/linux-user/arm/target_signal.h index d518165..2b32813 100644 --- a/linux-user/arm/target_signal.h +++ b/linux-user/arm/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUARMState *state) +static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) { return state->regs[13]; } diff --git a/linux-user/cris/target_signal.h b/linux-user/cris/target_signal.h index e566de8..5611840 100644 --- a/linux-user/cris/target_signal.h +++ b/linux-user/cris/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_ulong ss_size; - target_long ss_flags; + abi_ulong ss_sp; + abi_ulong ss_size; + abi_long ss_flags; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUCRISState *state) +static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state) { return state->regs[14]; } diff --git a/linux-user/elfload.c b/linux-user/elfload.c index fbe7ddd..0bb455b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -172,7 +172,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { - target_long stack = infop->start_stack; + abi_long stack = infop->start_stack; memset(regs, 0, sizeof(*regs)); regs->ARM_cpsr = 0x10; if (infop->entry & 1) @@ -214,7 +214,11 @@ enum #define ELF_START_MMAP 0x80000000 +#ifndef TARGET_ABI32 #define elf_check_arch(x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) +#else +#define elf_check_arch(x) ( (x) == EM_SPARC32PLUS || (x) == EM_SPARC ) +#endif #define ELF_CLASS ELFCLASS64 #define ELF_DATA ELFDATA2MSB @@ -224,14 +228,20 @@ enum static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { +#ifndef TARGET_ABI32 regs->tstate = 0; +#endif regs->pc = infop->entry; regs->npc = regs->pc + 4; regs->y = 0; +#ifdef TARGET_ABI32 + regs->u_regs[14] = infop->start_stack - 16 * 4; +#else if (personality(infop->personality) == PER_LINUX32) regs->u_regs[14] = infop->start_stack - 16 * 4; else regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; +#endif } #else @@ -313,10 +323,10 @@ do { \ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop) { - target_ulong pos = infop->start_stack; - target_ulong tmp; + abi_ulong pos = infop->start_stack; + abi_ulong tmp; #ifdef TARGET_PPC64 - target_ulong entry, toc; + abi_ulong entry, toc; #endif _regs->msr = 1 << MSR_PR; /* Set user mode */ @@ -333,9 +343,9 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info * * execution of PPC BSD programs. */ _regs->gpr[3] = tgetl(pos); - pos += sizeof(target_ulong); + pos += sizeof(abi_ulong); _regs->gpr[4] = pos; - for (tmp = 1; tmp != 0; pos += sizeof(target_ulong)) + for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong)) tmp = ldl(pos); _regs->gpr[5] = pos; } @@ -475,9 +485,9 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_HWCAP 0 #endif -#ifdef OVERRIDE_ELF_CLASS +#ifdef TARGET_ABI32 #undef ELF_CLASS -#define ELF_CLASS OVERRIDE_ELF_CLASS +#define ELF_CLASS ELFCLASS32 #undef bswaptls #define bswaptls(ptr) bswap32s(ptr) #endif @@ -588,8 +598,8 @@ static void bswap_sym(struct elf_sym *sym) * to be put directly into the top of new user memory. * */ -static target_ulong copy_elf_strings(int argc,char ** argv, void **page, - target_ulong p) +static abi_ulong copy_elf_strings(int argc,char ** argv, void **page, + abi_ulong p) { char *tmp, *tmp1, *pag = NULL; int len, offset = 0; @@ -638,10 +648,10 @@ static target_ulong copy_elf_strings(int argc,char ** argv, void **page, return p; } -static target_ulong setup_arg_pages(target_ulong p, struct linux_binprm *bprm, - struct image_info *info) +static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm, + struct image_info *info) { - target_ulong stack_base, size, error; + abi_ulong stack_base, size, error; int i; /* Create enough stack to hold everything. If we don't use @@ -677,7 +687,7 @@ static target_ulong setup_arg_pages(target_ulong p, struct linux_binprm *bprm, return p; } -static void set_brk(target_ulong start, target_ulong end) +static void set_brk(abi_ulong start, abi_ulong end) { /* page-align the start and end addresses... */ start = HOST_PAGE_ALIGN(start); @@ -696,9 +706,9 @@ static void set_brk(target_ulong start, target_ulong end) /* We need to explicitly zero any fractional pages after the data section (i.e. bss). This would contain the junk from the file that should not be in memory. */ -static void padzero(target_ulong elf_bss, target_ulong last_bss) +static void padzero(abi_ulong elf_bss, abi_ulong last_bss) { - target_ulong nbyte; + abi_ulong nbyte; if (elf_bss >= last_bss) return; @@ -709,7 +719,7 @@ static void padzero(target_ulong elf_bss, target_ulong last_bss) patch target_mmap(), but it is more complicated as the file size must be known */ if (qemu_real_host_page_size < qemu_host_page_size) { - target_ulong end_addr, end_addr1; + abi_ulong end_addr, end_addr1; end_addr1 = (elf_bss + qemu_real_host_page_size - 1) & ~(qemu_real_host_page_size - 1); end_addr = HOST_PAGE_ALIGN(elf_bss); @@ -731,16 +741,16 @@ static void padzero(target_ulong elf_bss, target_ulong last_bss) } -static target_ulong create_elf_tables(target_ulong p, int argc, int envc, - struct elfhdr * exec, - target_ulong load_addr, - target_ulong load_bias, - target_ulong interp_load_addr, int ibcs, - struct image_info *info) +static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, + struct elfhdr * exec, + abi_ulong load_addr, + abi_ulong load_bias, + abi_ulong interp_load_addr, int ibcs, + struct image_info *info) { - target_ulong sp; + abi_ulong sp; int size; - target_ulong u_platform; + abi_ulong u_platform; const char *k_platform; const int n = sizeof(elf_addr_t); @@ -756,7 +766,7 @@ static target_ulong create_elf_tables(target_ulong p, int argc, int envc, /* * Force 16 byte _final_ alignment here for generality. */ - sp = sp &~ (target_ulong)15; + sp = sp &~ (abi_ulong)15; size = (DLINFO_ITEMS + 1) * 2; if (k_platform) size += 2; @@ -786,18 +796,18 @@ static target_ulong create_elf_tables(target_ulong p, int argc, int envc, NEW_AUX_ENT (AT_NULL, 0); /* There must be exactly DLINFO_ITEMS entries here. */ - NEW_AUX_ENT(AT_PHDR, (target_ulong)(load_addr + exec->e_phoff)); - NEW_AUX_ENT(AT_PHENT, (target_ulong)(sizeof (struct elf_phdr))); - NEW_AUX_ENT(AT_PHNUM, (target_ulong)(exec->e_phnum)); - NEW_AUX_ENT(AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE)); - NEW_AUX_ENT(AT_BASE, (target_ulong)(interp_load_addr)); - NEW_AUX_ENT(AT_FLAGS, (target_ulong)0); + NEW_AUX_ENT(AT_PHDR, (abi_ulong)(load_addr + exec->e_phoff)); + NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); + NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); + NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE)); + NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_load_addr)); + NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry); - NEW_AUX_ENT(AT_UID, (target_ulong) getuid()); - NEW_AUX_ENT(AT_EUID, (target_ulong) geteuid()); - NEW_AUX_ENT(AT_GID, (target_ulong) getgid()); - NEW_AUX_ENT(AT_EGID, (target_ulong) getegid()); - NEW_AUX_ENT(AT_HWCAP, (target_ulong) ELF_HWCAP); + NEW_AUX_ENT(AT_UID, (abi_ulong) getuid()); + NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid()); + NEW_AUX_ENT(AT_GID, (abi_ulong) getgid()); + NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid()); + NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP); if (k_platform) NEW_AUX_ENT(AT_PLATFORM, u_platform); #ifdef ARCH_DLINFO @@ -814,17 +824,17 @@ static target_ulong create_elf_tables(target_ulong p, int argc, int envc, } -static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, - int interpreter_fd, - target_ulong *interp_load_addr) +static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex, + int interpreter_fd, + abi_ulong *interp_load_addr) { struct elf_phdr *elf_phdata = NULL; struct elf_phdr *eppnt; - target_ulong load_addr = 0; + abi_ulong load_addr = 0; int load_addr_set = 0; int retval; - target_ulong last_bss, elf_bss; - target_ulong error; + abi_ulong last_bss, elf_bss; + abi_ulong error; int i; elf_bss = 0; @@ -838,20 +848,20 @@ static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, if ((interp_elf_ex->e_type != ET_EXEC && interp_elf_ex->e_type != ET_DYN) || !elf_check_arch(interp_elf_ex->e_machine)) { - return ~((target_ulong)0UL); + return ~((abi_ulong)0UL); } /* Now read in all of the header information */ if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) - return ~(target_ulong)0UL; + return ~(abi_ulong)0UL; elf_phdata = (struct elf_phdr *) malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); if (!elf_phdata) - return ~((target_ulong)0UL); + return ~((abi_ulong)0UL); /* * If the size of this structure has changed, then punt, since @@ -859,7 +869,7 @@ static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, */ if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) { free(elf_phdata); - return ~((target_ulong)0UL); + return ~((abi_ulong)0UL); } retval = lseek(interpreter_fd, interp_elf_ex->e_phoff, SEEK_SET); @@ -900,8 +910,8 @@ static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, if (eppnt->p_type == PT_LOAD) { int elf_type = MAP_PRIVATE | MAP_DENYWRITE; int elf_prot = 0; - target_ulong vaddr = 0; - target_ulong k; + abi_ulong vaddr = 0; + abi_ulong k; if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; @@ -921,7 +931,7 @@ static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, /* Real error */ close(interpreter_fd); free(elf_phdata); - return ~((target_ulong)0UL); + return ~((abi_ulong)0UL); } if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) { @@ -966,7 +976,7 @@ static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex, free(elf_phdata); *interp_load_addr = load_addr; - return ((target_ulong) interp_elf_ex->e_entry) + load_addr; + return ((abi_ulong) interp_elf_ex->e_entry) + load_addr; } /* Best attempt to load symbols from this ELF object. */ @@ -1054,22 +1064,22 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, struct elfhdr interp_elf_ex; struct exec interp_ex; int interpreter_fd = -1; /* avoid warning */ - target_ulong load_addr, load_bias; + abi_ulong load_addr, load_bias; int load_addr_set = 0; unsigned int interpreter_type = INTERPRETER_NONE; unsigned char ibcs2_interpreter; int i; - target_ulong mapped_addr; + abi_ulong mapped_addr; struct elf_phdr * elf_ppnt; struct elf_phdr *elf_phdata; - target_ulong elf_bss, k, elf_brk; + abi_ulong elf_bss, k, elf_brk; int retval; char * elf_interpreter; - target_ulong elf_entry, interp_load_addr = 0; + abi_ulong elf_entry, interp_load_addr = 0; int status; - target_ulong start_code, end_code, start_data, end_data; - target_ulong reloc_func_desc = 0; - target_ulong elf_stack; + abi_ulong start_code, end_code, start_data, end_data; + abi_ulong reloc_func_desc = 0; + abi_ulong elf_stack; char passed_fileno[6]; ibcs2_interpreter = 0; @@ -1125,9 +1135,9 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, elf_brk = 0; - elf_stack = ~((target_ulong)0UL); + elf_stack = ~((abi_ulong)0UL); elf_interpreter = NULL; - start_code = ~((target_ulong)0UL); + start_code = ~((abi_ulong)0UL); end_code = 0; start_data = 0; end_data = 0; @@ -1263,9 +1273,9 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, /* OK, This is the point of no return */ info->end_data = 0; info->end_code = 0; - info->start_mmap = (target_ulong)ELF_START_MMAP; + info->start_mmap = (abi_ulong)ELF_START_MMAP; info->mmap = 0; - elf_entry = (target_ulong) elf_ex.e_entry; + elf_entry = (abi_ulong) elf_ex.e_entry; /* Do this so that we can load the interpreter, if need be. We will change some of these later */ @@ -1282,7 +1292,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { int elf_prot = 0; int elf_flags = 0; - target_ulong error; + abi_ulong error; if (elf_ppnt->p_type != PT_LOAD) continue; @@ -1374,7 +1384,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, close(interpreter_fd); free(elf_interpreter); - if (elf_entry == ~((target_ulong)0UL)) { + if (elf_entry == ~((abi_ulong)0UL)) { printf("Unable to load interpreter\n"); free(elf_phdata); exit(-1); diff --git a/linux-user/elfload32.c b/linux-user/elfload32.c index d1a15ff..4b4648c 100755 --- a/linux-user/elfload32.c +++ b/linux-user/elfload32.c @@ -1,4 +1,4 @@ -#define OVERRIDE_ELF_CLASS ELFCLASS32 +#define TARGET_ABI32 #define load_elf_binary load_elf_binary32 #define do_init_thread do_init_thread32 diff --git a/linux-user/flat.h b/linux-user/flat.h index 9b84c72..6f2d0c4 100644 --- a/linux-user/flat.h +++ b/linux-user/flat.h @@ -22,25 +22,25 @@ struct flat_hdr { char magic[4]; - target_ulong rev; /* version (as above) */ - target_ulong entry; /* Offset of first executable instruction - with text segment from beginning of file */ - target_ulong data_start; /* Offset of data segment from beginning of - file */ - target_ulong data_end; /* Offset of end of data segment - from beginning of file */ - target_ulong bss_end; /* Offset of end of bss segment from beginning - of file */ + abi_ulong rev; /* version (as above) */ + abi_ulong entry; /* Offset of first executable instruction + with text segment from beginning of file */ + abi_ulong data_start; /* Offset of data segment from beginning of + file */ + abi_ulong data_end; /* Offset of end of data segment + from beginning of file */ + abi_ulong bss_end; /* Offset of end of bss segment from beginning + of file */ /* (It is assumed that data_end through bss_end forms the bss segment.) */ - target_ulong stack_size; /* Size of stack, in bytes */ - target_ulong reloc_start; /* Offset of relocation records from - beginning of file */ - target_ulong reloc_count; /* Number of relocation records */ - target_ulong flags; - target_ulong build_date; /* When the program/library was built */ - target_ulong filler[5]; /* Reservered, set to zero */ + abi_ulong stack_size; /* Size of stack, in bytes */ + abi_ulong reloc_start; /* Offset of relocation records from + beginning of file */ + abi_ulong reloc_count; /* Number of relocation records */ + abi_ulong flags; + abi_ulong build_date; /* When the program/library was built */ + abi_ulong filler[5]; /* Reservered, set to zero */ }; #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ diff --git a/linux-user/flatload.c b/linux-user/flatload.c index db88e4b..86b77f9 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -63,13 +63,13 @@ #define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */ struct lib_info { - target_ulong start_code; /* Start of text segment */ - target_ulong start_data; /* Start of data segment */ - target_ulong end_data; /* Start of bss section */ - target_ulong start_brk; /* End of data segment */ - target_ulong text_len; /* Length of text segment */ - target_ulong entry; /* Start address for this module */ - target_ulong build_date; /* When this one was compiled */ + abi_ulong start_code; /* Start of text segment */ + abi_ulong start_data; /* Start of data segment */ + abi_ulong end_data; /* Start of bss section */ + abi_ulong start_brk; /* End of data segment */ + abi_ulong text_len; /* Length of text segment */ + abi_ulong entry; /* Start address for this module */ + abi_ulong build_date; /* When this one was compiled */ short loaded; /* Has this library been loaded? */ }; @@ -89,7 +89,7 @@ struct linux_binprm; */ /* Push a block of strings onto the guest stack. */ -static target_ulong copy_strings(target_ulong p, int n, char **s) +static abi_ulong copy_strings(abi_ulong p, int n, char **s) { int len; @@ -102,8 +102,8 @@ static target_ulong copy_strings(target_ulong p, int n, char **s) return p; } -int target_pread(int fd, target_ulong ptr, target_ulong len, - target_ulong offset) +int target_pread(int fd, abi_ulong ptr, abi_ulong len, + abi_ulong offset) { void *buf; int ret; @@ -262,15 +262,15 @@ out: /****************************************************************************/ -static target_ulong -calc_reloc(target_ulong r, struct lib_info *p, int curid, int internalp) +static abi_ulong +calc_reloc(abi_ulong r, struct lib_info *p, int curid, int internalp) { - target_ulong addr; + abi_ulong addr; int id; - target_ulong start_brk; - target_ulong start_data; - target_ulong text_len; - target_ulong start_code; + abi_ulong start_brk; + abi_ulong start_data; + abi_ulong text_len; + abi_ulong start_code; #ifdef CONFIG_BINFMT_SHARED_FLAT #error needs checking @@ -381,19 +381,19 @@ void old_reloc(struct lib_info *libinfo, uint32_t rl) /****************************************************************************/ static int load_flat_file(struct linux_binprm * bprm, - struct lib_info *libinfo, int id, target_ulong *extra_stack) + struct lib_info *libinfo, int id, abi_ulong *extra_stack) { struct flat_hdr * hdr; - target_ulong textpos = 0, datapos = 0, result; - target_ulong realdatastart = 0; - target_ulong text_len, data_len, bss_len, stack_len, flags; - target_ulong memp = 0; /* for finding the brk area */ - target_ulong extra; - target_ulong reloc = 0, rp; + abi_ulong textpos = 0, datapos = 0, result; + abi_ulong realdatastart = 0; + abi_ulong text_len, data_len, bss_len, stack_len, flags; + abi_ulong memp = 0; /* for finding the brk area */ + abi_ulong extra; + abi_ulong reloc = 0, rp; int i, rev, relocs = 0; - target_ulong fpos; - target_ulong start_code, end_code; - target_ulong indx_len; + abi_ulong fpos; + abi_ulong start_code, end_code; + abi_ulong indx_len; hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ @@ -440,14 +440,14 @@ static int load_flat_file(struct linux_binprm * bprm, /* * calculate the extra space we need to map in */ - extra = relocs * sizeof(target_ulong); + extra = relocs * sizeof(abi_ulong); if (extra < bss_len + stack_len) extra = bss_len + stack_len; /* Add space for library base pointers. Make sure this does not misalign the doesn't misalign the data segment. */ - indx_len = MAX_SHARED_LIBS * sizeof(target_ulong); - indx_len = (indx_len + 15) & ~(target_ulong)15; + indx_len = MAX_SHARED_LIBS * sizeof(abi_ulong); + indx_len = (indx_len + 15) & ~(abi_ulong)15; /* * there are a couple of cases here, the separate code/data @@ -485,12 +485,12 @@ static int load_flat_file(struct linux_binprm * bprm, #ifdef CONFIG_BINFMT_ZFLAT if (flags & FLAT_FLAG_GZDATA) { result = decompress_exec(bprm, fpos, (char *) datapos, - data_len + (relocs * sizeof(target_ulong))) + data_len + (relocs * sizeof(abi_ulong))) } else #endif { result = target_pread(bprm->fd, datapos, - data_len + (relocs * sizeof(target_ulong)), + data_len + (relocs * sizeof(abi_ulong)), fpos); } if (result < 0) { @@ -544,7 +544,7 @@ static int load_flat_file(struct linux_binprm * bprm, text_len, 0); if (result >= 0) { result = target_pread(bprm->fd, datapos, - data_len + (relocs * sizeof(target_ulong)), + data_len + (relocs * sizeof(abi_ulong)), ntohl(hdr->data_start)); } } @@ -597,7 +597,7 @@ static int load_flat_file(struct linux_binprm * bprm, if (flags & FLAT_FLAG_GOTPIC) { rp = datapos; while (1) { - target_ulong addr; + abi_ulong addr; addr = tgetl(rp); if (addr == -1) break; @@ -607,7 +607,7 @@ static int load_flat_file(struct linux_binprm * bprm, return -ENOEXEC; tputl(rp, addr); } - rp += sizeof(target_ulong); + rp += sizeof(abi_ulong); } } @@ -624,12 +624,12 @@ static int load_flat_file(struct linux_binprm * bprm, */ if (rev > OLD_FLAT_VERSION) { for (i = 0; i < relocs; i++) { - target_ulong addr, relval; + abi_ulong addr, relval; /* Get the address of the pointer to be relocated (of course, the address has to be relocated first). */ - relval = tgetl(reloc + i * sizeof (target_ulong)); + relval = tgetl(reloc + i * sizeof (abi_ulong)); addr = flat_get_relocate_addr(relval); rp = calc_reloc(addr, libinfo, id, 1); if (rp == RELOC_FAILED) @@ -657,8 +657,8 @@ static int load_flat_file(struct linux_binprm * bprm, } } else { for (i = 0; i < relocs; i++) { - target_ulong relval; - relval = tgetl(reloc + i * sizeof (target_ulong)); + abi_ulong relval; + relval = tgetl(reloc + i * sizeof (abi_ulong)); old_reloc(&libinfo[0], relval); } } @@ -712,10 +712,10 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, struct image_info * info) { struct lib_info libinfo[MAX_SHARED_LIBS]; - target_ulong p = bprm->p; - target_ulong stack_len; - target_ulong start_addr; - target_ulong sp; + abi_ulong p = bprm->p; + abi_ulong stack_len; + abi_ulong start_addr; + abi_ulong sp; int res; int i, j; @@ -740,7 +740,7 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, /* Update data segment pointers for all libraries */ for (i=0; i<MAX_SHARED_LIBS; i++) { if (libinfo[i].loaded) { - target_ulong p; + abi_ulong p; p = libinfo[i].start_data; for (j=0; j<MAX_SHARED_LIBS; j++) { p -= 4; @@ -758,12 +758,12 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, p = copy_strings(p, bprm->envc, bprm->envp); p = copy_strings(p, bprm->argc, bprm->argv); /* Align stack. */ - sp = p & ~(target_ulong)(sizeof(target_ulong) - 1); + sp = p & ~(abi_ulong)(sizeof(abi_ulong) - 1); /* Enforce final stack alignment of 16 bytes. This is sufficient for all current targets, and excess alignment is harmless. */ stack_len = bprm->envc + bprm->argc + 2; stack_len += 3; /* argc, arvg, argp */ - stack_len *= sizeof(target_ulong); + stack_len *= sizeof(abi_ulong); if ((sp + stack_len) & 15) sp -= 16 - ((sp + stack_len) & 15); sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1); diff --git a/linux-user/i386/syscall.h b/linux-user/i386/syscall.h index 6e288b8..8045e1c 100644 --- a/linux-user/i386/syscall.h +++ b/linux-user/i386/syscall.h @@ -31,7 +31,7 @@ struct target_pt_regs { struct target_modify_ldt_ldt_s { unsigned int entry_number; - target_ulong base_addr; + abi_ulong base_addr; unsigned int limit; unsigned int flags; }; @@ -79,22 +79,22 @@ struct target_vm86_regs { /* * normal regs, with special meaning for the segment descriptors.. */ - target_long ebx; - target_long ecx; - target_long edx; - target_long esi; - target_long edi; - target_long ebp; - target_long eax; - target_long __null_ds; - target_long __null_es; - target_long __null_fs; - target_long __null_gs; - target_long orig_eax; - target_long eip; + abi_long ebx; + abi_long ecx; + abi_long edx; + abi_long esi; + abi_long edi; + abi_long ebp; + abi_long eax; + abi_long __null_ds; + abi_long __null_es; + abi_long __null_fs; + abi_long __null_gs; + abi_long orig_eax; + abi_long eip; unsigned short cs, __csh; - target_long eflags; - target_long esp; + abi_long eflags; + abi_long esp; unsigned short ss, __ssh; /* * these are specific to v86 mode: @@ -106,14 +106,14 @@ struct target_vm86_regs { }; struct target_revectored_struct { - target_ulong __map[8]; /* 256 bits */ + abi_ulong __map[8]; /* 256 bits */ }; struct target_vm86_struct { struct target_vm86_regs regs; - target_ulong flags; - target_ulong screen_bitmap; - target_ulong cpu_type; + abi_ulong flags; + abi_ulong screen_bitmap; + abi_ulong cpu_type; struct target_revectored_struct int_revectored; struct target_revectored_struct int21_revectored; }; @@ -124,7 +124,7 @@ struct target_vm86_struct { #define TARGET_VM86_SCREEN_BITMAP 0x0001 struct target_vm86plus_info_struct { - target_ulong flags; + abi_ulong flags; #define TARGET_force_return_for_pic (1 << 0) #define TARGET_vm86dbg_active (1 << 1) /* for debugger */ #define TARGET_vm86dbg_TFpendig (1 << 2) /* for debugger */ @@ -134,9 +134,9 @@ struct target_vm86plus_info_struct { struct target_vm86plus_struct { struct target_vm86_regs regs; - target_ulong flags; - target_ulong screen_bitmap; - target_ulong cpu_type; + abi_ulong flags; + abi_ulong screen_bitmap; + abi_ulong cpu_type; struct target_revectored_struct int_revectored; struct target_revectored_struct int21_revectored; struct target_vm86plus_info_struct vm86plus; diff --git a/linux-user/i386/target_signal.h b/linux-user/i386/target_signal.h index f93a8d6..9baf7fb 100644 --- a/linux-user/i386/target_signal.h +++ b/linux-user/i386/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUX86State *state) +static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) { return state->regs[R_ESP]; } diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 51f2953..42a02d2 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -13,7 +13,7 @@ #define NGROUPS 32 /* ??? This should really be somewhere else. */ -void memcpy_to_target(target_ulong dest, const void *src, +void memcpy_to_target(abi_ulong dest, const void *src, unsigned long len) { void *host_ptr; @@ -109,12 +109,12 @@ static int prepare_binprm(struct linux_binprm *bprm) } /* Construct the envp and argv tables on the target stack. */ -target_ulong loader_build_argptr(int envc, int argc, target_ulong sp, - target_ulong stringp, int push_ptr) +abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, + abi_ulong stringp, int push_ptr) { - int n = sizeof(target_ulong); - target_ulong envp; - target_ulong argv; + int n = sizeof(abi_ulong); + abi_ulong envp; + abi_ulong argv; sp -= (envc + 1) * n; envp = sp; diff --git a/linux-user/m68k/syscall.h b/linux-user/m68k/syscall.h index c225567..47cc66b 100644 --- a/linux-user/m68k/syscall.h +++ b/linux-user/m68k/syscall.h @@ -3,14 +3,14 @@ stack during a system call. */ struct target_pt_regs { - target_long d1, d2, d3, d4, d5, d6, d7; - target_long a0, a1, a2, a3, a4, a5, a6; - target_ulong d0; - target_ulong usp; - target_ulong orig_d0; + abi_long d1, d2, d3, d4, d5, d6, d7; + abi_long a0, a1, a2, a3, a4, a5, a6; + abi_ulong d0; + abi_ulong usp; + abi_ulong orig_d0; int16_t stkadj; uint16_t sr; - target_ulong pc; + abi_ulong pc; uint16_t fntvex; uint16_t __fill; }; diff --git a/linux-user/m68k/target_signal.h b/linux-user/m68k/target_signal.h index b481195..47852d5 100644 --- a/linux-user/m68k/target_signal.h +++ b/linux-user/m68k/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; diff --git a/linux-user/main.c b/linux-user/main.c index 1e406d3..ac5a63b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -168,7 +168,7 @@ static void set_idt(int n, unsigned int dpl) void cpu_loop(CPUX86State *env) { int trapnr; - target_ulong pc; + abi_ulong pc; target_siginfo_t info; for(;;) { @@ -305,11 +305,11 @@ void cpu_loop(CPUX86State *env) #ifdef TARGET_ARM /* XXX: find a better solution */ -extern void tb_invalidate_page_range(target_ulong start, target_ulong end); +extern void tb_invalidate_page_range(abi_ulong start, abi_ulong end); -static void arm_cache_flush(target_ulong start, target_ulong last) +static void arm_cache_flush(abi_ulong start, abi_ulong last) { - target_ulong addr, last1; + abi_ulong addr, last1; if (last < start) return; @@ -474,7 +474,7 @@ static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) static inline void save_window_offset(CPUSPARCState *env, int cwp1) { unsigned int i; - target_ulong sp_ptr; + abi_ulong sp_ptr; sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; #if defined(DEBUG_WIN) @@ -483,7 +483,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1) #endif for(i = 0; i < 16; i++) { tputl(sp_ptr, env->regbase[get_reg_index(env, cwp1, 8 + i)]); - sp_ptr += sizeof(target_ulong); + sp_ptr += sizeof(abi_ulong); } } @@ -505,7 +505,7 @@ static void save_window(CPUSPARCState *env) static void restore_window(CPUSPARCState *env) { unsigned int new_wim, i, cwp1; - target_ulong sp_ptr; + abi_ulong sp_ptr; new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) & ((1LL << NWINDOWS) - 1); @@ -519,7 +519,7 @@ static void restore_window(CPUSPARCState *env) #endif for(i = 0; i < 16; i++) { env->regbase[get_reg_index(env, cwp1, 8 + i)] = tgetl(sp_ptr); - sp_ptr += sizeof(target_ulong); + sp_ptr += sizeof(abi_ulong); } env->wim = new_wim; #ifdef TARGET_SPARC64 @@ -572,14 +572,14 @@ void cpu_loop (CPUSPARCState *env) env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5]); if ((unsigned int)ret >= (unsigned int)(-515)) { -#ifdef TARGET_SPARC64 +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) env->xcc |= PSR_CARRY; #else env->psr |= PSR_CARRY; #endif ret = -ret; } else { -#ifdef TARGET_SPARC64 +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) env->xcc &= ~PSR_CARRY; #else env->psr &= ~PSR_CARRY; @@ -591,6 +591,9 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; case 0x83: /* flush windows */ +#ifdef TARGET_ABI32 + case 0x103: +#endif flush_windows(env); /* next instruction */ env->pc = env->npc; @@ -1489,8 +1492,8 @@ void cpu_loop(CPUMIPSState *env) ret = -ENOSYS; } else { int nb_args; - target_ulong sp_reg; - target_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0; + abi_ulong sp_reg; + abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0; nb_args = mips_syscall_args[syscall_num]; sp_reg = env->gpr[29][env->current_tc]; @@ -2239,7 +2242,7 @@ int main(int argc, char **argv) int i; for(i = 0; i < 28; i++) { - env->ir[i] = ((target_ulong *)regs)[i]; + env->ir[i] = ((abi_ulong *)regs)[i]; } env->ipr[IPR_USP] = regs->usp; env->ir[30] = regs->usp; diff --git a/linux-user/mips/syscall.h b/linux-user/mips/syscall.h index a789348..9dfcc1f 100644 --- a/linux-user/mips/syscall.h +++ b/linux-user/mips/syscall.h @@ -4,18 +4,18 @@ struct target_pt_regs { /* Pad bytes for argument save space on the stack. */ - target_ulong pad0[6]; + abi_ulong pad0[6]; /* Saved main processor registers. */ - target_ulong regs[32]; + abi_ulong regs[32]; /* Saved special registers. */ - target_ulong cp0_status; - target_ulong lo; - target_ulong hi; - target_ulong cp0_badvaddr; - target_ulong cp0_cause; - target_ulong cp0_epc; + abi_ulong cp0_status; + abi_ulong lo; + abi_ulong hi; + abi_ulong cp0_badvaddr; + abi_ulong cp0_cause; + abi_ulong cp0_epc; }; /* Target errno definitions taken from asm-mips/errno.h */ diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h index 514195c..3b06e98 100644 --- a/linux-user/mips/target_signal.h +++ b/linux-user/mips/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_long ss_sp; - target_ulong ss_size; - target_long ss_flags; + abi_long ss_sp; + abi_ulong ss_size; + abi_long ss_flags; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state) +static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) { return state->gpr[29][state->current_tc]; } diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h index 4ec506c..668a2b9 100644 --- a/linux-user/mips64/syscall.h +++ b/linux-user/mips64/syscall.h @@ -4,15 +4,15 @@ struct target_pt_regs { /* Saved main processor registers. */ - target_ulong regs[32]; + abi_ulong regs[32]; /* Saved special registers. */ - target_ulong cp0_status; - target_ulong lo; - target_ulong hi; - target_ulong cp0_badvaddr; - target_ulong cp0_cause; - target_ulong cp0_epc; + abi_ulong cp0_status; + abi_ulong lo; + abi_ulong hi; + abi_ulong cp0_badvaddr; + abi_ulong cp0_cause; + abi_ulong cp0_epc; }; /* Target errno definitions taken from asm-mips/errno.h */ diff --git a/linux-user/mips64/target_signal.h b/linux-user/mips64/target_signal.h index 514195c..3b06e98 100644 --- a/linux-user/mips64/target_signal.h +++ b/linux-user/mips64/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_long ss_sp; - target_ulong ss_size; - target_long ss_flags; + abi_long ss_sp; + abi_ulong ss_size; + abi_long ss_flags; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state) +static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) { return state->gpr[29][state->current_tc]; } diff --git a/linux-user/mmap.c b/linux-user/mmap.c index ea916b8..4d18d22 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -30,9 +30,9 @@ //#define DEBUG_MMAP /* NOTE: all the constants are the HOST ones, but addresses are target. */ -int target_mprotect(target_ulong start, target_ulong len, int prot) +int target_mprotect(abi_ulong start, abi_ulong len, int prot) { - target_ulong end, host_start, host_end, addr; + abi_ulong end, host_start, host_end, addr; int prot1, ret; #ifdef DEBUG_MMAP @@ -96,11 +96,11 @@ int target_mprotect(target_ulong start, target_ulong len, int prot) } /* map an incomplete host page */ -static int mmap_frag(target_ulong real_start, - target_ulong start, target_ulong end, - int prot, int flags, int fd, target_ulong offset) +static int mmap_frag(abi_ulong real_start, + abi_ulong start, abi_ulong end, + int prot, int flags, int fd, abi_ulong offset) { - target_ulong real_end, ret, addr; + abi_ulong real_end, ret, addr; void *host_start; int prot1, prot_new; @@ -152,17 +152,17 @@ static int mmap_frag(target_ulong real_start, } /* NOTE: all the constants are the HOST ones */ -target_long target_mmap(target_ulong start, target_ulong len, int prot, - int flags, int fd, target_ulong offset) +abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + int flags, int fd, abi_ulong offset) { - target_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; + abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; unsigned long host_start; #if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__) || \ defined(__ia64) || defined(__mips__) - static target_ulong last_start = 0x40000000; + static abi_ulong last_start = 0x40000000; #elif defined(__CYGWIN__) /* Cygwin doesn't have a whole lot of address space. */ - static target_ulong last_start = 0x18000000; + static abi_ulong last_start = 0x18000000; #endif #ifdef DEBUG_MMAP @@ -228,7 +228,7 @@ target_long target_mmap(target_ulong start, target_ulong len, int prot, * TARGET_PAGE_SIZE, see exec.c. qemu_real_host_page_size is the * hosts real page size. */ - target_ulong host_end; + abi_ulong host_end; unsigned long host_aligned_start; host_len = HOST_PAGE_ALIGN(host_len + qemu_host_page_size @@ -354,9 +354,9 @@ target_long target_mmap(target_ulong start, target_ulong len, int prot, return start; } -int target_munmap(target_ulong start, target_ulong len) +int target_munmap(abi_ulong start, abi_ulong len) { - target_ulong end, real_start, real_end, addr; + abi_ulong end, real_start, real_end, addr; int prot, ret; #ifdef DEBUG_MMAP @@ -408,9 +408,9 @@ int target_munmap(target_ulong start, target_ulong len) /* XXX: currently, we only handle MAP_ANONYMOUS and not MAP_FIXED blocks which have been allocated starting on a host page */ -target_long target_mremap(target_ulong old_addr, target_ulong old_size, - target_ulong new_size, unsigned long flags, - target_ulong new_addr) +abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + abi_ulong new_size, unsigned long flags, + abi_ulong new_addr) { int prot; unsigned long host_addr; @@ -426,9 +426,9 @@ target_long target_mremap(target_ulong old_addr, target_ulong old_size, return new_addr; } -int target_msync(target_ulong start, target_ulong len, int flags) +int target_msync(abi_ulong start, abi_ulong len, int flags) { - target_ulong end; + abi_ulong end; if (start & ~TARGET_PAGE_MASK) return -EINVAL; diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h index bf6b21b..30427f6 100644 --- a/linux-user/ppc/syscall.h +++ b/linux-user/ppc/syscall.h @@ -44,7 +44,7 @@ struct target_pt_regs { /* ioctls */ struct target_revectored_struct { - target_ulong __map[8]; /* 256 bits */ + abi_ulong __map[8]; /* 256 bits */ }; /* diff --git a/linux-user/ppc/target_signal.h b/linux-user/ppc/target_signal.h index 80ad211..defae80 100644 --- a/linux-user/ppc/target_signal.h +++ b/linux-user/ppc/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUPPCState *state) +static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state) { return state->gpr[1]; } diff --git a/linux-user/ppc64/syscall.h b/linux-user/ppc64/syscall.h index c47e58a..bdb1a07 100644 --- a/linux-user/ppc64/syscall.h +++ b/linux-user/ppc64/syscall.h @@ -44,7 +44,7 @@ struct target_pt_regs { /* ioctls */ struct target_revectored_struct { - target_ulong __map[8]; /* 256 bits */ + abi_ulong __map[8]; /* 256 bits */ }; /* diff --git a/linux-user/ppc64/target_signal.h b/linux-user/ppc64/target_signal.h index 80ad211..defae80 100644 --- a/linux-user/ppc64/target_signal.h +++ b/linux-user/ppc64/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUPPCState *state) +static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state) { return state->gpr[1]; } diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 8a7cb24..e92db6e 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -1,13 +1,23 @@ #ifndef QEMU_H #define QEMU_H -#include "thunk.h" - #include <signal.h> #include <string.h> -#include "syscall_defs.h" #include "cpu.h" + +#ifdef TARGET_ABI32 +typedef uint32_t abi_ulong; +typedef int32_t abi_long; +#define TARGET_ABI_BITS 32 +#else +typedef target_ulong abi_ulong; +typedef target_long abi_long; +#define TARGET_ABI_BITS TARGET_LONG_BITS +#endif + +#include "thunk.h" +#include "syscall_defs.h" #include "syscall.h" #include "target_signal.h" #include "gdbstub.h" @@ -17,20 +27,20 @@ * task_struct fields in the kernel */ struct image_info { - target_ulong load_addr; - target_ulong start_code; - target_ulong end_code; - target_ulong start_data; - target_ulong end_data; - target_ulong start_brk; - target_ulong brk; - target_ulong start_mmap; - target_ulong mmap; - target_ulong rss; - target_ulong start_stack; - target_ulong entry; - target_ulong code_offset; - target_ulong data_offset; + abi_ulong load_addr; + abi_ulong start_code; + abi_ulong end_code; + abi_ulong start_data; + abi_ulong end_data; + abi_ulong start_brk; + abi_ulong brk; + abi_ulong start_mmap; + abi_ulong mmap; + abi_ulong rss; + abi_ulong start_stack; + abi_ulong entry; + abi_ulong code_offset; + abi_ulong data_offset; char **host_argv; int personality; }; @@ -67,7 +77,7 @@ typedef struct TaskState { int swi_errno; #endif #if defined(TARGET_I386) && !defined(TARGET_X86_64) - target_ulong target_v86; + abi_ulong target_v86; struct vm86_saved_state vm86_saved_regs; struct target_vm86plus_struct vm86plus; uint32_t v86flags; @@ -105,7 +115,7 @@ extern const char *qemu_uname_release; struct linux_binprm { char buf[128]; void *page[MAX_ARG_PAGES]; - target_ulong p; + abi_ulong p; int fd; int e_uid, e_gid; int argc, envc; @@ -115,8 +125,8 @@ struct linux_binprm { }; void do_init_thread(struct target_pt_regs *regs, struct image_info *infop); -target_ulong loader_build_argptr(int envc, int argc, target_ulong sp, - target_ulong stringp, int push_ptr); +abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, + abi_ulong stringp, int push_ptr); int loader_exec(const char * filename, char ** argv, char ** envp, struct target_pt_regs * regs, struct image_info *infop); @@ -130,14 +140,14 @@ int load_elf_binary_multi(struct linux_binprm *bprm, struct image_info *info); #endif -void memcpy_to_target(target_ulong dest, const void *src, +void memcpy_to_target(abi_ulong dest, const void *src, unsigned long len); -void target_set_brk(target_ulong new_brk); -target_long do_brk(target_ulong new_brk); +void target_set_brk(abi_ulong new_brk); +abi_long do_brk(abi_ulong new_brk); void syscall_init(void); -target_long do_syscall(void *cpu_env, int num, target_long arg1, - target_long arg2, target_long arg3, target_long arg4, - target_long arg5, target_long arg6); +abi_long do_syscall(void *cpu_env, int num, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5, abi_long arg6); void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); extern CPUState *global_env; void cpu_loop(CPUState *env); @@ -157,28 +167,28 @@ long do_sigreturn(CPUState *env); long do_rt_sigreturn(CPUState *env); int do_sigaltstack(const struct target_sigaltstack *uss, struct target_sigaltstack *uoss, - target_ulong sp); + abi_ulong sp); #ifdef TARGET_I386 /* vm86.c */ void save_v86_state(CPUX86State *env); void handle_vm86_trap(CPUX86State *env, int trapno); void handle_vm86_fault(CPUX86State *env); -int do_vm86(CPUX86State *env, long subfunction, target_ulong v86_addr); +int do_vm86(CPUX86State *env, long subfunction, abi_ulong v86_addr); #elif defined(TARGET_SPARC64) void sparc64_set_context(CPUSPARCState *env); void sparc64_get_context(CPUSPARCState *env); #endif /* mmap.c */ -int target_mprotect(target_ulong start, target_ulong len, int prot); -target_long target_mmap(target_ulong start, target_ulong len, int prot, - int flags, int fd, target_ulong offset); -int target_munmap(target_ulong start, target_ulong len); -target_long target_mremap(target_ulong old_addr, target_ulong old_size, - target_ulong new_size, unsigned long flags, - target_ulong new_addr); -int target_msync(target_ulong start, target_ulong len, int flags); +int target_mprotect(abi_ulong start, abi_ulong len, int prot); +abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + int flags, int fd, abi_ulong offset); +int target_munmap(abi_ulong start, abi_ulong len); +abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + abi_ulong new_size, unsigned long flags, + abi_ulong new_addr); +int target_msync(abi_ulong start, abi_ulong len, int flags); /* user access */ @@ -260,7 +270,7 @@ int target_msync(target_ulong start, target_ulong len, int flags); /* Lock an area of guest memory into the host. If copy is true then the host area will have the same contents as the guest. */ -static inline void *lock_user(target_ulong guest_addr, long len, int copy) +static inline void *lock_user(abi_ulong guest_addr, long len, int copy) { #ifdef DEBUG_REMAP void *addr; @@ -277,8 +287,8 @@ static inline void *lock_user(target_ulong guest_addr, long len, int copy) /* Unlock an area of guest memory. The first LEN bytes must be flushed back to guest memory. */ -static inline void unlock_user(void *host_addr, target_ulong guest_addr, - long len) +static inline void unlock_user(void *host_addr, abi_ulong guest_addr, + long len) { #ifdef DEBUG_REMAP if (host_addr == g2h(guest_addr)) @@ -290,13 +300,13 @@ static inline void unlock_user(void *host_addr, target_ulong guest_addr, } /* Return the length of a string in target memory. */ -static inline int target_strlen(target_ulong ptr) +static inline int target_strlen(abi_ulong ptr) { return strlen(g2h(ptr)); } /* Like lock_user but for null terminated strings. */ -static inline void *lock_user_string(target_ulong guest_addr) +static inline void *lock_user_string(abi_ulong guest_addr) { long len; len = target_strlen(guest_addr) + 1; @@ -317,7 +327,7 @@ static inline void *lock_user_string(target_ulong guest_addr) #define tput32(addr, val) stl(addr, val) #define tget64(addr) ldq(addr) #define tput64(addr, val) stq(addr, val) -#if TARGET_LONG_BITS == 64 +#if TARGET_ABI_BITS == 64 #define tgetl(addr) ldq(addr) #define tputl(addr, val) stq(addr, val) #else diff --git a/linux-user/sh4/target_signal.h b/linux-user/sh4/target_signal.h index e210e7a..1fb7092 100644 --- a/linux-user/sh4/target_signal.h +++ b/linux-user/sh4/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; diff --git a/linux-user/signal.c b/linux-user/signal.c index 52041da..cacbc69 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -26,8 +26,8 @@ #include <errno.h> #include <sys/ucontext.h> -#include "target_signal.h" #include "qemu.h" +#include "target_signal.h" //#define DEBUG_SIGNAL @@ -134,12 +134,12 @@ static void host_to_target_sigset_internal(target_sigset_t *d, if (sigmask & (1 << i)) target_sigmask |= 1 << (host_to_target_signal(i + 1) - 1); } -#if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32 +#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 32 d->sig[0] = target_sigmask; for(i = 1;i < TARGET_NSIG_WORDS; i++) { d->sig[i] = ((unsigned long *)s)[i]; } -#elif TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 64 && TARGET_NSIG_WORDS == 2 +#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 && TARGET_NSIG_WORDS == 2 d->sig[0] = target_sigmask; d->sig[1] = sigmask >> 32; #else @@ -161,7 +161,7 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s) { int i; unsigned long sigmask; - target_ulong target_sigmask; + abi_ulong target_sigmask; target_sigmask = s->sig[0]; sigmask = 0; @@ -169,16 +169,16 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s) if (target_sigmask & (1 << i)) sigmask |= 1 << (target_to_host_signal(i + 1) - 1); } -#if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32 +#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 32 ((unsigned long *)d)[0] = sigmask; for(i = 1;i < TARGET_NSIG_WORDS; i++) { ((unsigned long *)d)[i] = s->sig[i]; } -#elif TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 64 && TARGET_NSIG_WORDS == 2 +#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 && TARGET_NSIG_WORDS == 2 ((unsigned long *)d)[0] = sigmask | ((unsigned long)(s->sig[1]) << 32); #else #warning target_to_host_sigset -#endif /* TARGET_LONG_BITS */ +#endif /* TARGET_ABI_BITS */ } void target_to_host_sigset(sigset_t *d, const target_sigset_t *s) @@ -191,7 +191,7 @@ void target_to_host_sigset(sigset_t *d, const target_sigset_t *s) target_to_host_sigset_internal(d, &s1); } -void host_to_target_old_sigset(target_ulong *old_sigset, +void host_to_target_old_sigset(abi_ulong *old_sigset, const sigset_t *sigset) { target_sigset_t d; @@ -200,7 +200,7 @@ void host_to_target_old_sigset(target_ulong *old_sigset, } void target_to_host_old_sigset(sigset_t *sigset, - const target_ulong *old_sigset) + const abi_ulong *old_sigset) { target_sigset_t d; int i; @@ -233,7 +233,7 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, tinfo->_sifields._rt._uid = info->si_uid; /* XXX: potential problem if 64 bit */ tinfo->_sifields._rt._sigval.sival_ptr = - (target_ulong)info->si_value.sival_ptr; + (abi_ulong)info->si_value.sival_ptr; } } @@ -355,7 +355,7 @@ int queue_signal(int sig, target_siginfo_t *info) { struct emulated_sigaction *k; struct sigqueue *q, **pq; - target_ulong handler; + abi_ulong handler; #if defined(DEBUG_SIGNAL) fprintf(stderr, "queue_signal: sig=%d\n", @@ -440,7 +440,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info, int do_sigaltstack(const struct target_sigaltstack *uss, struct target_sigaltstack *uoss, - target_ulong sp) + abi_ulong sp) { int ret; struct target_sigaltstack oss; @@ -579,29 +579,29 @@ struct target_fpxreg { }; struct target_xmmreg { - target_ulong element[4]; + abi_ulong element[4]; }; struct target_fpstate { /* Regular FPU environment */ - target_ulong cw; - target_ulong sw; - target_ulong tag; - target_ulong ipoff; - target_ulong cssel; - target_ulong dataoff; - target_ulong datasel; + abi_ulong cw; + abi_ulong sw; + abi_ulong tag; + abi_ulong ipoff; + abi_ulong cssel; + abi_ulong dataoff; + abi_ulong datasel; struct target_fpreg _st[8]; uint16_t status; uint16_t magic; /* 0xffff = regular FPU data only */ /* FXSR FPU environment */ - target_ulong _fxsr_env[6]; /* FXSR FPU env is ignored */ - target_ulong mxcsr; - target_ulong reserved; + abi_ulong _fxsr_env[6]; /* FXSR FPU env is ignored */ + abi_ulong mxcsr; + abi_ulong reserved; struct target_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ struct target_xmmreg _xmm[8]; - target_ulong padding[56]; + abi_ulong padding[56]; }; #define X86_FXSR_MAGIC 0x0000 @@ -611,29 +611,29 @@ struct target_sigcontext { uint16_t fs, __fsh; uint16_t es, __esh; uint16_t ds, __dsh; - target_ulong edi; - target_ulong esi; - target_ulong ebp; - target_ulong esp; - target_ulong ebx; - target_ulong edx; - target_ulong ecx; - target_ulong eax; - target_ulong trapno; - target_ulong err; - target_ulong eip; + abi_ulong edi; + abi_ulong esi; + abi_ulong ebp; + abi_ulong esp; + abi_ulong ebx; + abi_ulong edx; + abi_ulong ecx; + abi_ulong eax; + abi_ulong trapno; + abi_ulong err; + abi_ulong eip; uint16_t cs, __csh; - target_ulong eflags; - target_ulong esp_at_signal; + abi_ulong eflags; + abi_ulong esp_at_signal; uint16_t ss, __ssh; - target_ulong fpstate; /* pointer */ - target_ulong oldmask; - target_ulong cr2; + abi_ulong fpstate; /* pointer */ + abi_ulong oldmask; + abi_ulong cr2; }; struct target_ucontext { - target_ulong tuc_flags; - target_ulong tuc_link; + abi_ulong tuc_flags; + abi_ulong tuc_link; target_stack_t tuc_stack; struct target_sigcontext tuc_mcontext; target_sigset_t tuc_sigmask; /* mask last for extensibility */ @@ -641,20 +641,20 @@ struct target_ucontext { struct sigframe { - target_ulong pretcode; + abi_ulong pretcode; int sig; struct target_sigcontext sc; struct target_fpstate fpstate; - target_ulong extramask[TARGET_NSIG_WORDS-1]; + abi_ulong extramask[TARGET_NSIG_WORDS-1]; char retcode[8]; }; struct rt_sigframe { - target_ulong pretcode; + abi_ulong pretcode; int sig; - target_ulong pinfo; - target_ulong puc; + abi_ulong pinfo; + abi_ulong puc; struct target_siginfo info; struct target_ucontext uc; struct target_fpstate fpstate; @@ -813,8 +813,8 @@ static void setup_rt_frame(int sig, struct emulated_sigaction *ka, ? current->exec_domain->signal_invmap[sig] : */sig), &frame->sig); - err |= __put_user((target_ulong)&frame->info, &frame->pinfo); - err |= __put_user((target_ulong)&frame->uc, &frame->puc); + err |= __put_user((abi_ulong)&frame->info, &frame->pinfo); + err |= __put_user((abi_ulong)&frame->uc, &frame->puc); err |= copy_siginfo_to_user(&frame->info, info); if (err) goto give_sigsegv; @@ -977,32 +977,32 @@ badframe: #elif defined(TARGET_ARM) struct target_sigcontext { - target_ulong trap_no; - target_ulong error_code; - target_ulong oldmask; - target_ulong arm_r0; - target_ulong arm_r1; - target_ulong arm_r2; - target_ulong arm_r3; - target_ulong arm_r4; - target_ulong arm_r5; - target_ulong arm_r6; - target_ulong arm_r7; - target_ulong arm_r8; - target_ulong arm_r9; - target_ulong arm_r10; - target_ulong arm_fp; - target_ulong arm_ip; - target_ulong arm_sp; - target_ulong arm_lr; - target_ulong arm_pc; - target_ulong arm_cpsr; - target_ulong fault_address; + abi_ulong trap_no; + abi_ulong error_code; + abi_ulong oldmask; + abi_ulong arm_r0; + abi_ulong arm_r1; + abi_ulong arm_r2; + abi_ulong arm_r3; + abi_ulong arm_r4; + abi_ulong arm_r5; + abi_ulong arm_r6; + abi_ulong arm_r7; + abi_ulong arm_r8; + abi_ulong arm_r9; + abi_ulong arm_r10; + abi_ulong arm_fp; + abi_ulong arm_ip; + abi_ulong arm_sp; + abi_ulong arm_lr; + abi_ulong arm_pc; + abi_ulong arm_cpsr; + abi_ulong fault_address; }; struct target_ucontext { - target_ulong tuc_flags; - target_ulong tuc_link; + abi_ulong tuc_flags; + abi_ulong tuc_link; target_stack_t tuc_stack; struct target_sigcontext tuc_mcontext; target_sigset_t tuc_sigmask; /* mask last for extensibility */ @@ -1011,8 +1011,8 @@ struct target_ucontext { struct sigframe { struct target_sigcontext sc; - target_ulong extramask[TARGET_NSIG_WORDS-1]; - target_ulong retcode; + abi_ulong extramask[TARGET_NSIG_WORDS-1]; + abi_ulong retcode; }; struct rt_sigframe @@ -1021,7 +1021,7 @@ struct rt_sigframe void *puc; struct target_siginfo info; struct target_ucontext uc; - target_ulong retcode; + abi_ulong retcode; }; #define TARGET_CONFIG_CPU_32 1 @@ -1039,7 +1039,7 @@ struct rt_sigframe #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_sigreturn)) #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_rt_sigreturn)) -static const target_ulong retcodes[4] = { +static const abi_ulong retcodes[4] = { SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN }; @@ -1105,14 +1105,14 @@ get_sigframe(struct emulated_sigaction *ka, CPUState *regs, int framesize) static int setup_return(CPUState *env, struct emulated_sigaction *ka, - target_ulong *rc, void *frame, int usig) + abi_ulong *rc, void *frame, int usig) { - target_ulong handler = (target_ulong)ka->sa._sa_handler; - target_ulong retcode; + abi_ulong handler = (abi_ulong)ka->sa._sa_handler; + abi_ulong retcode; int thumb = 0; #if defined(TARGET_CONFIG_CPU_32) #if 0 - target_ulong cpsr = env->cpsr; + abi_ulong cpsr = env->cpsr; /* * Maybe we need to deliver a 32-bit signal to a 26-bit task. @@ -1138,7 +1138,7 @@ setup_return(CPUState *env, struct emulated_sigaction *ka, #endif /* TARGET_CONFIG_CPU_32 */ if (ka->sa.sa_flags & TARGET_SA_RESTORER) { - retcode = (target_ulong)ka->sa.sa_restorer; + retcode = (abi_ulong)ka->sa.sa_restorer; } else { unsigned int idx = thumb; @@ -1148,10 +1148,10 @@ setup_return(CPUState *env, struct emulated_sigaction *ka, if (__put_user(retcodes[idx], rc)) return 1; #if 0 - flush_icache_range((target_ulong)rc, - (target_ulong)(rc + 1)); + flush_icache_range((abi_ulong)rc, + (abi_ulong)(rc + 1)); #endif - retcode = ((target_ulong)rc) + thumb; + retcode = ((abi_ulong)rc) + thumb; } env->regs[0] = usig; @@ -1197,8 +1197,8 @@ static void setup_rt_frame(int usig, struct emulated_sigaction *ka, if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) return /* 1 */; - __put_user_error(&frame->info, (target_ulong *)&frame->pinfo, err); - __put_user_error(&frame->uc, (target_ulong *)&frame->puc, err); + __put_user_error(&frame->info, (abi_ulong *)&frame->pinfo, err); + __put_user_error(&frame->uc, (abi_ulong *)&frame->puc, err); err |= copy_siginfo_to_user(&frame->info, info); /* Clear all the bits of the ucontext we don't use. */ @@ -1229,8 +1229,8 @@ static void setup_rt_frame(int usig, struct emulated_sigaction *ka, * arguments for the signal handler. * -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06 */ - env->regs[1] = (target_ulong)frame->pinfo; - env->regs[2] = (target_ulong)frame->puc; + env->regs[1] = (abi_ulong)frame->pinfo; + env->regs[2] = (abi_ulong)frame->puc; } // return err; @@ -1360,48 +1360,48 @@ badframe: /* This is what SunOS does, so shall I. */ struct target_sigcontext { - target_ulong sigc_onstack; /* state to restore */ + abi_ulong sigc_onstack; /* state to restore */ - target_ulong sigc_mask; /* sigmask to restore */ - target_ulong sigc_sp; /* stack pointer */ - target_ulong sigc_pc; /* program counter */ - target_ulong sigc_npc; /* next program counter */ - target_ulong sigc_psr; /* for condition codes etc */ - target_ulong sigc_g1; /* User uses these two registers */ - target_ulong sigc_o0; /* within the trampoline code. */ + abi_ulong sigc_mask; /* sigmask to restore */ + abi_ulong sigc_sp; /* stack pointer */ + abi_ulong sigc_pc; /* program counter */ + abi_ulong sigc_npc; /* next program counter */ + abi_ulong sigc_psr; /* for condition codes etc */ + abi_ulong sigc_g1; /* User uses these two registers */ + abi_ulong sigc_o0; /* within the trampoline code. */ /* Now comes information regarding the users window set * at the time of the signal. */ - target_ulong sigc_oswins; /* outstanding windows */ + abi_ulong sigc_oswins; /* outstanding windows */ /* stack ptrs for each regwin buf */ char *sigc_spbuf[__SUNOS_MAXWIN]; /* Windows to restore after signal */ struct { - target_ulong locals[8]; - target_ulong ins[8]; + abi_ulong locals[8]; + abi_ulong ins[8]; } sigc_wbuf[__SUNOS_MAXWIN]; }; /* A Sparc stack frame */ struct sparc_stackf { - target_ulong locals[8]; - target_ulong ins[6]; + abi_ulong locals[8]; + abi_ulong ins[6]; struct sparc_stackf *fp; - target_ulong callers_pc; + abi_ulong callers_pc; char *structptr; - target_ulong xargs[6]; - target_ulong xxargs[1]; + abi_ulong xargs[6]; + abi_ulong xxargs[1]; }; typedef struct { struct { - target_ulong psr; - target_ulong pc; - target_ulong npc; - target_ulong y; - target_ulong u_regs[16]; /* globals and ins */ + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; /* globals and ins */ } si_regs; int si_mask; } __siginfo_t; @@ -1421,15 +1421,15 @@ struct target_signal_frame { struct sparc_stackf ss; __siginfo_t info; qemu_siginfo_fpu_t *fpu_save; - target_ulong insns[2] __attribute__ ((aligned (8))); - target_ulong extramask[TARGET_NSIG_WORDS - 1]; - target_ulong extra_size; /* Should be 0 */ + abi_ulong insns[2] __attribute__ ((aligned (8))); + abi_ulong extramask[TARGET_NSIG_WORDS - 1]; + abi_ulong extra_size; /* Should be 0 */ qemu_siginfo_fpu_t fpu_state; }; struct target_rt_signal_frame { struct sparc_stackf ss; siginfo_t info; - target_ulong regs[20]; + abi_ulong regs[20]; sigset_t mask; qemu_siginfo_fpu_t *fpu_save; unsigned int insns[2]; @@ -1468,7 +1468,7 @@ static inline void *get_sigframe(struct emulated_sigaction *sa, CPUState *env, u } static int -setup___siginfo(__siginfo_t *si, CPUState *env, target_ulong mask) +setup___siginfo(__siginfo_t *si, CPUState *env, abi_ulong mask) { int err = 0, i; @@ -1634,7 +1634,7 @@ long do_sigreturn(CPUState *env) uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; - target_ulong fpu_save; + abi_ulong fpu_save; int err, i; sf = (struct target_signal_frame *)g2h(env->regwptr[UREG_FP]); @@ -1676,7 +1676,7 @@ long do_sigreturn(CPUState *env) err |= __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } - err |= __get_user(fpu_save, (target_ulong *)&sf->fpu_save); + err |= __get_user(fpu_save, (abi_ulong *)&sf->fpu_save); //if (fpu_save) // err |= restore_fpu_state(env, fpu_save); @@ -1729,11 +1729,11 @@ long do_rt_sigreturn(CPUState *env) #define MC_O7 18 #define MC_NGREG 19 -typedef target_ulong target_mc_greg_t; +typedef abi_ulong target_mc_greg_t; typedef target_mc_greg_t target_mc_gregset_t[MC_NGREG]; struct target_mc_fq { - target_ulong *mcfq_addr; + abi_ulong *mcfq_addr; uint32_t mcfq_insn; }; @@ -1743,9 +1743,9 @@ struct target_mc_fpu { uint64_t dregs[32]; //uint128_t qregs[16]; } mcfpu_fregs; - target_ulong mcfpu_fsr; - target_ulong mcfpu_fprs; - target_ulong mcfpu_gsr; + abi_ulong mcfpu_fsr; + abi_ulong mcfpu_fprs; + abi_ulong mcfpu_gsr; struct target_mc_fq *mcfpu_fq; unsigned char mcfpu_qcnt; unsigned char mcfpu_qentsz; @@ -1762,15 +1762,15 @@ typedef struct { struct target_ucontext { struct target_ucontext *uc_link; - target_ulong uc_flags; + abi_ulong uc_flags; target_sigset_t uc_sigmask; target_mcontext_t uc_mcontext; }; /* A V9 register window */ struct target_reg_window { - target_ulong locals[8]; - target_ulong ins[8]; + abi_ulong locals[8]; + abi_ulong ins[8]; }; #define TARGET_STACK_BIAS 2047 @@ -1781,12 +1781,12 @@ void sparc64_set_context(CPUSPARCState *env) struct target_ucontext *ucp = (struct target_ucontext *) env->regwptr[UREG_I0]; target_mc_gregset_t *grp; - target_ulong pc, npc, tstate; - target_ulong fp, i7; + abi_ulong pc, npc, tstate; + abi_ulong fp, i7; unsigned char fenab; int err; unsigned int i; - target_ulong *src, *dst; + abi_ulong *src, *dst; grp = &ucp->uc_mcontext.mc_gregs; err = get_user(pc, &((*grp)[MC_PC])); @@ -1803,7 +1803,7 @@ void sparc64_set_context(CPUSPARCState *env) } else { src = &ucp->uc_sigmask; dst = &target_set; - for (i = 0; i < sizeof(target_sigset_t) / sizeof(target_ulong); + for (i = 0; i < sizeof(target_sigset_t) / sizeof(abi_ulong); i++, dst++, src++) err |= get_user(dst, src); if (err) @@ -1866,10 +1866,10 @@ void sparc64_get_context(CPUSPARCState *env) env->regwptr[UREG_I0]; target_mc_gregset_t *grp; target_mcontext_t *mcp; - target_ulong fp, i7; + abi_ulong fp, i7; int err; unsigned int i; - target_ulong *src, *dst; + abi_ulong *src, *dst; target_sigset_t target_set; sigset_t set; @@ -1886,11 +1886,11 @@ void sparc64_get_context(CPUSPARCState *env) host_to_target_sigset_internal(&target_set, &set); if (TARGET_NSIG_WORDS == 1) err |= put_user(target_set.sig[0], - (target_ulong *)&ucp->uc_sigmask); + (abi_ulong *)&ucp->uc_sigmask); else { src = &target_set; dst = &ucp->uc_sigmask; - for (i = 0; i < sizeof(target_sigset_t) / sizeof(target_ulong); + for (i = 0; i < sizeof(target_sigset_t) / sizeof(abi_ulong); i++, dst++, src++) err |= put_user(src, dst); if (err) @@ -2354,7 +2354,7 @@ long do_rt_sigreturn(CPUState *env) void process_pending_signals(void *cpu_env) { int sig; - target_ulong handler; + abi_ulong handler; sigset_t set, old_set; target_sigset_t target_old_set; struct emulated_sigaction *k; diff --git a/linux-user/sparc/syscall.h b/linux-user/sparc/syscall.h index 5be90fa..5a9bb7e 100644 --- a/linux-user/sparc/syscall.h +++ b/linux-user/sparc/syscall.h @@ -1,9 +1,9 @@ struct target_pt_regs { - target_ulong psr; - target_ulong pc; - target_ulong npc; - target_ulong y; - target_ulong u_regs[16]; + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; }; #define UNAME_MACHINE "sun4" diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index dfca129..c7de300 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -28,7 +28,7 @@ typedef struct target_sigaltstack { #define UREG_FP UREG_I6 #endif -static inline target_ulong get_sp_from_cpustate(CPUSPARCState *state) +static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) { return state->regwptr[UREG_FP]; } diff --git a/linux-user/sparc64/syscall.h b/linux-user/sparc64/syscall.h index c361558..81a816d 100644 --- a/linux-user/sparc64/syscall.h +++ b/linux-user/sparc64/syscall.h @@ -1,10 +1,10 @@ struct target_pt_regs { - target_ulong u_regs[16]; - target_ulong tstate; - target_ulong pc; - target_ulong npc; - target_ulong y; - target_ulong fprs; + abi_ulong u_regs[16]; + abi_ulong tstate; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong fprs; }; #define UNAME_MACHINE "sun4u" diff --git a/linux-user/sparc64/target_signal.h b/linux-user/sparc64/target_signal.h index dfca129..c7de300 100644 --- a/linux-user/sparc64/target_signal.h +++ b/linux-user/sparc64/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -28,7 +28,7 @@ typedef struct target_sigaltstack { #define UREG_FP UREG_I6 #endif -static inline target_ulong get_sp_from_cpustate(CPUSPARCState *state) +static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) { return state->regwptr[UREG_FP]; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a1d9ee1..e4ea313 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -368,7 +368,7 @@ static inline int host_to_target_errno(int err) return err; } -static inline target_long get_errno(target_long ret) +static inline abi_long get_errno(abi_long ret) { if (ret == -1) return -host_to_target_errno(errno); @@ -376,23 +376,23 @@ static inline target_long get_errno(target_long ret) return ret; } -static inline int is_error(target_long ret) +static inline int is_error(abi_long ret) { - return (target_ulong)ret >= (target_ulong)(-4096); + return (abi_ulong)ret >= (abi_ulong)(-4096); } -static target_ulong target_brk; -static target_ulong target_original_brk; +static abi_ulong target_brk; +static abi_ulong target_original_brk; -void target_set_brk(target_ulong new_brk) +void target_set_brk(abi_ulong new_brk) { target_original_brk = target_brk = HOST_PAGE_ALIGN(new_brk); } -target_long do_brk(target_ulong new_brk) +abi_long do_brk(abi_ulong new_brk) { - target_ulong brk_page; - target_long mapped_addr; + abi_ulong brk_page; + abi_long mapped_addr; int new_alloc_size; if (!new_brk) @@ -422,7 +422,7 @@ target_long do_brk(target_ulong new_brk) } static inline fd_set *target_to_host_fds(fd_set *fds, - target_long *target_fds, int n) + abi_long *target_fds, int n) { #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN) return (fd_set *)target_fds; @@ -431,8 +431,8 @@ static inline fd_set *target_to_host_fds(fd_set *fds, if (target_fds) { FD_ZERO(fds); for(i = 0;i < n; i++) { - b = (tswapl(target_fds[i / TARGET_LONG_BITS]) >> - (i & (TARGET_LONG_BITS - 1))) & 1; + b = (tswapl(target_fds[i / TARGET_ABI_BITS]) >> + (i & (TARGET_ABI_BITS - 1))) & 1; if (b) FD_SET(i, fds); } @@ -443,21 +443,21 @@ static inline fd_set *target_to_host_fds(fd_set *fds, #endif } -static inline void host_to_target_fds(target_long *target_fds, +static inline void host_to_target_fds(abi_long *target_fds, fd_set *fds, int n) { #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN) /* nothing to do */ #else int i, nw, j, k; - target_long v; + abi_long v; if (target_fds) { - nw = (n + TARGET_LONG_BITS - 1) / TARGET_LONG_BITS; + nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; k = 0; for(i = 0;i < nw; i++) { v = 0; - for(j = 0; j < TARGET_LONG_BITS; j++) { + for(j = 0; j < TARGET_ABI_BITS; j++) { v |= ((FD_ISSET(k, fds) != 0) << j); k++; } @@ -473,7 +473,7 @@ static inline void host_to_target_fds(target_long *target_fds, #define HOST_HZ 100 #endif -static inline target_long host_to_target_clock_t(long ticks) +static inline abi_long host_to_target_clock_t(long ticks) { #if HOST_HZ == TARGET_HZ return ticks; @@ -482,7 +482,7 @@ static inline target_long host_to_target_clock_t(long ticks) #endif } -static inline void host_to_target_rusage(target_ulong target_addr, +static inline void host_to_target_rusage(abi_ulong target_addr, const struct rusage *rusage) { struct target_rusage *target_rusage; @@ -510,7 +510,7 @@ static inline void host_to_target_rusage(target_ulong target_addr, } static inline void target_to_host_timeval(struct timeval *tv, - target_ulong target_addr) + abi_ulong target_addr) { struct target_timeval *target_tv; @@ -520,7 +520,7 @@ static inline void target_to_host_timeval(struct timeval *tv, unlock_user_struct(target_tv, target_addr, 0); } -static inline void host_to_target_timeval(target_ulong target_addr, +static inline void host_to_target_timeval(abi_ulong target_addr, const struct timeval *tv) { struct target_timeval *target_tv; @@ -532,33 +532,33 @@ static inline void host_to_target_timeval(target_ulong target_addr, } -static target_long do_select(int n, - target_ulong rfd_p, target_ulong wfd_p, - target_ulong efd_p, target_ulong target_tv) +static abi_long do_select(int n, + abi_ulong rfd_p, abi_ulong wfd_p, + abi_ulong efd_p, abi_ulong target_tv) { fd_set rfds, wfds, efds; fd_set *rfds_ptr, *wfds_ptr, *efds_ptr; - target_long *target_rfds, *target_wfds, *target_efds; + abi_long *target_rfds, *target_wfds, *target_efds; struct timeval tv, *tv_ptr; - target_long ret; + abi_long ret; int ok; if (rfd_p) { - target_rfds = lock_user(rfd_p, sizeof(target_long) * n, 1); + target_rfds = lock_user(rfd_p, sizeof(abi_long) * n, 1); rfds_ptr = target_to_host_fds(&rfds, target_rfds, n); } else { target_rfds = NULL; rfds_ptr = NULL; } if (wfd_p) { - target_wfds = lock_user(wfd_p, sizeof(target_long) * n, 1); + target_wfds = lock_user(wfd_p, sizeof(abi_long) * n, 1); wfds_ptr = target_to_host_fds(&wfds, target_wfds, n); } else { target_wfds = NULL; wfds_ptr = NULL; } if (efd_p) { - target_efds = lock_user(efd_p, sizeof(target_long) * n, 1); + target_efds = lock_user(efd_p, sizeof(abi_long) * n, 1); efds_ptr = target_to_host_fds(&efds, target_efds, n); } else { target_efds = NULL; @@ -584,17 +584,17 @@ static target_long do_select(int n, } } if (target_rfds) - unlock_user(target_rfds, rfd_p, ok ? sizeof(target_long) * n : 0); + unlock_user(target_rfds, rfd_p, ok ? sizeof(abi_long) * n : 0); if (target_wfds) - unlock_user(target_wfds, wfd_p, ok ? sizeof(target_long) * n : 0); + unlock_user(target_wfds, wfd_p, ok ? sizeof(abi_long) * n : 0); if (target_efds) - unlock_user(target_efds, efd_p, ok ? sizeof(target_long) * n : 0); + unlock_user(target_efds, efd_p, ok ? sizeof(abi_long) * n : 0); return ret; } static inline void target_to_host_sockaddr(struct sockaddr *addr, - target_ulong target_addr, + abi_ulong target_addr, socklen_t len) { struct target_sockaddr *target_saddr; @@ -605,7 +605,7 @@ static inline void target_to_host_sockaddr(struct sockaddr *addr, unlock_user(target_saddr, target_addr, 0); } -static inline void host_to_target_sockaddr(target_ulong target_addr, +static inline void host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr, socklen_t len) { @@ -706,10 +706,10 @@ static inline void host_to_target_cmsg(struct target_msghdr *target_msgh, msgh->msg_controllen = tswapl(space); } -static target_long do_setsockopt(int sockfd, int level, int optname, - target_ulong optval, socklen_t optlen) +static abi_long do_setsockopt(int sockfd, int level, int optname, + abi_ulong optval, socklen_t optlen) { - target_long ret; + abi_long ret; int val; switch(level) { @@ -827,10 +827,10 @@ static target_long do_setsockopt(int sockfd, int level, int optname, return ret; } -static target_long do_getsockopt(int sockfd, int level, int optname, - target_ulong optval, target_ulong optlen) +static abi_long do_getsockopt(int sockfd, int level, int optname, + abi_ulong optval, abi_ulong optlen) { - target_long ret; + abi_long ret; int len, lv, val; switch(level) { @@ -916,11 +916,11 @@ static target_long do_getsockopt(int sockfd, int level, int optname, return ret; } -static void lock_iovec(struct iovec *vec, target_ulong target_addr, +static void lock_iovec(struct iovec *vec, abi_ulong target_addr, int count, int copy) { struct target_iovec *target_vec; - target_ulong base; + abi_ulong base; int i; target_vec = lock_user(target_addr, count * sizeof(struct target_iovec), 1); @@ -932,11 +932,11 @@ static void lock_iovec(struct iovec *vec, target_ulong target_addr, unlock_user (target_vec, target_addr, 0); } -static void unlock_iovec(struct iovec *vec, target_ulong target_addr, +static void unlock_iovec(struct iovec *vec, abi_ulong target_addr, int count, int copy) { struct target_iovec *target_vec; - target_ulong base; + abi_ulong base; int i; target_vec = lock_user(target_addr, count * sizeof(struct target_iovec), 1); @@ -947,7 +947,7 @@ static void unlock_iovec(struct iovec *vec, target_ulong target_addr, unlock_user (target_vec, target_addr, 0); } -static target_long do_socket(int domain, int type, int protocol) +static abi_long do_socket(int domain, int type, int protocol) { #if defined(TARGET_MIPS) switch(type) { @@ -974,8 +974,8 @@ static target_long do_socket(int domain, int type, int protocol) return get_errno(socket(domain, type, protocol)); } -static target_long do_bind(int sockfd, target_ulong target_addr, - socklen_t addrlen) +static abi_long do_bind(int sockfd, abi_ulong target_addr, + socklen_t addrlen) { void *addr = alloca(addrlen); @@ -983,8 +983,8 @@ static target_long do_bind(int sockfd, target_ulong target_addr, return get_errno(bind(sockfd, addr, addrlen)); } -static target_long do_connect(int sockfd, target_ulong target_addr, - socklen_t addrlen) +static abi_long do_connect(int sockfd, abi_ulong target_addr, + socklen_t addrlen) { void *addr = alloca(addrlen); @@ -992,15 +992,15 @@ static target_long do_connect(int sockfd, target_ulong target_addr, return get_errno(connect(sockfd, addr, addrlen)); } -static target_long do_sendrecvmsg(int fd, target_ulong target_msg, - int flags, int send) +static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, + int flags, int send) { - target_long ret; + abi_long ret; struct target_msghdr *msgp; struct msghdr msg; int count; struct iovec *vec; - target_ulong target_vec; + abi_ulong target_vec; lock_user_struct(msgp, target_msg, 1); if (msgp->msg_name) { @@ -1035,12 +1035,12 @@ static target_long do_sendrecvmsg(int fd, target_ulong target_msg, return ret; } -static target_long do_accept(int fd, target_ulong target_addr, - target_ulong target_addrlen) +static abi_long do_accept(int fd, abi_ulong target_addr, + abi_ulong target_addrlen) { socklen_t addrlen = tget32(target_addrlen); void *addr = alloca(addrlen); - target_long ret; + abi_long ret; ret = get_errno(accept(fd, addr, &addrlen)); if (!is_error(ret)) { @@ -1050,12 +1050,12 @@ static target_long do_accept(int fd, target_ulong target_addr, return ret; } -static target_long do_getpeername(int fd, target_ulong target_addr, - target_ulong target_addrlen) +static abi_long do_getpeername(int fd, abi_ulong target_addr, + abi_ulong target_addrlen) { socklen_t addrlen = tget32(target_addrlen); void *addr = alloca(addrlen); - target_long ret; + abi_long ret; ret = get_errno(getpeername(fd, addr, &addrlen)); if (!is_error(ret)) { @@ -1065,12 +1065,12 @@ static target_long do_getpeername(int fd, target_ulong target_addr, return ret; } -static target_long do_getsockname(int fd, target_ulong target_addr, - target_ulong target_addrlen) +static abi_long do_getsockname(int fd, abi_ulong target_addr, + abi_ulong target_addrlen) { socklen_t addrlen = tget32(target_addrlen); void *addr = alloca(addrlen); - target_long ret; + abi_long ret; ret = get_errno(getsockname(fd, addr, &addrlen)); if (!is_error(ret)) { @@ -1080,11 +1080,11 @@ static target_long do_getsockname(int fd, target_ulong target_addr, return ret; } -static target_long do_socketpair(int domain, int type, int protocol, - target_ulong target_tab) +static abi_long do_socketpair(int domain, int type, int protocol, + abi_ulong target_tab) { int tab[2]; - target_long ret; + abi_long ret; ret = get_errno(socketpair(domain, type, protocol, tab)); if (!is_error(ret)) { @@ -1094,12 +1094,12 @@ static target_long do_socketpair(int domain, int type, int protocol, return ret; } -static target_long do_sendto(int fd, target_ulong msg, size_t len, int flags, - target_ulong target_addr, socklen_t addrlen) +static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, + abi_ulong target_addr, socklen_t addrlen) { void *addr; void *host_msg; - target_long ret; + abi_long ret; host_msg = lock_user(msg, len, 1); if (target_addr) { @@ -1113,14 +1113,14 @@ static target_long do_sendto(int fd, target_ulong msg, size_t len, int flags, return ret; } -static target_long do_recvfrom(int fd, target_ulong msg, size_t len, int flags, - target_ulong target_addr, - target_ulong target_addrlen) +static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags, + abi_ulong target_addr, + abi_ulong target_addrlen) { socklen_t addrlen; void *addr; void *host_msg; - target_long ret; + abi_long ret; host_msg = lock_user(msg, len, 0); if (target_addr) { @@ -1144,10 +1144,10 @@ static target_long do_recvfrom(int fd, target_ulong msg, size_t len, int flags, } #ifdef TARGET_NR_socketcall -static target_long do_socketcall(int num, target_ulong vptr) +static abi_long do_socketcall(int num, abi_ulong vptr) { - target_long ret; - const int n = sizeof(target_ulong); + abi_long ret; + const int n = sizeof(abi_ulong); switch(num) { case SOCKOP_socket: @@ -1161,7 +1161,7 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_bind: { int sockfd = tgetl(vptr); - target_ulong target_addr = tgetl(vptr + n); + abi_ulong target_addr = tgetl(vptr + n); socklen_t addrlen = tgetl(vptr + 2 * n); ret = do_bind(sockfd, target_addr, addrlen); } @@ -1169,7 +1169,7 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_connect: { int sockfd = tgetl(vptr); - target_ulong target_addr = tgetl(vptr + n); + abi_ulong target_addr = tgetl(vptr + n); socklen_t addrlen = tgetl(vptr + 2 * n); ret = do_connect(sockfd, target_addr, addrlen); } @@ -1184,24 +1184,24 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_accept: { int sockfd = tgetl(vptr); - target_ulong target_addr = tgetl(vptr + n); - target_ulong target_addrlen = tgetl(vptr + 2 * n); + abi_ulong target_addr = tgetl(vptr + n); + abi_ulong target_addrlen = tgetl(vptr + 2 * n); ret = do_accept(sockfd, target_addr, target_addrlen); } break; case SOCKOP_getsockname: { int sockfd = tgetl(vptr); - target_ulong target_addr = tgetl(vptr + n); - target_ulong target_addrlen = tgetl(vptr + 2 * n); + abi_ulong target_addr = tgetl(vptr + n); + abi_ulong target_addrlen = tgetl(vptr + 2 * n); ret = do_getsockname(sockfd, target_addr, target_addrlen); } break; case SOCKOP_getpeername: { int sockfd = tgetl(vptr); - target_ulong target_addr = tgetl(vptr + n); - target_ulong target_addrlen = tgetl(vptr + 2 * n); + abi_ulong target_addr = tgetl(vptr + n); + abi_ulong target_addrlen = tgetl(vptr + 2 * n); ret = do_getpeername(sockfd, target_addr, target_addrlen); } break; @@ -1210,14 +1210,14 @@ static target_long do_socketcall(int num, target_ulong vptr) int domain = tgetl(vptr); int type = tgetl(vptr + n); int protocol = tgetl(vptr + 2 * n); - target_ulong tab = tgetl(vptr + 3 * n); + abi_ulong tab = tgetl(vptr + 3 * n); ret = do_socketpair(domain, type, protocol, tab); } break; case SOCKOP_send: { int sockfd = tgetl(vptr); - target_ulong msg = tgetl(vptr + n); + abi_ulong msg = tgetl(vptr + n); size_t len = tgetl(vptr + 2 * n); int flags = tgetl(vptr + 3 * n); ret = do_sendto(sockfd, msg, len, flags, 0, 0); @@ -1226,7 +1226,7 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_recv: { int sockfd = tgetl(vptr); - target_ulong msg = tgetl(vptr + n); + abi_ulong msg = tgetl(vptr + n); size_t len = tgetl(vptr + 2 * n); int flags = tgetl(vptr + 3 * n); ret = do_recvfrom(sockfd, msg, len, flags, 0, 0); @@ -1235,10 +1235,10 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_sendto: { int sockfd = tgetl(vptr); - target_ulong msg = tgetl(vptr + n); + abi_ulong msg = tgetl(vptr + n); size_t len = tgetl(vptr + 2 * n); int flags = tgetl(vptr + 3 * n); - target_ulong addr = tgetl(vptr + 4 * n); + abi_ulong addr = tgetl(vptr + 4 * n); socklen_t addrlen = tgetl(vptr + 5 * n); ret = do_sendto(sockfd, msg, len, flags, addr, addrlen); } @@ -1246,11 +1246,11 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_recvfrom: { int sockfd = tgetl(vptr); - target_ulong msg = tgetl(vptr + n); + abi_ulong msg = tgetl(vptr + n); size_t len = tgetl(vptr + 2 * n); int flags = tgetl(vptr + 3 * n); - target_ulong addr = tgetl(vptr + 4 * n); - target_ulong addrlen = tgetl(vptr + 5 * n); + abi_ulong addr = tgetl(vptr + 4 * n); + abi_ulong addrlen = tgetl(vptr + 5 * n); ret = do_recvfrom(sockfd, msg, len, flags, addr, addrlen); } break; @@ -1266,7 +1266,7 @@ static target_long do_socketcall(int num, target_ulong vptr) case SOCKOP_recvmsg: { int fd; - target_ulong target_msg; + abi_ulong target_msg; int flags; fd = tgetl(vptr); @@ -1282,7 +1282,7 @@ static target_long do_socketcall(int num, target_ulong vptr) int sockfd = tgetl(vptr); int level = tgetl(vptr + n); int optname = tgetl(vptr + 2 * n); - target_ulong optval = tgetl(vptr + 3 * n); + abi_ulong optval = tgetl(vptr + 3 * n); socklen_t optlen = tgetl(vptr + 4 * n); ret = do_setsockopt(sockfd, level, optname, optval, optlen); @@ -1293,8 +1293,8 @@ static target_long do_socketcall(int num, target_ulong vptr) int sockfd = tgetl(vptr); int level = tgetl(vptr + n); int optname = tgetl(vptr + 2 * n); - target_ulong optval = tgetl(vptr + 3 * n); - target_ulong poptlen = tgetl(vptr + 4 * n); + abi_ulong optval = tgetl(vptr + 3 * n); + abi_ulong poptlen = tgetl(vptr + 4 * n); ret = do_getsockopt(sockfd, level, optname, optval, poptlen); } @@ -1318,33 +1318,33 @@ static struct shm_region { struct target_ipc_perm { - target_long __key; - target_ulong uid; - target_ulong gid; - target_ulong cuid; - target_ulong cgid; + abi_long __key; + abi_ulong uid; + abi_ulong gid; + abi_ulong cuid; + abi_ulong cgid; unsigned short int mode; unsigned short int __pad1; unsigned short int __seq; unsigned short int __pad2; - target_ulong __unused1; - target_ulong __unused2; + abi_ulong __unused1; + abi_ulong __unused2; }; struct target_semid_ds { struct target_ipc_perm sem_perm; - target_ulong sem_otime; - target_ulong __unused1; - target_ulong sem_ctime; - target_ulong __unused2; - target_ulong sem_nsems; - target_ulong __unused3; - target_ulong __unused4; + abi_ulong sem_otime; + abi_ulong __unused1; + abi_ulong sem_ctime; + abi_ulong __unused2; + abi_ulong sem_nsems; + abi_ulong __unused3; + abi_ulong __unused4; }; static inline void target_to_host_ipc_perm(struct ipc_perm *host_ip, - target_ulong target_addr) + abi_ulong target_addr) { struct target_ipc_perm *target_ip; struct target_semid_ds *target_sd; @@ -1360,7 +1360,7 @@ static inline void target_to_host_ipc_perm(struct ipc_perm *host_ip, unlock_user_struct(target_sd, target_addr, 0); } -static inline void host_to_target_ipc_perm(target_ulong target_addr, +static inline void host_to_target_ipc_perm(abi_ulong target_addr, struct ipc_perm *host_ip) { struct target_ipc_perm *target_ip; @@ -1378,7 +1378,7 @@ static inline void host_to_target_ipc_perm(target_ulong target_addr, } static inline void target_to_host_semid_ds(struct semid_ds *host_sd, - target_ulong target_addr) + abi_ulong target_addr) { struct target_semid_ds *target_sd; @@ -1390,7 +1390,7 @@ static inline void target_to_host_semid_ds(struct semid_ds *host_sd, unlock_user_struct(target_sd, target_addr, 0); } -static inline void host_to_target_semid_ds(target_ulong target_addr, +static inline void host_to_target_semid_ds(abi_ulong target_addr, struct semid_ds *host_sd) { struct target_semid_ds *target_sd; @@ -1411,13 +1411,13 @@ union semun { union target_semun { int val; - target_long buf; + abi_long buf; unsigned short int *array; }; static inline void target_to_host_semun(int cmd, union semun *host_su, - target_ulong target_addr, + abi_ulong target_addr, struct semid_ds *ds) { union target_semun *target_su; @@ -1448,7 +1448,7 @@ static inline void target_to_host_semun(int cmd, } static inline void host_to_target_semun(int cmd, - target_ulong target_addr, + abi_ulong target_addr, union semun *host_su, struct semid_ds *ds) { @@ -1478,13 +1478,13 @@ static inline void host_to_target_semun(int cmd, } } -static inline target_long do_semctl(int first, int second, int third, - target_long ptr) +static inline abi_long do_semctl(int first, int second, int third, + abi_long ptr) { union semun arg; struct semid_ds dsarg; int cmd = third&0xff; - target_long ret = 0; + abi_long ret = 0; switch( cmd ) { case GETVAL: @@ -1527,23 +1527,23 @@ static inline target_long do_semctl(int first, int second, int third, struct target_msqid_ds { struct target_ipc_perm msg_perm; - target_ulong msg_stime; - target_ulong __unused1; - target_ulong msg_rtime; - target_ulong __unused2; - target_ulong msg_ctime; - target_ulong __unused3; - target_ulong __msg_cbytes; - target_ulong msg_qnum; - target_ulong msg_qbytes; - target_ulong msg_lspid; - target_ulong msg_lrpid; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong msg_stime; + abi_ulong __unused1; + abi_ulong msg_rtime; + abi_ulong __unused2; + abi_ulong msg_ctime; + abi_ulong __unused3; + abi_ulong __msg_cbytes; + abi_ulong msg_qnum; + abi_ulong msg_qbytes; + abi_ulong msg_lspid; + abi_ulong msg_lrpid; + abi_ulong __unused4; + abi_ulong __unused5; }; static inline void target_to_host_msqid_ds(struct msqid_ds *host_md, - target_ulong target_addr) + abi_ulong target_addr) { struct target_msqid_ds *target_md; @@ -1560,7 +1560,7 @@ static inline void target_to_host_msqid_ds(struct msqid_ds *host_md, unlock_user_struct(target_md, target_addr, 0); } -static inline void host_to_target_msqid_ds(target_ulong target_addr, +static inline void host_to_target_msqid_ds(abi_ulong target_addr, struct msqid_ds *host_md) { struct target_msqid_ds *target_md; @@ -1578,11 +1578,11 @@ static inline void host_to_target_msqid_ds(target_ulong target_addr, unlock_user_struct(target_md, target_addr, 1); } -static inline target_long do_msgctl(int first, int second, target_long ptr) +static inline abi_long do_msgctl(int first, int second, abi_long ptr) { struct msqid_ds dsarg; int cmd = second&0xff; - target_long ret = 0; + abi_long ret = 0; switch( cmd ) { case IPC_STAT: case IPC_SET: @@ -1596,16 +1596,16 @@ static inline target_long do_msgctl(int first, int second, target_long ptr) } struct target_msgbuf { - target_ulong mtype; + abi_ulong mtype; char mtext[1]; }; -static inline target_long do_msgsnd(int msqid, target_long msgp, - unsigned int msgsz, int msgflg) +static inline abi_long do_msgsnd(int msqid, abi_long msgp, + unsigned int msgsz, int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; - target_long ret = 0; + abi_long ret = 0; lock_user_struct(target_mb,msgp,0); host_mb = malloc(msgsz+sizeof(long)); @@ -1618,13 +1618,13 @@ static inline target_long do_msgsnd(int msqid, target_long msgp, return ret; } -static inline target_long do_msgrcv(int msqid, target_long msgp, - unsigned int msgsz, int msgtype, - int msgflg) +static inline abi_long do_msgrcv(int msqid, abi_long msgp, + unsigned int msgsz, int msgtype, + int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; - target_long ret = 0; + abi_long ret = 0; lock_user_struct(target_mb, msgp, 0); host_mb = malloc(msgsz+sizeof(long)); @@ -1639,12 +1639,12 @@ static inline target_long do_msgrcv(int msqid, target_long msgp, } /* ??? This only works with linear mappings. */ -static target_long do_ipc(unsigned int call, int first, - int second, int third, - target_long ptr, target_long fifth) +static abi_long do_ipc(unsigned int call, int first, + int second, int third, + abi_long ptr, abi_long fifth) { int version; - target_long ret = 0; + abi_long ret = 0; unsigned long raddr; struct shmid_ds shm_info; int i; @@ -1722,7 +1722,7 @@ static target_long do_ipc(unsigned int call, int first, break; } } - if (put_user(raddr, (target_ulong *)third)) + if (put_user(raddr, (abi_ulong *)third)) return -EFAULT; ret = 0; break; @@ -1803,11 +1803,11 @@ IOCTLEntry ioctl_entries[] = { }; /* ??? Implement proper locking for ioctls. */ -static target_long do_ioctl(int fd, target_long cmd, target_long arg) +static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg) { const IOCTLEntry *ie; const argtype *arg_type; - target_long ret; + abi_long ret; uint8_t buf_temp[MAX_STRUCT_SIZE]; int target_size; void *argptr; @@ -2088,7 +2088,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = { /* NOTE: there is really one LDT for all the threads */ uint8_t *ldt_table; -static int read_ldt(target_ulong ptr, unsigned long bytecount) +static int read_ldt(abi_ulong ptr, unsigned long bytecount) { int size; void *p; @@ -2107,7 +2107,7 @@ static int read_ldt(target_ulong ptr, unsigned long bytecount) /* XXX: add locking support */ static int write_ldt(CPUX86State *env, - target_ulong ptr, unsigned long bytecount, int oldmode) + abi_ulong ptr, unsigned long bytecount, int oldmode) { struct target_modify_ldt_ldt_s ldt_info; struct target_modify_ldt_ldt_s *target_ldt_info; @@ -2188,7 +2188,7 @@ install: } /* specific and weird i386 syscalls */ -int do_modify_ldt(CPUX86State *env, int func, target_ulong ptr, unsigned long bytecount) +int do_modify_ldt(CPUX86State *env, int func, abi_ulong ptr, unsigned long bytecount) { int ret = -ENOSYS; @@ -2220,7 +2220,7 @@ static int clone_func(void *arg) return 0; } -int do_fork(CPUState *env, unsigned int flags, target_ulong newsp) +int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp) { int ret; TaskState *ts; @@ -2310,13 +2310,13 @@ int do_fork(CPUState *env, unsigned int flags, target_ulong newsp) return ret; } -static target_long do_fcntl(int fd, int cmd, target_ulong arg) +static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) { struct flock fl; struct target_flock *target_fl; struct flock64 fl64; struct target_flock64 *target_fl64; - target_long ret; + abi_long ret; switch(cmd) { case TARGET_F_GETLK: @@ -2475,7 +2475,7 @@ void syscall_init(void) } } -#if TARGET_LONG_BITS == 32 +#if TARGET_ABI_BITS == 32 static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) { #ifdef TARGET_WORDS_BIG_ENDIAN @@ -2484,18 +2484,18 @@ static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) return ((uint64_t)word1 << 32) | word0; #endif } -#else /* TARGET_LONG_BITS == 32 */ +#else /* TARGET_ABI_BITS == 32 */ static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) { return word0; } -#endif /* TARGET_LONG_BITS != 32 */ +#endif /* TARGET_ABI_BITS != 32 */ #ifdef TARGET_NR_truncate64 -static inline target_long target_truncate64(void *cpu_env, const char *arg1, - target_long arg2, - target_long arg3, - target_long arg4) +static inline abi_long target_truncate64(void *cpu_env, const char *arg1, + abi_long arg2, + abi_long arg3, + abi_long arg4) { #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) @@ -2509,10 +2509,10 @@ static inline target_long target_truncate64(void *cpu_env, const char *arg1, #endif #ifdef TARGET_NR_ftruncate64 -static inline target_long target_ftruncate64(void *cpu_env, target_long arg1, - target_long arg2, - target_long arg3, - target_long arg4) +static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1, + abi_long arg2, + abi_long arg3, + abi_long arg4) { #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) @@ -2526,7 +2526,7 @@ static inline target_long target_ftruncate64(void *cpu_env, target_long arg1, #endif static inline void target_to_host_timespec(struct timespec *host_ts, - target_ulong target_addr) + abi_ulong target_addr) { struct target_timespec *target_ts; @@ -2536,7 +2536,7 @@ static inline void target_to_host_timespec(struct timespec *host_ts, unlock_user_struct(target_ts, target_addr, 0); } -static inline void host_to_target_timespec(target_ulong target_addr, +static inline void host_to_target_timespec(abi_ulong target_addr, struct timespec *host_ts) { struct target_timespec *target_ts; @@ -2547,11 +2547,11 @@ static inline void host_to_target_timespec(target_ulong target_addr, unlock_user_struct(target_ts, target_addr, 1); } -target_long do_syscall(void *cpu_env, int num, target_long arg1, - target_long arg2, target_long arg3, target_long arg4, - target_long arg5, target_long arg6) +abi_long do_syscall(void *cpu_env, int num, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5, abi_long arg6) { - target_long ret; + abi_long ret; struct stat st; struct statfs stfs; void *p; @@ -2687,10 +2687,10 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, { char **argp, **envp; int argc, envc; - target_ulong gp; - target_ulong guest_argp; - target_ulong guest_envp; - target_ulong addr; + abi_ulong gp; + abi_ulong guest_argp; + abi_ulong guest_envp; + abi_ulong addr; char **q; argc = 0; @@ -2706,7 +2706,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, envp = alloca((envc + 1) * sizeof(void *)); for (gp = guest_argp, q = argp; ; - gp += sizeof(target_ulong), q++) { + gp += sizeof(abi_ulong), q++) { addr = tgetl(gp); if (!addr) break; @@ -2715,7 +2715,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, *q = NULL; for (gp = guest_envp, q = envp; ; - gp += sizeof(target_ulong), q++) { + gp += sizeof(abi_ulong), q++) { addr = tgetl(gp); if (!addr) break; @@ -2728,12 +2728,12 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, unlock_user(p, arg1, 0); for (gp = guest_argp, q = argp; *q; - gp += sizeof(target_ulong), q++) { + gp += sizeof(abi_ulong), q++) { addr = tgetl(gp); unlock_user(*q, addr, 0); } for (gp = guest_envp, q = envp; *q; - gp += sizeof(target_ulong), q++) { + gp += sizeof(abi_ulong), q++) { addr = tgetl(gp); unlock_user(*q, addr, 0); } @@ -3163,7 +3163,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_sgetmask: { sigset_t cur_set; - target_ulong target_set; + abi_ulong target_set; sigprocmask(0, NULL, &cur_set); host_to_target_old_sigset(&target_set, &cur_set); ret = target_set; @@ -3174,7 +3174,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_ssetmask: { sigset_t set, oset, cur_set; - target_ulong target_set = arg1; + abi_ulong target_set = arg1; sigprocmask(0, NULL, &cur_set); target_to_host_old_sigset(&set, &target_set); sigorset(&set, &set, &cur_set); @@ -3407,7 +3407,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_select: { struct target_sel_arg_struct *sel; - target_ulong inp, outp, exp, tvp; + abi_ulong inp, outp, exp, tvp; long nsel; lock_user_struct(sel, arg1, 1); @@ -3510,9 +3510,9 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_mmap: #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_CRIS) { - target_ulong *v; - target_ulong v1, v2, v3, v4, v5, v6; - v = lock_user(arg1, 6 * sizeof(target_ulong), 1); + abi_ulong *v; + abi_ulong v1, v2, v3, v4, v5, v6; + v = lock_user(arg1, 6 * sizeof(abi_ulong), 1); v1 = tswapl(v[0]); v2 = tswapl(v[1]); v3 = tswapl(v[2]); @@ -3829,7 +3829,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, struct target_stat *target_st; lock_user_struct(target_st, arg2, 0); -#if defined(TARGET_MIPS) || defined(TARGET_SPARC64) +#if defined(TARGET_MIPS) || (defined(TARGET_SPARC64) && !defined(TARGET_ABI32)) target_st->st_dev = tswap32(st.st_dev); #else target_st->st_dev = tswap16(st.st_dev); @@ -3839,7 +3839,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, target_st->st_mode = tswapl(st.st_mode); /* XXX: check this */ target_st->st_uid = tswap32(st.st_uid); target_st->st_gid = tswap32(st.st_gid); -#elif defined(TARGET_SPARC64) +#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) target_st->st_mode = tswap32(st.st_mode); target_st->st_uid = tswap32(st.st_uid); target_st->st_gid = tswap32(st.st_gid); @@ -3852,7 +3852,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, /* If this is the same on PPC, then just merge w/ the above ifdef */ target_st->st_nlink = tswapl(st.st_nlink); target_st->st_rdev = tswapl(st.st_rdev); -#elif defined(TARGET_SPARC64) +#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) target_st->st_nlink = tswap32(st.st_nlink); target_st->st_rdev = tswap32(st.st_rdev); #else @@ -3892,9 +3892,9 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_wait4: { int status; - target_long status_ptr = arg2; + abi_long status_ptr = arg2; struct rusage rusage, *rusage_ptr; - target_ulong target_rusage = arg4; + abi_ulong target_rusage = arg4; if (target_rusage) rusage_ptr = &rusage; else @@ -4045,14 +4045,14 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, break; #endif case TARGET_NR_getdents: -#if TARGET_LONG_SIZE != 4 +#if TARGET_ABI_BITS != 32 goto unimplemented; #warning not supported -#elif TARGET_LONG_SIZE == 4 && HOST_LONG_SIZE == 8 +#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 { struct target_dirent *target_dirp; struct dirent *dirp; - target_long count = arg3; + abi_long count = arg3; dirp = malloc(count); if (!dirp) @@ -4072,11 +4072,11 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, tde = target_dirp; while (len > 0) { reclen = de->d_reclen; - treclen = reclen - (2 * (sizeof(long) - sizeof(target_long))); + treclen = reclen - (2 * (sizeof(long) - sizeof(abi_long))); tde->d_reclen = tswap16(treclen); tde->d_ino = tswapl(de->d_ino); tde->d_off = tswapl(de->d_off); - tnamelen = treclen - (2 * sizeof(target_long) + 2); + tnamelen = treclen - (2 * sizeof(abi_long) + 2); if (tnamelen > 256) tnamelen = 256; /* XXX: may not be correct */ @@ -4094,7 +4094,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, #else { struct dirent *dirp; - target_long count = arg3; + abi_long count = arg3; dirp = lock_user(arg2, count, 0); ret = get_errno(sys_getdents(arg1, dirp, count)); @@ -4122,7 +4122,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_getdents64: { struct dirent64 *dirp; - target_long count = arg3; + abi_long count = arg3; dirp = lock_user(arg2, count, 0); ret = get_errno(sys_getdents64(arg1, dirp, count)); if (!is_error(ret)) { @@ -4742,7 +4742,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, ret = get_errno(0); break; #endif -#if TARGET_LONG_BITS == 32 +#if TARGET_ABI_BITS == 32 case TARGET_NR_fcntl64: { int cmd; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index ccccebb..6c80c91 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -105,13 +105,13 @@ struct target_sockaddr { }; struct target_timeval { - target_long tv_sec; - target_long tv_usec; + abi_long tv_sec; + abi_long tv_usec; }; struct target_timespec { - target_long tv_sec; - target_long tv_nsec; + abi_long tv_sec; + abi_long tv_nsec; }; struct target_itimerval { @@ -119,7 +119,7 @@ struct target_itimerval { struct target_timeval it_value; }; -typedef target_long target_clock_t; +typedef abi_long target_clock_t; #define TARGET_HZ 100 @@ -131,33 +131,33 @@ struct target_tms { }; struct target_utimbuf { - target_long actime; - target_long modtime; + abi_long actime; + abi_long modtime; }; struct target_sel_arg_struct { - target_long n; - target_long inp, outp, exp; - target_long tvp; + abi_long n; + abi_long inp, outp, exp; + abi_long tvp; }; struct target_iovec { - target_long iov_base; /* Starting address */ - target_long iov_len; /* Number of bytes */ + abi_long iov_base; /* Starting address */ + abi_long iov_len; /* Number of bytes */ }; struct target_msghdr { - target_long msg_name; /* Socket name */ - int msg_namelen; /* Length of name */ - target_long msg_iov; /* Data blocks */ - target_long msg_iovlen; /* Number of blocks */ - target_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ - target_long msg_controllen; /* Length of cmsg list */ + abi_long msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + abi_long msg_iov; /* Data blocks */ + abi_long msg_iovlen; /* Number of blocks */ + abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ + abi_long msg_controllen; /* Length of cmsg list */ unsigned int msg_flags; }; struct target_cmsghdr { - target_long cmsg_len; + abi_long cmsg_len; int cmsg_level; int cmsg_type; }; @@ -167,8 +167,8 @@ struct target_cmsghdr { #define TARGET_CMSG_FIRSTHDR(mhdr) \ ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \ ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL) -#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \ - & (size_t) ~(sizeof (target_long) - 1)) +#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ + & (size_t) ~(sizeof (abi_long) - 1)) #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) @@ -191,20 +191,20 @@ __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cms struct target_rusage { struct target_timeval ru_utime; /* user time used */ struct target_timeval ru_stime; /* system time used */ - target_long ru_maxrss; /* maximum resident set size */ - target_long ru_ixrss; /* integral shared memory size */ - target_long ru_idrss; /* integral unshared data size */ - target_long ru_isrss; /* integral unshared stack size */ - target_long ru_minflt; /* page reclaims */ - target_long ru_majflt; /* page faults */ - target_long ru_nswap; /* swaps */ - target_long ru_inblock; /* block input operations */ - target_long ru_oublock; /* block output operations */ - target_long ru_msgsnd; /* messages sent */ - target_long ru_msgrcv; /* messages received */ - target_long ru_nsignals; /* signals received */ - target_long ru_nvcsw; /* voluntary context switches */ - target_long ru_nivcsw; /* involuntary " */ + abi_long ru_maxrss; /* maximum resident set size */ + abi_long ru_ixrss; /* integral shared memory size */ + abi_long ru_idrss; /* integral unshared data size */ + abi_long ru_isrss; /* integral unshared stack size */ + abi_long ru_minflt; /* page reclaims */ + abi_long ru_majflt; /* page faults */ + abi_long ru_nswap; /* swaps */ + abi_long ru_inblock; /* block input operations */ + abi_long ru_oublock; /* block output operations */ + abi_long ru_msgsnd; /* messages sent */ + abi_long ru_msgrcv; /* messages received */ + abi_long ru_nsignals; /* signals received */ + abi_long ru_nvcsw; /* voluntary context switches */ + abi_long ru_nivcsw; /* involuntary " */ }; typedef struct { @@ -225,8 +225,8 @@ struct kernel_statfs { }; struct target_dirent { - target_long d_ino; - target_long d_off; + abi_long d_ino; + abi_long d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; @@ -241,20 +241,20 @@ struct target_dirent64 { /* mostly generic signal stuff */ -#define TARGET_SIG_DFL ((target_long)0) /* default signal handling */ -#define TARGET_SIG_IGN ((target_long)1) /* ignore signal */ -#define TARGET_SIG_ERR ((target_long)-1) /* error return from signal */ +#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ +#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ +#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ #ifdef TARGET_MIPS #define TARGET_NSIG 128 #else #define TARGET_NSIG 64 #endif -#define TARGET_NSIG_BPW TARGET_LONG_BITS +#define TARGET_NSIG_BPW TARGET_ABI_BITS #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) typedef struct { - target_ulong sig[TARGET_NSIG_WORDS]; + abi_ulong sig[TARGET_NSIG_WORDS]; } target_sigset_t; #ifdef BSWAP_NEEDED @@ -271,7 +271,7 @@ static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) } #endif -static inline void target_siginitset(target_sigset_t *d, target_ulong set) +static inline void target_siginitset(target_sigset_t *d, abi_ulong set) { int i; d->sig[0] = set; @@ -281,10 +281,10 @@ static inline void target_siginitset(target_sigset_t *d, target_ulong set) void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); -void host_to_target_old_sigset(target_ulong *old_sigset, +void host_to_target_old_sigset(abi_ulong *old_sigset, const sigset_t *sigset); void target_to_host_old_sigset(sigset_t *sigset, - const target_ulong *old_sigset); + const abi_ulong *old_sigset); struct target_sigaction; int do_sigaction(int sig, const struct target_sigaction *act, struct target_sigaction *oact); @@ -453,40 +453,40 @@ struct target_sigaction { #if defined(TARGET_MIPSN32) uint32_t _sa_handler; #else - target_ulong _sa_handler; + abi_ulong _sa_handler; #endif target_sigset_t sa_mask; }; #else struct target_old_sigaction { - target_ulong _sa_handler; - target_ulong sa_mask; - target_ulong sa_flags; - target_ulong sa_restorer; + abi_ulong _sa_handler; + abi_ulong sa_mask; + abi_ulong sa_flags; + abi_ulong sa_restorer; }; struct target_sigaction { - target_ulong _sa_handler; - target_ulong sa_flags; - target_ulong sa_restorer; + abi_ulong _sa_handler; + abi_ulong sa_flags; + abi_ulong sa_restorer; target_sigset_t sa_mask; }; #endif typedef union target_sigval { int sival_int; - target_ulong sival_ptr; + abi_ulong sival_ptr; } target_sigval_t; #if 0 #if defined (TARGET_SPARC) typedef struct { struct { - target_ulong psr; - target_ulong pc; - target_ulong npc; - target_ulong y; - target_ulong u_regs[16]; /* globals and ins */ + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; /* globals and ins */ } si_regs; int si_mask; } __siginfo_t; @@ -544,7 +544,7 @@ typedef struct target_siginfo { /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ struct { - target_ulong _addr; /* faulting insn/memory ref. */ + abi_ulong _addr; /* faulting insn/memory ref. */ } _sigfault; /* SIGPOLL */ @@ -614,8 +614,8 @@ typedef struct target_siginfo { #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ struct target_rlimit { - target_ulong rlim_cur; - target_ulong rlim_max; + abi_ulong rlim_cur; + abi_ulong rlim_max; }; struct target_pollfd { @@ -888,24 +888,24 @@ struct target_winsize { struct target_stat { unsigned short st_dev; unsigned short __pad1; - target_ulong st_ino; + abi_ulong st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned short __pad2; - target_ulong st_size; - target_ulong st_blksize; - target_ulong st_blocks; - target_ulong target_st_atime; - target_ulong __unused1; - target_ulong target_st_mtime; - target_ulong __unused2; - target_ulong target_st_ctime; - target_ulong __unused3; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong __unused1; + abi_ulong target_st_mtime; + abi_ulong __unused2; + abi_ulong target_st_ctime; + abi_ulong __unused3; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -916,31 +916,31 @@ struct target_stat64 { unsigned char __pad0[10]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - target_ulong __st_ino; + abi_ulong __st_ino; unsigned int st_mode; unsigned int st_nlink; - target_ulong st_uid; - target_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; unsigned short st_rdev; unsigned char __pad3[10]; long long st_size; - target_ulong st_blksize; + abi_ulong st_blksize; - target_ulong st_blocks; /* Number 512-byte blocks allocated. */ - target_ulong __pad4; /* future possible st_blocks high bits */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits */ - target_ulong target_st_atime; - target_ulong __pad5; + abi_ulong target_st_atime; + abi_ulong __pad5; - target_ulong target_st_mtime; - target_ulong __pad6; + abi_ulong target_st_mtime; + abi_ulong __pad6; - target_ulong target_st_ctime; - target_ulong __pad7; /* will be high 32 bits of ctime someday */ + abi_ulong target_st_ctime; + abi_ulong __pad7; /* will be high 32 bits of ctime someday */ unsigned long long st_ino; } __attribute__((packed)); @@ -949,50 +949,50 @@ struct target_stat64 { struct target_eabi_stat64 { unsigned long long st_dev; unsigned int __pad1; - target_ulong __st_ino; + abi_ulong __st_ino; unsigned int st_mode; unsigned int st_nlink; - target_ulong st_uid; - target_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; unsigned long long st_rdev; unsigned int __pad2[2]; long long st_size; - target_ulong st_blksize; + abi_ulong st_blksize; unsigned int __pad3; unsigned long long st_blocks; - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; unsigned long long st_ino; } __attribute__ ((packed)); #endif -#elif defined(TARGET_SPARC64) +#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { unsigned int st_dev; - target_ulong st_ino; + abi_ulong st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; unsigned int st_rdev; - target_long st_size; - target_long target_st_atime; - target_long target_st_mtime; - target_long target_st_ctime; - target_long st_blksize; - target_long st_blocks; - target_ulong __unused4[2]; + abi_long st_size; + abi_long target_st_atime; + abi_long target_st_mtime; + abi_long target_st_ctime; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused4[2]; }; struct target_stat64 { @@ -1016,38 +1016,38 @@ struct target_stat64 { unsigned char __pad4[4]; unsigned int st_blocks; - target_ulong target_st_atime; - target_ulong __unused1; + abi_ulong target_st_atime; + abi_ulong __unused1; - target_ulong target_st_mtime; - target_ulong __unused2; + abi_ulong target_st_mtime; + abi_ulong __unused2; - target_ulong target_st_ctime; - target_ulong __unused3; + abi_ulong target_st_ctime; + abi_ulong __unused3; - target_ulong __unused4[3]; + abi_ulong __unused4[3]; }; #elif defined(TARGET_SPARC) struct target_stat { unsigned short st_dev; - target_ulong st_ino; + abi_ulong st_ino; unsigned short st_mode; short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; - target_long st_size; - target_long target_st_atime; - target_ulong __unused1; - target_long target_st_mtime; - target_ulong __unused2; - target_long target_st_ctime; - target_ulong __unused3; - target_long st_blksize; - target_long st_blocks; - target_ulong __unused4[2]; + abi_long st_size; + abi_long target_st_atime; + abi_ulong __unused1; + abi_long target_st_mtime; + abi_ulong __unused2; + abi_long target_st_ctime; + abi_ulong __unused3; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused4[2]; }; struct target_stat64 { @@ -1090,23 +1090,23 @@ struct target_stat64 { struct target_stat { unsigned short st_dev; - target_ulong st_ino; + abi_ulong st_ino; unsigned int st_mode; unsigned short st_nlink; unsigned int st_uid; unsigned int st_gid; unsigned short st_rdev; - target_ulong st_size; - target_ulong st_blksize; - target_ulong st_blocks; - target_ulong target_st_atime; - target_ulong __unused1; - target_ulong target_st_mtime; - target_ulong __unused2; - target_ulong target_st_ctime; - target_ulong __unused3; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong __unused1; + abi_ulong target_st_mtime; + abi_ulong __unused2; + abi_ulong target_st_ctime; + abi_ulong __unused3; + abi_ulong __unused4; + abi_ulong __unused5; }; struct target_stat64 { @@ -1119,17 +1119,17 @@ struct target_stat64 { unsigned long long st_rdev; long long pad0; long long st_size; - target_ulong st_blksize; - target_ulong pad1; + abi_ulong st_blksize; + abi_ulong pad1; long long st_blocks; /* Number 512-byte blocks allocated. */ - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; #elif defined(TARGET_M68K) @@ -1137,24 +1137,24 @@ struct target_stat64 { struct target_stat { unsigned short st_dev; unsigned short __pad1; - target_ulong st_ino; + abi_ulong st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned short __pad2; - target_ulong st_size; - target_ulong st_blksize; - target_ulong st_blocks; - target_ulong target_st_atime; - target_ulong __unused1; - target_ulong target_st_mtime; - target_ulong __unused2; - target_ulong target_st_ctime; - target_ulong __unused3; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong __unused1; + abi_ulong target_st_mtime; + abi_ulong __unused2; + abi_ulong target_st_ctime; + abi_ulong __unused3; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1165,31 +1165,31 @@ struct target_stat64 { unsigned char __pad1[2]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - target_ulong __st_ino; + abi_ulong __st_ino; unsigned int st_mode; unsigned int st_nlink; - target_ulong st_uid; - target_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; unsigned long long st_rdev; unsigned char __pad3[2]; long long st_size; - target_ulong st_blksize; + abi_ulong st_blksize; - target_ulong __pad4; /* future possible st_blocks high bits */ - target_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; unsigned long long st_ino; } __attribute__((packed)); @@ -1201,7 +1201,7 @@ struct target_stat { unsigned int st_dev; unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ - target_ulong st_ino; + abi_ulong st_ino; unsigned int st_mode; unsigned int st_nlink; @@ -1212,7 +1212,7 @@ struct target_stat { unsigned int st_rdev; unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ - target_ulong st_size; + abi_ulong st_size; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime @@ -1230,7 +1230,7 @@ struct target_stat { unsigned int st_blksize; unsigned int st_pad2; - target_ulong st_blocks; + abi_ulong st_blocks; }; #elif defined(TARGET_MIPSN32) @@ -1308,29 +1308,29 @@ struct target_stat64 { struct target_stat { unsigned st_dev; - target_long st_pad1[3]; /* Reserved for network id */ - target_ulong st_ino; + abi_long st_pad1[3]; /* Reserved for network id */ + abi_ulong st_ino; unsigned int st_mode; unsigned int st_nlink; int st_uid; int st_gid; unsigned st_rdev; - target_long st_pad2[2]; - target_long st_size; - target_long st_pad3; + abi_long st_pad2[2]; + abi_long st_size; + abi_long st_pad3; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - target_long target_st_atime; - target_long target_st_atime_nsec; - target_long target_st_mtime; - target_long target_st_mtime_nsec; - target_long target_st_ctime; - target_long target_st_ctime_nsec; - target_long st_blksize; - target_long st_blocks; - target_long st_pad4[14]; + abi_long target_st_atime; + abi_long target_st_atime_nsec; + abi_long target_st_mtime; + abi_long target_st_mtime_nsec; + abi_long target_st_ctime; + abi_long target_st_ctime_nsec; + abi_long st_blksize; + abi_long st_blocks; + abi_long st_pad4[14]; }; /* @@ -1340,8 +1340,8 @@ struct target_stat { */ struct target_stat64 { - target_ulong st_dev; - target_ulong st_pad0[3]; /* Reserved for st_dev expansion */ + abi_ulong st_dev; + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ uint64_t st_ino; @@ -1351,8 +1351,8 @@ struct target_stat64 { int st_uid; int st_gid; - target_ulong st_rdev; - target_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ + abi_ulong st_rdev; + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ int64_t st_size; @@ -1360,17 +1360,17 @@ struct target_stat64 { * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - target_long target_st_atime; - target_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ - target_long target_st_mtime; - target_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ - target_long target_st_ctime; - target_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ - target_ulong st_blksize; - target_ulong st_pad2; + abi_ulong st_blksize; + abi_ulong st_pad2; int64_t st_blocks; }; @@ -1385,10 +1385,10 @@ struct target_stat { unsigned int st_uid; unsigned int st_gid; unsigned int st_rdev; - target_long st_size; - target_ulong target_st_atime; - target_ulong target_st_mtime; - target_ulong target_st_ctime; + abi_long st_size; + abi_ulong target_st_atime; + abi_ulong target_st_mtime; + abi_ulong target_st_ctime; unsigned int st_blksize; unsigned int st_blocks; unsigned int st_flags; @@ -1396,11 +1396,11 @@ struct target_stat { }; struct target_stat64 { - target_ulong st_dev; - target_ulong st_ino; - target_ulong st_rdev; - target_long st_size; - target_ulong st_blocks; + abi_ulong st_dev; + abi_ulong st_ino; + abi_ulong st_rdev; + abi_long st_size; + abi_ulong st_blocks; unsigned int st_mode; unsigned int st_uid; @@ -1409,36 +1409,36 @@ struct target_stat64 { unsigned int st_nlink; unsigned int __pad0; - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; - target_long __unused[3]; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_long __unused[3]; }; #elif defined(TARGET_SH4) struct target_stat { - target_ulong st_dev; - target_ulong st_ino; + abi_ulong st_dev; + abi_ulong st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; - target_ulong st_rdev; - target_ulong st_size; - target_ulong st_blksize; - target_ulong st_blocks; - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; - target_ulong __unused4; - target_ulong __unused5; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1449,30 +1449,30 @@ struct target_stat64 { unsigned char __pad0[4]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - target_ulong __st_ino; + abi_ulong __st_ino; unsigned int st_mode; unsigned int st_nlink; - target_ulong st_uid; - target_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; unsigned long long st_rdev; unsigned char __pad3[4]; long long st_size; - target_ulong st_blksize; + abi_ulong st_blksize; unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ - target_ulong target_st_atime; - target_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - target_ulong target_st_mtime; - target_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - target_ulong target_st_ctime; - target_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; unsigned long long st_ino; }; @@ -1504,19 +1504,19 @@ struct target_statfs { }; #else struct target_statfs { - target_long f_type; - target_long f_bsize; - target_long f_frsize; /* Fragment size - unsupported */ - target_long f_blocks; - target_long f_bfree; - target_long f_files; - target_long f_ffree; - target_long f_bavail; + abi_long f_type; + abi_long f_bsize; + abi_long f_frsize; /* Fragment size - unsupported */ + abi_long f_blocks; + abi_long f_bfree; + abi_long f_files; + abi_long f_ffree; + abi_long f_bavail; /* Linux specials */ target_fsid_t f_fsid; - target_long f_namelen; - target_long f_spare[6]; + abi_long f_namelen; + abi_long f_spare[6]; }; #endif @@ -1688,8 +1688,8 @@ struct target_statfs64 { struct target_flock { short l_type; short l_whence; - target_ulong l_start; - target_ulong l_len; + abi_ulong l_start; + abi_ulong l_len; int l_pid; }; @@ -1856,20 +1856,20 @@ struct target_eabi_flock64 { #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) struct target_sysinfo { - target_long uptime; /* Seconds since boot */ - target_ulong loads[3]; /* 1, 5, and 15 minute load averages */ - target_ulong totalram; /* Total usable main memory size */ - target_ulong freeram; /* Available memory size */ - target_ulong sharedram; /* Amount of shared memory */ - target_ulong bufferram; /* Memory used by buffers */ - target_ulong totalswap; /* Total swap space size */ - target_ulong freeswap; /* swap space still available */ + abi_long uptime; /* Seconds since boot */ + abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ + abi_ulong totalram; /* Total usable main memory size */ + abi_ulong freeram; /* Available memory size */ + abi_ulong sharedram; /* Amount of shared memory */ + abi_ulong bufferram; /* Memory used by buffers */ + abi_ulong totalswap; /* Total swap space size */ + abi_ulong freeswap; /* swap space still available */ unsigned short procs; /* Number of current processes */ unsigned short pad; /* explicit padding for m68k */ - target_ulong totalhigh; /* Total high memory size */ - target_ulong freehigh; /* Available high memory size */ + abi_ulong totalhigh; /* Total high memory size */ + abi_ulong freehigh; /* Available high memory size */ unsigned int mem_unit; /* Memory unit size in bytes */ - char _f[20-2*sizeof(target_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ + char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ }; #include "socket.h" diff --git a/linux-user/vm86.c b/linux-user/vm86.c index 9639114..a3c92e1 100644 --- a/linux-user/vm86.c +++ b/linux-user/vm86.c @@ -381,7 +381,7 @@ void handle_vm86_fault(CPUX86State *env) } } -int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr) +int do_vm86(CPUX86State *env, long subfunction, abi_ulong vm86_addr) { TaskState *ts = env->opaque; struct target_vm86plus_struct * target_v86; diff --git a/linux-user/x86_64/syscall.h b/linux-user/x86_64/syscall.h index 2f87dc9..cdba432 100644 --- a/linux-user/x86_64/syscall.h +++ b/linux-user/x86_64/syscall.h @@ -2,30 +2,30 @@ #define __USER_DS (0x2B) struct target_pt_regs { - target_ulong r15; - target_ulong r14; - target_ulong r13; - target_ulong r12; - target_ulong rbp; - target_ulong rbx; + abi_ulong r15; + abi_ulong r14; + abi_ulong r13; + abi_ulong r12; + abi_ulong rbp; + abi_ulong rbx; /* arguments: non interrupts/non tracing syscalls only save upto here*/ - target_ulong r11; - target_ulong r10; - target_ulong r9; - target_ulong r8; - target_ulong rax; - target_ulong rcx; - target_ulong rdx; - target_ulong rsi; - target_ulong rdi; - target_ulong orig_rax; + abi_ulong r11; + abi_ulong r10; + abi_ulong r9; + abi_ulong r8; + abi_ulong rax; + abi_ulong rcx; + abi_ulong rdx; + abi_ulong rsi; + abi_ulong rdi; + abi_ulong orig_rax; /* end of arguments */ /* cpu exception frame or undefined */ - target_ulong rip; - target_ulong cs; - target_ulong eflags; - target_ulong rsp; - target_ulong ss; + abi_ulong rip; + abi_ulong cs; + abi_ulong eflags; + abi_ulong rsp; + abi_ulong ss; /* top of stack page */ }; @@ -41,7 +41,7 @@ struct target_pt_regs { #if 0 // Redefine this struct target_modify_ldt_ldt_s { unsigned int entry_number; - target_ulong base_addr; + abi_ulong base_addr; unsigned int limit; unsigned int seg_32bit:1; unsigned int contents:2; @@ -54,7 +54,7 @@ struct target_modify_ldt_ldt_s { #else struct target_modify_ldt_ldt_s { unsigned int entry_number; - target_ulong base_addr; + abi_ulong base_addr; unsigned int limit; unsigned int flags; }; @@ -71,8 +71,8 @@ struct target_ipc64_perm unsigned short __pad1; unsigned short seq; unsigned short __pad2; - target_ulong __unused1; - target_ulong __unused2; + abi_ulong __unused1; + abi_ulong __unused2; }; struct target_msqid64_ds { @@ -80,13 +80,13 @@ struct target_msqid64_ds { unsigned int msg_stime; /* last msgsnd time */ unsigned int msg_rtime; /* last msgrcv time */ unsigned int msg_ctime; /* last change time */ - target_ulong msg_cbytes; /* current number of bytes on queue */ - target_ulong msg_qnum; /* number of messages in queue */ - target_ulong msg_qbytes; /* max number of bytes on queue */ + abi_ulong msg_cbytes; /* current number of bytes on queue */ + abi_ulong msg_qnum; /* number of messages in queue */ + abi_ulong msg_qbytes; /* max number of bytes on queue */ unsigned int msg_lspid; /* pid of last msgsnd */ unsigned int msg_lrpid; /* last receive pid */ - target_ulong __unused4; - target_ulong __unused5; + abi_ulong __unused4; + abi_ulong __unused5; }; #define UNAME_MACHINE "x86_64" diff --git a/linux-user/x86_64/target_signal.h b/linux-user/x86_64/target_signal.h index f93a8d6..9baf7fb 100644 --- a/linux-user/x86_64/target_signal.h +++ b/linux-user/x86_64/target_signal.h @@ -6,9 +6,9 @@ /* this struct defines a stack used during syscall handling */ typedef struct target_sigaltstack { - target_ulong ss_sp; - target_long ss_flags; - target_ulong ss_size; + abi_ulong ss_sp; + abi_long ss_flags; + abi_ulong ss_size; } target_stack_t; @@ -21,7 +21,7 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 -static inline target_ulong get_sp_from_cpustate(CPUX86State *state) +static inline abi_ulong get_sp_from_cpustate(CPUX86State *state) { return state->regs[R_ESP]; } diff --git a/target-sparc/op_mem.h b/target-sparc/op_mem.h index c0cf043..96ad716 100644 --- a/target-sparc/op_mem.h +++ b/target-sparc/op_mem.h @@ -1,20 +1,26 @@ +#ifdef TARGET_ABI32 +#define ADDR(x) ((x) & 0xffffffff) +#else +#define ADDR(x) (x) +#endif + /*** Integer load ***/ #define SPARC_LD_OP(name, qp) \ void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ { \ - T1 = (target_ulong)glue(qp, MEMSUFFIX)(T0); \ + T1 = (target_ulong)glue(qp, MEMSUFFIX)(ADDR(T0)); \ } #define SPARC_LD_OP_S(name, qp) \ void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ { \ - T1 = (target_long)glue(qp, MEMSUFFIX)(T0); \ + T1 = (target_long)glue(qp, MEMSUFFIX)(ADDR(T0)); \ } #define SPARC_ST_OP(name, op) \ void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ { \ - glue(op, MEMSUFFIX)(T0, T1); \ + glue(op, MEMSUFFIX)(ADDR(T0), T1); \ } SPARC_LD_OP(ld, ldl); @@ -30,60 +36,60 @@ SPARC_ST_OP(sth, stw); void OPPROTO glue(op_std, MEMSUFFIX)(void) { - glue(stl, MEMSUFFIX)(T0, T1); - glue(stl, MEMSUFFIX)((T0 + 4), T2); + glue(stl, MEMSUFFIX)(ADDR(T0), T1); + glue(stl, MEMSUFFIX)((ADDR(T0 + 4)), T2); } void OPPROTO glue(op_ldstub, MEMSUFFIX)(void) { - T1 = glue(ldub, MEMSUFFIX)(T0); - glue(stb, MEMSUFFIX)(T0, 0xff); /* XXX: Should be Atomically */ + T1 = glue(ldub, MEMSUFFIX)(ADDR(T0)); + glue(stb, MEMSUFFIX)(ADDR(T0), 0xff); /* XXX: Should be Atomically */ } void OPPROTO glue(op_swap, MEMSUFFIX)(void) { - target_ulong tmp = glue(ldl, MEMSUFFIX)(T0); - glue(stl, MEMSUFFIX)(T0, T1); /* XXX: Should be Atomically */ + target_ulong tmp = glue(ldl, MEMSUFFIX)(ADDR(T0)); + glue(stl, MEMSUFFIX)(ADDR(T0), T1); /* XXX: Should be Atomically */ T1 = tmp; } void OPPROTO glue(op_ldd, MEMSUFFIX)(void) { - T1 = glue(ldl, MEMSUFFIX)(T0); - T0 = glue(ldl, MEMSUFFIX)((T0 + 4)); + T1 = glue(ldl, MEMSUFFIX)(ADDR(T0)); + T0 = glue(ldl, MEMSUFFIX)((ADDR(T0 + 4))); } /*** Floating-point store ***/ void OPPROTO glue(op_stf, MEMSUFFIX) (void) { - glue(stfl, MEMSUFFIX)(T0, FT0); + glue(stfl, MEMSUFFIX)(ADDR(T0), FT0); } void OPPROTO glue(op_stdf, MEMSUFFIX) (void) { - glue(stfq, MEMSUFFIX)(T0, DT0); + glue(stfq, MEMSUFFIX)(ADDR(T0), DT0); } /*** Floating-point load ***/ void OPPROTO glue(op_ldf, MEMSUFFIX) (void) { - FT0 = glue(ldfl, MEMSUFFIX)(T0); + FT0 = glue(ldfl, MEMSUFFIX)(ADDR(T0)); } void OPPROTO glue(op_lddf, MEMSUFFIX) (void) { - DT0 = glue(ldfq, MEMSUFFIX)(T0); + DT0 = glue(ldfq, MEMSUFFIX)(ADDR(T0)); } #ifdef TARGET_SPARC64 void OPPROTO glue(op_lduw, MEMSUFFIX)(void) { - T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff); + T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff); } void OPPROTO glue(op_ldsw, MEMSUFFIX)(void) { - T1 = (int64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff); + T1 = (int64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff); } SPARC_LD_OP(ldx, ldq); @@ -136,13 +136,13 @@ const argtype *thunk_convert(void *dst, const void *src, case TYPE_ULONGLONG: *(uint64_t *)dst = tswap64(*(uint64_t *)src); break; -#if HOST_LONG_BITS == 32 && TARGET_LONG_BITS == 32 +#if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32 case TYPE_LONG: case TYPE_ULONG: case TYPE_PTRVOID: *(uint32_t *)dst = tswap32(*(uint32_t *)src); break; -#elif HOST_LONG_BITS == 64 && TARGET_LONG_BITS == 32 +#elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32 case TYPE_LONG: case TYPE_ULONG: case TYPE_PTRVOID: @@ -98,7 +98,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) if (is_host) { return HOST_LONG_SIZE; } else { - return TARGET_LONG_SIZE; + return TARGET_ABI_BITS / 8; } break; case TYPE_ARRAY: @@ -135,7 +135,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) if (is_host) { return HOST_LONG_SIZE; } else { - return TARGET_LONG_SIZE; + return TARGET_ABI_BITS / 8; } break; case TYPE_ARRAY: |