Support for 32 bit ABI on 64 bit targets (only enabled Sparc64)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3396 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2007-10-14 16:27:31 +00:00
parent b227a8e9aa
commit 992f48a036
41 changed files with 1042 additions and 997 deletions

View File

@ -31,7 +31,10 @@ CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
endif endif
ifdef CONFIG_LINUX_USER ifdef CONFIG_LINUX_USER
VPATH+=:$(SRC_PATH)/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 endif
BASE_CFLAGS= BASE_CFLAGS=
BASE_LDFLAGS= BASE_LDFLAGS=
@ -66,6 +69,11 @@ ifeq ($(TARGET_ARCH),mips64)
TARGET_ARCH2=mips64el TARGET_ARCH2=mips64el
endif endif
endif endif
ifeq ($(TARGET_ARCH),sparc64)
ifeq ($(TARGET_ABI_DIR),sparc)
TARGET_ARCH2=sparc32plus
endif
endif
QEMU_USER=qemu-$(TARGET_ARCH2) QEMU_USER=qemu-$(TARGET_ARCH2)
# system emulator name # system emulator name
ifdef CONFIG_SOFTMMU ifdef CONFIG_SOFTMMU

12
configure vendored
View File

@ -504,7 +504,7 @@ if test -z "$target_list" ; then
fi fi
# the following are Linux specific # the following are Linux specific
if [ "$linux_user" = "yes" ] ; then 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 fi
# the following are Darwin specific # the following are Darwin specific
if [ "$darwin_user" = "yes" ] ; then if [ "$darwin_user" = "yes" ] ; then
@ -933,6 +933,7 @@ target_bigendian="no"
[ "$target_cpu" = "armeb" ] && target_bigendian=yes [ "$target_cpu" = "armeb" ] && target_bigendian=yes
[ "$target_cpu" = "sparc" ] && target_bigendian=yes [ "$target_cpu" = "sparc" ] && target_bigendian=yes
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
[ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
[ "$target_cpu" = "ppc64" ] && 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_SPARC 1" >> $config_h
echo "#define TARGET_SPARC64 1" >> $config_h echo "#define TARGET_SPARC64 1" >> $config_h
elfload32="yes" 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 elif test "$target_cpu" = "ppc" ; then
echo "TARGET_ARCH=ppc" >> $config_mak echo "TARGET_ARCH=ppc" >> $config_mak
echo "#define TARGET_ARCH \"ppc\"" >> $config_h 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 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
fi 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 "CONFIG_SOFTFLOAT=yes" >> $config_mak
echo "#define CONFIG_SOFTFLOAT 1" >> $config_h echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
fi fi

View File

@ -2,40 +2,40 @@
#define __USER_DS (1) #define __USER_DS (1)
struct target_pt_regs { struct target_pt_regs {
target_ulong r0; abi_ulong r0;
target_ulong r1; abi_ulong r1;
target_ulong r2; abi_ulong r2;
target_ulong r3; abi_ulong r3;
target_ulong r4; abi_ulong r4;
target_ulong r5; abi_ulong r5;
target_ulong r6; abi_ulong r6;
target_ulong r7; abi_ulong r7;
target_ulong r8; abi_ulong r8;
target_ulong r19; abi_ulong r19;
target_ulong r20; abi_ulong r20;
target_ulong r21; abi_ulong r21;
target_ulong r22; abi_ulong r22;
target_ulong r23; abi_ulong r23;
target_ulong r24; abi_ulong r24;
target_ulong r25; abi_ulong r25;
target_ulong r26; abi_ulong r26;
target_ulong r27; abi_ulong r27;
target_ulong r28; abi_ulong r28;
target_ulong hae; abi_ulong hae;
/* JRP - These are the values provided to a0-a2 by PALcode */ /* JRP - These are the values provided to a0-a2 by PALcode */
target_ulong trap_a0; abi_ulong trap_a0;
target_ulong trap_a1; abi_ulong trap_a1;
target_ulong trap_a2; abi_ulong trap_a2;
/* These are saved by PAL-code: */ /* These are saved by PAL-code: */
target_ulong ps; abi_ulong ps;
target_ulong pc; abi_ulong pc;
target_ulong gp; abi_ulong gp;
target_ulong r16; abi_ulong r16;
target_ulong r17; abi_ulong r17;
target_ulong r18; abi_ulong r18;
/* Those is needed by qemu to temporary store the user stack pointer */ /* Those is needed by qemu to temporary store the user stack pointer */
target_ulong usp; abi_ulong usp;
target_ulong unique; abi_ulong unique;
}; };
#define UNAME_MACHINE "alpha" #define UNAME_MACHINE "alpha"

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 4096 #define TARGET_MINSIGSTKSZ 4096
#define TARGET_SIGSTKSZ 16384 #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]; return state->ir[IR_SP];
} }

View File

@ -3,7 +3,7 @@
stack during a system call. */ stack during a system call. */
struct target_pt_regs { struct target_pt_regs {
target_long uregs[18]; abi_long uregs[18];
}; };
#define ARM_cpsr uregs[16] #define ARM_cpsr uregs[16]

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->regs[13];
} }

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_ulong ss_size; abi_ulong ss_size;
target_long ss_flags; abi_long ss_flags;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->regs[14];
} }

View File

@ -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) 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)); memset(regs, 0, sizeof(*regs));
regs->ARM_cpsr = 0x10; regs->ARM_cpsr = 0x10;
if (infop->entry & 1) if (infop->entry & 1)
@ -214,7 +214,11 @@ enum
#define ELF_START_MMAP 0x80000000 #define ELF_START_MMAP 0x80000000
#ifndef TARGET_ABI32
#define elf_check_arch(x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) #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_CLASS ELFCLASS64
#define ELF_DATA ELFDATA2MSB #define ELF_DATA ELFDATA2MSB
@ -224,14 +228,20 @@ enum
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
{ {
#ifndef TARGET_ABI32
regs->tstate = 0; regs->tstate = 0;
#endif
regs->pc = infop->entry; regs->pc = infop->entry;
regs->npc = regs->pc + 4; regs->npc = regs->pc + 4;
regs->y = 0; regs->y = 0;
#ifdef TARGET_ABI32
regs->u_regs[14] = infop->start_stack - 16 * 4;
#else
if (personality(infop->personality) == PER_LINUX32) if (personality(infop->personality) == PER_LINUX32)
regs->u_regs[14] = infop->start_stack - 16 * 4; regs->u_regs[14] = infop->start_stack - 16 * 4;
else else
regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS;
#endif
} }
#else #else
@ -313,10 +323,10 @@ do { \
static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop) static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)
{ {
target_ulong pos = infop->start_stack; abi_ulong pos = infop->start_stack;
target_ulong tmp; abi_ulong tmp;
#ifdef TARGET_PPC64 #ifdef TARGET_PPC64
target_ulong entry, toc; abi_ulong entry, toc;
#endif #endif
_regs->msr = 1 << MSR_PR; /* Set user mode */ _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. * execution of PPC BSD programs.
*/ */
_regs->gpr[3] = tgetl(pos); _regs->gpr[3] = tgetl(pos);
pos += sizeof(target_ulong); pos += sizeof(abi_ulong);
_regs->gpr[4] = pos; _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); tmp = ldl(pos);
_regs->gpr[5] = 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 #define ELF_HWCAP 0
#endif #endif
#ifdef OVERRIDE_ELF_CLASS #ifdef TARGET_ABI32
#undef ELF_CLASS #undef ELF_CLASS
#define ELF_CLASS OVERRIDE_ELF_CLASS #define ELF_CLASS ELFCLASS32
#undef bswaptls #undef bswaptls
#define bswaptls(ptr) bswap32s(ptr) #define bswaptls(ptr) bswap32s(ptr)
#endif #endif
@ -588,8 +598,8 @@ static void bswap_sym(struct elf_sym *sym)
* to be put directly into the top of new user memory. * to be put directly into the top of new user memory.
* *
*/ */
static target_ulong copy_elf_strings(int argc,char ** argv, void **page, static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
target_ulong p) abi_ulong p)
{ {
char *tmp, *tmp1, *pag = NULL; char *tmp, *tmp1, *pag = NULL;
int len, offset = 0; int len, offset = 0;
@ -638,10 +648,10 @@ static target_ulong copy_elf_strings(int argc,char ** argv, void **page,
return p; return p;
} }
static target_ulong setup_arg_pages(target_ulong p, struct linux_binprm *bprm, static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm,
struct image_info *info) struct image_info *info)
{ {
target_ulong stack_base, size, error; abi_ulong stack_base, size, error;
int i; int i;
/* Create enough stack to hold everything. If we don't use /* 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; 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... */ /* page-align the start and end addresses... */
start = HOST_PAGE_ALIGN(start); 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 /* We need to explicitly zero any fractional pages after the data
section (i.e. bss). This would contain the junk from the file that section (i.e. bss). This would contain the junk from the file that
should not be in memory. */ 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) if (elf_bss >= last_bss)
return; 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 patch target_mmap(), but it is more complicated as the file
size must be known */ size must be known */
if (qemu_real_host_page_size < qemu_host_page_size) { 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) & end_addr1 = (elf_bss + qemu_real_host_page_size - 1) &
~(qemu_real_host_page_size - 1); ~(qemu_real_host_page_size - 1);
end_addr = HOST_PAGE_ALIGN(elf_bss); 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, static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
struct elfhdr * exec, struct elfhdr * exec,
target_ulong load_addr, abi_ulong load_addr,
target_ulong load_bias, abi_ulong load_bias,
target_ulong interp_load_addr, int ibcs, abi_ulong interp_load_addr, int ibcs,
struct image_info *info) struct image_info *info)
{ {
target_ulong sp; abi_ulong sp;
int size; int size;
target_ulong u_platform; abi_ulong u_platform;
const char *k_platform; const char *k_platform;
const int n = sizeof(elf_addr_t); 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. * Force 16 byte _final_ alignment here for generality.
*/ */
sp = sp &~ (target_ulong)15; sp = sp &~ (abi_ulong)15;
size = (DLINFO_ITEMS + 1) * 2; size = (DLINFO_ITEMS + 1) * 2;
if (k_platform) if (k_platform)
size += 2; 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); NEW_AUX_ENT (AT_NULL, 0);
/* There must be exactly DLINFO_ITEMS entries here. */ /* There must be exactly DLINFO_ITEMS entries here. */
NEW_AUX_ENT(AT_PHDR, (target_ulong)(load_addr + exec->e_phoff)); NEW_AUX_ENT(AT_PHDR, (abi_ulong)(load_addr + exec->e_phoff));
NEW_AUX_ENT(AT_PHENT, (target_ulong)(sizeof (struct elf_phdr))); NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
NEW_AUX_ENT(AT_PHNUM, (target_ulong)(exec->e_phnum)); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
NEW_AUX_ENT(AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE)); NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
NEW_AUX_ENT(AT_BASE, (target_ulong)(interp_load_addr)); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_load_addr));
NEW_AUX_ENT(AT_FLAGS, (target_ulong)0); NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry); NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry);
NEW_AUX_ENT(AT_UID, (target_ulong) getuid()); NEW_AUX_ENT(AT_UID, (abi_ulong) getuid());
NEW_AUX_ENT(AT_EUID, (target_ulong) geteuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid());
NEW_AUX_ENT(AT_GID, (target_ulong) getgid()); NEW_AUX_ENT(AT_GID, (abi_ulong) getgid());
NEW_AUX_ENT(AT_EGID, (target_ulong) getegid()); NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid());
NEW_AUX_ENT(AT_HWCAP, (target_ulong) ELF_HWCAP); NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
if (k_platform) if (k_platform)
NEW_AUX_ENT(AT_PLATFORM, u_platform); NEW_AUX_ENT(AT_PLATFORM, u_platform);
#ifdef ARCH_DLINFO #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, static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex,
int interpreter_fd, int interpreter_fd,
target_ulong *interp_load_addr) abi_ulong *interp_load_addr)
{ {
struct elf_phdr *elf_phdata = NULL; struct elf_phdr *elf_phdata = NULL;
struct elf_phdr *eppnt; struct elf_phdr *eppnt;
target_ulong load_addr = 0; abi_ulong load_addr = 0;
int load_addr_set = 0; int load_addr_set = 0;
int retval; int retval;
target_ulong last_bss, elf_bss; abi_ulong last_bss, elf_bss;
target_ulong error; abi_ulong error;
int i; int i;
elf_bss = 0; 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 && if ((interp_elf_ex->e_type != ET_EXEC &&
interp_elf_ex->e_type != ET_DYN) || interp_elf_ex->e_type != ET_DYN) ||
!elf_check_arch(interp_elf_ex->e_machine)) { !elf_check_arch(interp_elf_ex->e_machine)) {
return ~((target_ulong)0UL); return ~((abi_ulong)0UL);
} }
/* Now read in all of the header information */ /* Now read in all of the header information */
if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) 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 *) elf_phdata = (struct elf_phdr *)
malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum);
if (!elf_phdata) if (!elf_phdata)
return ~((target_ulong)0UL); return ~((abi_ulong)0UL);
/* /*
* If the size of this structure has changed, then punt, since * 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)) { if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) {
free(elf_phdata); free(elf_phdata);
return ~((target_ulong)0UL); return ~((abi_ulong)0UL);
} }
retval = lseek(interpreter_fd, interp_elf_ex->e_phoff, SEEK_SET); 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) { if (eppnt->p_type == PT_LOAD) {
int elf_type = MAP_PRIVATE | MAP_DENYWRITE; int elf_type = MAP_PRIVATE | MAP_DENYWRITE;
int elf_prot = 0; int elf_prot = 0;
target_ulong vaddr = 0; abi_ulong vaddr = 0;
target_ulong k; abi_ulong k;
if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; if (eppnt->p_flags & PF_R) elf_prot = PROT_READ;
if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; 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 */ /* Real error */
close(interpreter_fd); close(interpreter_fd);
free(elf_phdata); free(elf_phdata);
return ~((target_ulong)0UL); return ~((abi_ulong)0UL);
} }
if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) { 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); free(elf_phdata);
*interp_load_addr = load_addr; *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. */ /* 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 elfhdr interp_elf_ex;
struct exec interp_ex; struct exec interp_ex;
int interpreter_fd = -1; /* avoid warning */ int interpreter_fd = -1; /* avoid warning */
target_ulong load_addr, load_bias; abi_ulong load_addr, load_bias;
int load_addr_set = 0; int load_addr_set = 0;
unsigned int interpreter_type = INTERPRETER_NONE; unsigned int interpreter_type = INTERPRETER_NONE;
unsigned char ibcs2_interpreter; unsigned char ibcs2_interpreter;
int i; int i;
target_ulong mapped_addr; abi_ulong mapped_addr;
struct elf_phdr * elf_ppnt; struct elf_phdr * elf_ppnt;
struct elf_phdr *elf_phdata; struct elf_phdr *elf_phdata;
target_ulong elf_bss, k, elf_brk; abi_ulong elf_bss, k, elf_brk;
int retval; int retval;
char * elf_interpreter; char * elf_interpreter;
target_ulong elf_entry, interp_load_addr = 0; abi_ulong elf_entry, interp_load_addr = 0;
int status; int status;
target_ulong start_code, end_code, start_data, end_data; abi_ulong start_code, end_code, start_data, end_data;
target_ulong reloc_func_desc = 0; abi_ulong reloc_func_desc = 0;
target_ulong elf_stack; abi_ulong elf_stack;
char passed_fileno[6]; char passed_fileno[6];
ibcs2_interpreter = 0; ibcs2_interpreter = 0;
@ -1125,9 +1135,9 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
elf_brk = 0; elf_brk = 0;
elf_stack = ~((target_ulong)0UL); elf_stack = ~((abi_ulong)0UL);
elf_interpreter = NULL; elf_interpreter = NULL;
start_code = ~((target_ulong)0UL); start_code = ~((abi_ulong)0UL);
end_code = 0; end_code = 0;
start_data = 0; start_data = 0;
end_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 */ /* OK, This is the point of no return */
info->end_data = 0; info->end_data = 0;
info->end_code = 0; info->end_code = 0;
info->start_mmap = (target_ulong)ELF_START_MMAP; info->start_mmap = (abi_ulong)ELF_START_MMAP;
info->mmap = 0; 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 /* Do this so that we can load the interpreter, if need be. We will
change some of these later */ 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++) { for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) {
int elf_prot = 0; int elf_prot = 0;
int elf_flags = 0; int elf_flags = 0;
target_ulong error; abi_ulong error;
if (elf_ppnt->p_type != PT_LOAD) if (elf_ppnt->p_type != PT_LOAD)
continue; continue;
@ -1374,7 +1384,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
close(interpreter_fd); close(interpreter_fd);
free(elf_interpreter); free(elf_interpreter);
if (elf_entry == ~((target_ulong)0UL)) { if (elf_entry == ~((abi_ulong)0UL)) {
printf("Unable to load interpreter\n"); printf("Unable to load interpreter\n");
free(elf_phdata); free(elf_phdata);
exit(-1); exit(-1);

View File

@ -1,4 +1,4 @@
#define OVERRIDE_ELF_CLASS ELFCLASS32 #define TARGET_ABI32
#define load_elf_binary load_elf_binary32 #define load_elf_binary load_elf_binary32
#define do_init_thread do_init_thread32 #define do_init_thread do_init_thread32

View File

@ -22,25 +22,25 @@
struct flat_hdr { struct flat_hdr {
char magic[4]; char magic[4];
target_ulong rev; /* version (as above) */ abi_ulong rev; /* version (as above) */
target_ulong entry; /* Offset of first executable instruction abi_ulong entry; /* Offset of first executable instruction
with text segment from beginning of file */ with text segment from beginning of file */
target_ulong data_start; /* Offset of data segment from beginning of abi_ulong data_start; /* Offset of data segment from beginning of
file */ file */
target_ulong data_end; /* Offset of end of data segment abi_ulong data_end; /* Offset of end of data segment
from beginning of file */ from beginning of file */
target_ulong bss_end; /* Offset of end of bss segment from beginning abi_ulong bss_end; /* Offset of end of bss segment from beginning
of file */ of file */
/* (It is assumed that data_end through bss_end forms the bss segment.) */ /* (It is assumed that data_end through bss_end forms the bss segment.) */
target_ulong stack_size; /* Size of stack, in bytes */ abi_ulong stack_size; /* Size of stack, in bytes */
target_ulong reloc_start; /* Offset of relocation records from abi_ulong reloc_start; /* Offset of relocation records from
beginning of file */ beginning of file */
target_ulong reloc_count; /* Number of relocation records */ abi_ulong reloc_count; /* Number of relocation records */
target_ulong flags; abi_ulong flags;
target_ulong build_date; /* When the program/library was built */ abi_ulong build_date; /* When the program/library was built */
target_ulong filler[5]; /* Reservered, set to zero */ abi_ulong filler[5]; /* Reservered, set to zero */
}; };
#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */

View File

@ -63,13 +63,13 @@
#define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */ #define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */
struct lib_info { struct lib_info {
target_ulong start_code; /* Start of text segment */ abi_ulong start_code; /* Start of text segment */
target_ulong start_data; /* Start of data segment */ abi_ulong start_data; /* Start of data segment */
target_ulong end_data; /* Start of bss section */ abi_ulong end_data; /* Start of bss section */
target_ulong start_brk; /* End of data segment */ abi_ulong start_brk; /* End of data segment */
target_ulong text_len; /* Length of text segment */ abi_ulong text_len; /* Length of text segment */
target_ulong entry; /* Start address for this module */ abi_ulong entry; /* Start address for this module */
target_ulong build_date; /* When this one was compiled */ abi_ulong build_date; /* When this one was compiled */
short loaded; /* Has this library been loaded? */ short loaded; /* Has this library been loaded? */
}; };
@ -89,7 +89,7 @@ struct linux_binprm;
*/ */
/* Push a block of strings onto the guest stack. */ /* 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; int len;
@ -102,8 +102,8 @@ static target_ulong copy_strings(target_ulong p, int n, char **s)
return p; return p;
} }
int target_pread(int fd, target_ulong ptr, target_ulong len, int target_pread(int fd, abi_ulong ptr, abi_ulong len,
target_ulong offset) abi_ulong offset)
{ {
void *buf; void *buf;
int ret; int ret;
@ -262,15 +262,15 @@ out:
/****************************************************************************/ /****************************************************************************/
static target_ulong static abi_ulong
calc_reloc(target_ulong r, struct lib_info *p, int curid, int internalp) calc_reloc(abi_ulong r, struct lib_info *p, int curid, int internalp)
{ {
target_ulong addr; abi_ulong addr;
int id; int id;
target_ulong start_brk; abi_ulong start_brk;
target_ulong start_data; abi_ulong start_data;
target_ulong text_len; abi_ulong text_len;
target_ulong start_code; abi_ulong start_code;
#ifdef CONFIG_BINFMT_SHARED_FLAT #ifdef CONFIG_BINFMT_SHARED_FLAT
#error needs checking #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, 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; struct flat_hdr * hdr;
target_ulong textpos = 0, datapos = 0, result; abi_ulong textpos = 0, datapos = 0, result;
target_ulong realdatastart = 0; abi_ulong realdatastart = 0;
target_ulong text_len, data_len, bss_len, stack_len, flags; abi_ulong text_len, data_len, bss_len, stack_len, flags;
target_ulong memp = 0; /* for finding the brk area */ abi_ulong memp = 0; /* for finding the brk area */
target_ulong extra; abi_ulong extra;
target_ulong reloc = 0, rp; abi_ulong reloc = 0, rp;
int i, rev, relocs = 0; int i, rev, relocs = 0;
target_ulong fpos; abi_ulong fpos;
target_ulong start_code, end_code; abi_ulong start_code, end_code;
target_ulong indx_len; abi_ulong indx_len;
hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ 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 * 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) if (extra < bss_len + stack_len)
extra = bss_len + stack_len; extra = bss_len + stack_len;
/* Add space for library base pointers. Make sure this does not /* Add space for library base pointers. Make sure this does not
misalign the doesn't misalign the data segment. */ misalign the doesn't misalign the data segment. */
indx_len = MAX_SHARED_LIBS * sizeof(target_ulong); indx_len = MAX_SHARED_LIBS * sizeof(abi_ulong);
indx_len = (indx_len + 15) & ~(target_ulong)15; indx_len = (indx_len + 15) & ~(abi_ulong)15;
/* /*
* there are a couple of cases here, the separate code/data * 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 #ifdef CONFIG_BINFMT_ZFLAT
if (flags & FLAT_FLAG_GZDATA) { if (flags & FLAT_FLAG_GZDATA) {
result = decompress_exec(bprm, fpos, (char *) datapos, result = decompress_exec(bprm, fpos, (char *) datapos,
data_len + (relocs * sizeof(target_ulong))) data_len + (relocs * sizeof(abi_ulong)))
} else } else
#endif #endif
{ {
result = target_pread(bprm->fd, datapos, result = target_pread(bprm->fd, datapos,
data_len + (relocs * sizeof(target_ulong)), data_len + (relocs * sizeof(abi_ulong)),
fpos); fpos);
} }
if (result < 0) { if (result < 0) {
@ -544,7 +544,7 @@ static int load_flat_file(struct linux_binprm * bprm,
text_len, 0); text_len, 0);
if (result >= 0) { if (result >= 0) {
result = target_pread(bprm->fd, datapos, result = target_pread(bprm->fd, datapos,
data_len + (relocs * sizeof(target_ulong)), data_len + (relocs * sizeof(abi_ulong)),
ntohl(hdr->data_start)); ntohl(hdr->data_start));
} }
} }
@ -597,7 +597,7 @@ static int load_flat_file(struct linux_binprm * bprm,
if (flags & FLAT_FLAG_GOTPIC) { if (flags & FLAT_FLAG_GOTPIC) {
rp = datapos; rp = datapos;
while (1) { while (1) {
target_ulong addr; abi_ulong addr;
addr = tgetl(rp); addr = tgetl(rp);
if (addr == -1) if (addr == -1)
break; break;
@ -607,7 +607,7 @@ static int load_flat_file(struct linux_binprm * bprm,
return -ENOEXEC; return -ENOEXEC;
tputl(rp, addr); 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) { if (rev > OLD_FLAT_VERSION) {
for (i = 0; i < relocs; i++) { for (i = 0; i < relocs; i++) {
target_ulong addr, relval; abi_ulong addr, relval;
/* Get the address of the pointer to be /* Get the address of the pointer to be
relocated (of course, the address has to be relocated (of course, the address has to be
relocated first). */ relocated first). */
relval = tgetl(reloc + i * sizeof (target_ulong)); relval = tgetl(reloc + i * sizeof (abi_ulong));
addr = flat_get_relocate_addr(relval); addr = flat_get_relocate_addr(relval);
rp = calc_reloc(addr, libinfo, id, 1); rp = calc_reloc(addr, libinfo, id, 1);
if (rp == RELOC_FAILED) if (rp == RELOC_FAILED)
@ -657,8 +657,8 @@ static int load_flat_file(struct linux_binprm * bprm,
} }
} else { } else {
for (i = 0; i < relocs; i++) { for (i = 0; i < relocs; i++) {
target_ulong relval; abi_ulong relval;
relval = tgetl(reloc + i * sizeof (target_ulong)); relval = tgetl(reloc + i * sizeof (abi_ulong));
old_reloc(&libinfo[0], relval); 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 image_info * info)
{ {
struct lib_info libinfo[MAX_SHARED_LIBS]; struct lib_info libinfo[MAX_SHARED_LIBS];
target_ulong p = bprm->p; abi_ulong p = bprm->p;
target_ulong stack_len; abi_ulong stack_len;
target_ulong start_addr; abi_ulong start_addr;
target_ulong sp; abi_ulong sp;
int res; int res;
int i, j; 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 */ /* Update data segment pointers for all libraries */
for (i=0; i<MAX_SHARED_LIBS; i++) { for (i=0; i<MAX_SHARED_LIBS; i++) {
if (libinfo[i].loaded) { if (libinfo[i].loaded) {
target_ulong p; abi_ulong p;
p = libinfo[i].start_data; p = libinfo[i].start_data;
for (j=0; j<MAX_SHARED_LIBS; j++) { for (j=0; j<MAX_SHARED_LIBS; j++) {
p -= 4; 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->envc, bprm->envp);
p = copy_strings(p, bprm->argc, bprm->argv); p = copy_strings(p, bprm->argc, bprm->argv);
/* Align stack. */ /* 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 /* Enforce final stack alignment of 16 bytes. This is sufficient
for all current targets, and excess alignment is harmless. */ for all current targets, and excess alignment is harmless. */
stack_len = bprm->envc + bprm->argc + 2; stack_len = bprm->envc + bprm->argc + 2;
stack_len += 3; /* argc, arvg, argp */ stack_len += 3; /* argc, arvg, argp */
stack_len *= sizeof(target_ulong); stack_len *= sizeof(abi_ulong);
if ((sp + stack_len) & 15) if ((sp + stack_len) & 15)
sp -= 16 - ((sp + stack_len) & 15); sp -= 16 - ((sp + stack_len) & 15);
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1); sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1);

View File

@ -31,7 +31,7 @@ struct target_pt_regs {
struct target_modify_ldt_ldt_s { struct target_modify_ldt_ldt_s {
unsigned int entry_number; unsigned int entry_number;
target_ulong base_addr; abi_ulong base_addr;
unsigned int limit; unsigned int limit;
unsigned int flags; unsigned int flags;
}; };
@ -79,22 +79,22 @@ struct target_vm86_regs {
/* /*
* normal regs, with special meaning for the segment descriptors.. * normal regs, with special meaning for the segment descriptors..
*/ */
target_long ebx; abi_long ebx;
target_long ecx; abi_long ecx;
target_long edx; abi_long edx;
target_long esi; abi_long esi;
target_long edi; abi_long edi;
target_long ebp; abi_long ebp;
target_long eax; abi_long eax;
target_long __null_ds; abi_long __null_ds;
target_long __null_es; abi_long __null_es;
target_long __null_fs; abi_long __null_fs;
target_long __null_gs; abi_long __null_gs;
target_long orig_eax; abi_long orig_eax;
target_long eip; abi_long eip;
unsigned short cs, __csh; unsigned short cs, __csh;
target_long eflags; abi_long eflags;
target_long esp; abi_long esp;
unsigned short ss, __ssh; unsigned short ss, __ssh;
/* /*
* these are specific to v86 mode: * these are specific to v86 mode:
@ -106,14 +106,14 @@ struct target_vm86_regs {
}; };
struct target_revectored_struct { struct target_revectored_struct {
target_ulong __map[8]; /* 256 bits */ abi_ulong __map[8]; /* 256 bits */
}; };
struct target_vm86_struct { struct target_vm86_struct {
struct target_vm86_regs regs; struct target_vm86_regs regs;
target_ulong flags; abi_ulong flags;
target_ulong screen_bitmap; abi_ulong screen_bitmap;
target_ulong cpu_type; abi_ulong cpu_type;
struct target_revectored_struct int_revectored; struct target_revectored_struct int_revectored;
struct target_revectored_struct int21_revectored; struct target_revectored_struct int21_revectored;
}; };
@ -124,7 +124,7 @@ struct target_vm86_struct {
#define TARGET_VM86_SCREEN_BITMAP 0x0001 #define TARGET_VM86_SCREEN_BITMAP 0x0001
struct target_vm86plus_info_struct { struct target_vm86plus_info_struct {
target_ulong flags; abi_ulong flags;
#define TARGET_force_return_for_pic (1 << 0) #define TARGET_force_return_for_pic (1 << 0)
#define TARGET_vm86dbg_active (1 << 1) /* for debugger */ #define TARGET_vm86dbg_active (1 << 1) /* for debugger */
#define TARGET_vm86dbg_TFpendig (1 << 2) /* 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_vm86plus_struct {
struct target_vm86_regs regs; struct target_vm86_regs regs;
target_ulong flags; abi_ulong flags;
target_ulong screen_bitmap; abi_ulong screen_bitmap;
target_ulong cpu_type; abi_ulong cpu_type;
struct target_revectored_struct int_revectored; struct target_revectored_struct int_revectored;
struct target_revectored_struct int21_revectored; struct target_revectored_struct int21_revectored;
struct target_vm86plus_info_struct vm86plus; struct target_vm86plus_info_struct vm86plus;

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->regs[R_ESP];
} }

View File

@ -13,7 +13,7 @@
#define NGROUPS 32 #define NGROUPS 32
/* ??? This should really be somewhere else. */ /* ??? 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) unsigned long len)
{ {
void *host_ptr; 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. */ /* Construct the envp and argv tables on the target stack. */
target_ulong loader_build_argptr(int envc, int argc, target_ulong sp, abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
target_ulong stringp, int push_ptr) abi_ulong stringp, int push_ptr)
{ {
int n = sizeof(target_ulong); int n = sizeof(abi_ulong);
target_ulong envp; abi_ulong envp;
target_ulong argv; abi_ulong argv;
sp -= (envc + 1) * n; sp -= (envc + 1) * n;
envp = sp; envp = sp;

View File

@ -3,14 +3,14 @@
stack during a system call. */ stack during a system call. */
struct target_pt_regs { struct target_pt_regs {
target_long d1, d2, d3, d4, d5, d6, d7; abi_long d1, d2, d3, d4, d5, d6, d7;
target_long a0, a1, a2, a3, a4, a5, a6; abi_long a0, a1, a2, a3, a4, a5, a6;
target_ulong d0; abi_ulong d0;
target_ulong usp; abi_ulong usp;
target_ulong orig_d0; abi_ulong orig_d0;
int16_t stkadj; int16_t stkadj;
uint16_t sr; uint16_t sr;
target_ulong pc; abi_ulong pc;
uint16_t fntvex; uint16_t fntvex;
uint16_t __fill; uint16_t __fill;
}; };

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;

View File

@ -168,7 +168,7 @@ static void set_idt(int n, unsigned int dpl)
void cpu_loop(CPUX86State *env) void cpu_loop(CPUX86State *env)
{ {
int trapnr; int trapnr;
target_ulong pc; abi_ulong pc;
target_siginfo_t info; target_siginfo_t info;
for(;;) { for(;;) {
@ -305,11 +305,11 @@ void cpu_loop(CPUX86State *env)
#ifdef TARGET_ARM #ifdef TARGET_ARM
/* XXX: find a better solution */ /* 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) if (last < start)
return; 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) static inline void save_window_offset(CPUSPARCState *env, int cwp1)
{ {
unsigned int i; unsigned int i;
target_ulong sp_ptr; abi_ulong sp_ptr;
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
#if defined(DEBUG_WIN) #if defined(DEBUG_WIN)
@ -483,7 +483,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
#endif #endif
for(i = 0; i < 16; i++) { for(i = 0; i < 16; i++) {
tputl(sp_ptr, env->regbase[get_reg_index(env, cwp1, 8 + 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) static void restore_window(CPUSPARCState *env)
{ {
unsigned int new_wim, i, cwp1; unsigned int new_wim, i, cwp1;
target_ulong sp_ptr; abi_ulong sp_ptr;
new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) & new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) &
((1LL << NWINDOWS) - 1); ((1LL << NWINDOWS) - 1);
@ -519,7 +519,7 @@ static void restore_window(CPUSPARCState *env)
#endif #endif
for(i = 0; i < 16; i++) { for(i = 0; i < 16; i++) {
env->regbase[get_reg_index(env, cwp1, 8 + i)] = tgetl(sp_ptr); 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; env->wim = new_wim;
#ifdef TARGET_SPARC64 #ifdef TARGET_SPARC64
@ -572,14 +572,14 @@ void cpu_loop (CPUSPARCState *env)
env->regwptr[2], env->regwptr[3], env->regwptr[2], env->regwptr[3],
env->regwptr[4], env->regwptr[5]); env->regwptr[4], env->regwptr[5]);
if ((unsigned int)ret >= (unsigned int)(-515)) { if ((unsigned int)ret >= (unsigned int)(-515)) {
#ifdef TARGET_SPARC64 #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc |= PSR_CARRY; env->xcc |= PSR_CARRY;
#else #else
env->psr |= PSR_CARRY; env->psr |= PSR_CARRY;
#endif #endif
ret = -ret; ret = -ret;
} else { } else {
#ifdef TARGET_SPARC64 #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc &= ~PSR_CARRY; env->xcc &= ~PSR_CARRY;
#else #else
env->psr &= ~PSR_CARRY; env->psr &= ~PSR_CARRY;
@ -591,6 +591,9 @@ void cpu_loop (CPUSPARCState *env)
env->npc = env->npc + 4; env->npc = env->npc + 4;
break; break;
case 0x83: /* flush windows */ case 0x83: /* flush windows */
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(env); flush_windows(env);
/* next instruction */ /* next instruction */
env->pc = env->npc; env->pc = env->npc;
@ -1489,8 +1492,8 @@ void cpu_loop(CPUMIPSState *env)
ret = -ENOSYS; ret = -ENOSYS;
} else { } else {
int nb_args; int nb_args;
target_ulong sp_reg; abi_ulong sp_reg;
target_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0; abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
nb_args = mips_syscall_args[syscall_num]; nb_args = mips_syscall_args[syscall_num];
sp_reg = env->gpr[29][env->current_tc]; sp_reg = env->gpr[29][env->current_tc];
@ -2239,7 +2242,7 @@ int main(int argc, char **argv)
int i; int i;
for(i = 0; i < 28; 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->ipr[IPR_USP] = regs->usp;
env->ir[30] = regs->usp; env->ir[30] = regs->usp;

View File

@ -4,18 +4,18 @@
struct target_pt_regs { struct target_pt_regs {
/* Pad bytes for argument save space on the stack. */ /* Pad bytes for argument save space on the stack. */
target_ulong pad0[6]; abi_ulong pad0[6];
/* Saved main processor registers. */ /* Saved main processor registers. */
target_ulong regs[32]; abi_ulong regs[32];
/* Saved special registers. */ /* Saved special registers. */
target_ulong cp0_status; abi_ulong cp0_status;
target_ulong lo; abi_ulong lo;
target_ulong hi; abi_ulong hi;
target_ulong cp0_badvaddr; abi_ulong cp0_badvaddr;
target_ulong cp0_cause; abi_ulong cp0_cause;
target_ulong cp0_epc; abi_ulong cp0_epc;
}; };
/* Target errno definitions taken from asm-mips/errno.h */ /* Target errno definitions taken from asm-mips/errno.h */

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_long ss_sp; abi_long ss_sp;
target_ulong ss_size; abi_ulong ss_size;
target_long ss_flags; abi_long ss_flags;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->gpr[29][state->current_tc];
} }

View File

@ -4,15 +4,15 @@
struct target_pt_regs { struct target_pt_regs {
/* Saved main processor registers. */ /* Saved main processor registers. */
target_ulong regs[32]; abi_ulong regs[32];
/* Saved special registers. */ /* Saved special registers. */
target_ulong cp0_status; abi_ulong cp0_status;
target_ulong lo; abi_ulong lo;
target_ulong hi; abi_ulong hi;
target_ulong cp0_badvaddr; abi_ulong cp0_badvaddr;
target_ulong cp0_cause; abi_ulong cp0_cause;
target_ulong cp0_epc; abi_ulong cp0_epc;
}; };
/* Target errno definitions taken from asm-mips/errno.h */ /* Target errno definitions taken from asm-mips/errno.h */

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_long ss_sp; abi_long ss_sp;
target_ulong ss_size; abi_ulong ss_size;
target_long ss_flags; abi_long ss_flags;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->gpr[29][state->current_tc];
} }

View File

@ -30,9 +30,9 @@
//#define DEBUG_MMAP //#define DEBUG_MMAP
/* NOTE: all the constants are the HOST ones, but addresses are target. */ /* 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; int prot1, ret;
#ifdef DEBUG_MMAP #ifdef DEBUG_MMAP
@ -96,11 +96,11 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
} }
/* map an incomplete host page */ /* map an incomplete host page */
static int mmap_frag(target_ulong real_start, static int mmap_frag(abi_ulong real_start,
target_ulong start, target_ulong end, abi_ulong start, abi_ulong end,
int prot, int flags, int fd, target_ulong offset) int prot, int flags, int fd, abi_ulong offset)
{ {
target_ulong real_end, ret, addr; abi_ulong real_end, ret, addr;
void *host_start; void *host_start;
int prot1, prot_new; int prot1, prot_new;
@ -152,17 +152,17 @@ static int mmap_frag(target_ulong real_start,
} }
/* NOTE: all the constants are the HOST ones */ /* NOTE: all the constants are the HOST ones */
target_long target_mmap(target_ulong start, target_ulong len, int prot, abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
int flags, int fd, target_ulong offset) 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; unsigned long host_start;
#if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__) || \ #if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__) || \
defined(__ia64) || defined(__mips__) defined(__ia64) || defined(__mips__)
static target_ulong last_start = 0x40000000; static abi_ulong last_start = 0x40000000;
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
/* Cygwin doesn't have a whole lot of address space. */ /* Cygwin doesn't have a whole lot of address space. */
static target_ulong last_start = 0x18000000; static abi_ulong last_start = 0x18000000;
#endif #endif
#ifdef DEBUG_MMAP #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 * TARGET_PAGE_SIZE, see exec.c. qemu_real_host_page_size is the
* hosts real page size. * hosts real page size.
*/ */
target_ulong host_end; abi_ulong host_end;
unsigned long host_aligned_start; unsigned long host_aligned_start;
host_len = HOST_PAGE_ALIGN(host_len + qemu_host_page_size 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; 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; int prot, ret;
#ifdef DEBUG_MMAP #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 /* XXX: currently, we only handle MAP_ANONYMOUS and not MAP_FIXED
blocks which have been allocated starting on a host page */ blocks which have been allocated starting on a host page */
target_long target_mremap(target_ulong old_addr, target_ulong old_size, abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
target_ulong new_size, unsigned long flags, abi_ulong new_size, unsigned long flags,
target_ulong new_addr) abi_ulong new_addr)
{ {
int prot; int prot;
unsigned long host_addr; unsigned long host_addr;
@ -426,9 +426,9 @@ target_long target_mremap(target_ulong old_addr, target_ulong old_size,
return new_addr; 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) if (start & ~TARGET_PAGE_MASK)
return -EINVAL; return -EINVAL;

View File

@ -44,7 +44,7 @@ struct target_pt_regs {
/* ioctls */ /* ioctls */
struct target_revectored_struct { struct target_revectored_struct {
target_ulong __map[8]; /* 256 bits */ abi_ulong __map[8]; /* 256 bits */
}; };
/* /*

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->gpr[1];
} }

View File

@ -44,7 +44,7 @@ struct target_pt_regs {
/* ioctls */ /* ioctls */
struct target_revectored_struct { struct target_revectored_struct {
target_ulong __map[8]; /* 256 bits */ abi_ulong __map[8]; /* 256 bits */
}; };
/* /*

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->gpr[1];
} }

View File

@ -1,13 +1,23 @@
#ifndef QEMU_H #ifndef QEMU_H
#define QEMU_H #define QEMU_H
#include "thunk.h"
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include "syscall_defs.h"
#include "cpu.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 "syscall.h"
#include "target_signal.h" #include "target_signal.h"
#include "gdbstub.h" #include "gdbstub.h"
@ -17,20 +27,20 @@
* task_struct fields in the kernel * task_struct fields in the kernel
*/ */
struct image_info { struct image_info {
target_ulong load_addr; abi_ulong load_addr;
target_ulong start_code; abi_ulong start_code;
target_ulong end_code; abi_ulong end_code;
target_ulong start_data; abi_ulong start_data;
target_ulong end_data; abi_ulong end_data;
target_ulong start_brk; abi_ulong start_brk;
target_ulong brk; abi_ulong brk;
target_ulong start_mmap; abi_ulong start_mmap;
target_ulong mmap; abi_ulong mmap;
target_ulong rss; abi_ulong rss;
target_ulong start_stack; abi_ulong start_stack;
target_ulong entry; abi_ulong entry;
target_ulong code_offset; abi_ulong code_offset;
target_ulong data_offset; abi_ulong data_offset;
char **host_argv; char **host_argv;
int personality; int personality;
}; };
@ -67,7 +77,7 @@ typedef struct TaskState {
int swi_errno; int swi_errno;
#endif #endif
#if defined(TARGET_I386) && !defined(TARGET_X86_64) #if defined(TARGET_I386) && !defined(TARGET_X86_64)
target_ulong target_v86; abi_ulong target_v86;
struct vm86_saved_state vm86_saved_regs; struct vm86_saved_state vm86_saved_regs;
struct target_vm86plus_struct vm86plus; struct target_vm86plus_struct vm86plus;
uint32_t v86flags; uint32_t v86flags;
@ -105,7 +115,7 @@ extern const char *qemu_uname_release;
struct linux_binprm { struct linux_binprm {
char buf[128]; char buf[128];
void *page[MAX_ARG_PAGES]; void *page[MAX_ARG_PAGES];
target_ulong p; abi_ulong p;
int fd; int fd;
int e_uid, e_gid; int e_uid, e_gid;
int argc, envc; int argc, envc;
@ -115,8 +125,8 @@ struct linux_binprm {
}; };
void do_init_thread(struct target_pt_regs *regs, struct image_info *infop); 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, abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
target_ulong stringp, int push_ptr); abi_ulong stringp, int push_ptr);
int loader_exec(const char * filename, char ** argv, char ** envp, int loader_exec(const char * filename, char ** argv, char ** envp,
struct target_pt_regs * regs, struct image_info *infop); 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); struct image_info *info);
#endif #endif
void memcpy_to_target(target_ulong dest, const void *src, void memcpy_to_target(abi_ulong dest, const void *src,
unsigned long len); unsigned long len);
void target_set_brk(target_ulong new_brk); void target_set_brk(abi_ulong new_brk);
target_long do_brk(target_ulong new_brk); abi_long do_brk(abi_ulong new_brk);
void syscall_init(void); void syscall_init(void);
target_long do_syscall(void *cpu_env, int num, target_long arg1, abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
target_long arg2, target_long arg3, target_long arg4, abi_long arg2, abi_long arg3, abi_long arg4,
target_long arg5, target_long arg6); abi_long arg5, abi_long arg6);
void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2)));
extern CPUState *global_env; extern CPUState *global_env;
void cpu_loop(CPUState *env); void cpu_loop(CPUState *env);
@ -157,28 +167,28 @@ long do_sigreturn(CPUState *env);
long do_rt_sigreturn(CPUState *env); long do_rt_sigreturn(CPUState *env);
int do_sigaltstack(const struct target_sigaltstack *uss, int do_sigaltstack(const struct target_sigaltstack *uss,
struct target_sigaltstack *uoss, struct target_sigaltstack *uoss,
target_ulong sp); abi_ulong sp);
#ifdef TARGET_I386 #ifdef TARGET_I386
/* vm86.c */ /* vm86.c */
void save_v86_state(CPUX86State *env); void save_v86_state(CPUX86State *env);
void handle_vm86_trap(CPUX86State *env, int trapno); void handle_vm86_trap(CPUX86State *env, int trapno);
void handle_vm86_fault(CPUX86State *env); 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) #elif defined(TARGET_SPARC64)
void sparc64_set_context(CPUSPARCState *env); void sparc64_set_context(CPUSPARCState *env);
void sparc64_get_context(CPUSPARCState *env); void sparc64_get_context(CPUSPARCState *env);
#endif #endif
/* mmap.c */ /* mmap.c */
int target_mprotect(target_ulong start, target_ulong len, int prot); int target_mprotect(abi_ulong start, abi_ulong len, int prot);
target_long target_mmap(target_ulong start, target_ulong len, int prot, abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
int flags, int fd, target_ulong offset); int flags, int fd, abi_ulong offset);
int target_munmap(target_ulong start, target_ulong len); int target_munmap(abi_ulong start, abi_ulong len);
target_long target_mremap(target_ulong old_addr, target_ulong old_size, abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
target_ulong new_size, unsigned long flags, abi_ulong new_size, unsigned long flags,
target_ulong new_addr); abi_ulong new_addr);
int target_msync(target_ulong start, target_ulong len, int flags); int target_msync(abi_ulong start, abi_ulong len, int flags);
/* user access */ /* 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 /* 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. */ 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 #ifdef DEBUG_REMAP
void *addr; 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 /* Unlock an area of guest memory. The first LEN bytes must be flushed back
to guest memory. */ to guest memory. */
static inline void unlock_user(void *host_addr, target_ulong guest_addr, static inline void unlock_user(void *host_addr, abi_ulong guest_addr,
long len) long len)
{ {
#ifdef DEBUG_REMAP #ifdef DEBUG_REMAP
if (host_addr == g2h(guest_addr)) 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. */ /* 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)); return strlen(g2h(ptr));
} }
/* Like lock_user but for null terminated strings. */ /* 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; long len;
len = target_strlen(guest_addr) + 1; 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 tput32(addr, val) stl(addr, val)
#define tget64(addr) ldq(addr) #define tget64(addr) ldq(addr)
#define tput64(addr, val) stq(addr, val) #define tput64(addr, val) stq(addr, val)
#if TARGET_LONG_BITS == 64 #if TARGET_ABI_BITS == 64
#define tgetl(addr) ldq(addr) #define tgetl(addr) ldq(addr)
#define tputl(addr, val) stq(addr, val) #define tputl(addr, val) stq(addr, val)
#else #else

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;

View File

@ -26,8 +26,8 @@
#include <errno.h> #include <errno.h>
#include <sys/ucontext.h> #include <sys/ucontext.h>
#include "target_signal.h"
#include "qemu.h" #include "qemu.h"
#include "target_signal.h"
//#define DEBUG_SIGNAL //#define DEBUG_SIGNAL
@ -134,12 +134,12 @@ static void host_to_target_sigset_internal(target_sigset_t *d,
if (sigmask & (1 << i)) if (sigmask & (1 << i))
target_sigmask |= 1 << (host_to_target_signal(i + 1) - 1); 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; d->sig[0] = target_sigmask;
for(i = 1;i < TARGET_NSIG_WORDS; i++) { for(i = 1;i < TARGET_NSIG_WORDS; i++) {
d->sig[i] = ((unsigned long *)s)[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[0] = target_sigmask;
d->sig[1] = sigmask >> 32; d->sig[1] = sigmask >> 32;
#else #else
@ -161,7 +161,7 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s)
{ {
int i; int i;
unsigned long sigmask; unsigned long sigmask;
target_ulong target_sigmask; abi_ulong target_sigmask;
target_sigmask = s->sig[0]; target_sigmask = s->sig[0];
sigmask = 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)) if (target_sigmask & (1 << i))
sigmask |= 1 << (target_to_host_signal(i + 1) - 1); 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; ((unsigned long *)d)[0] = sigmask;
for(i = 1;i < TARGET_NSIG_WORDS; i++) { for(i = 1;i < TARGET_NSIG_WORDS; i++) {
((unsigned long *)d)[i] = s->sig[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); ((unsigned long *)d)[0] = sigmask | ((unsigned long)(s->sig[1]) << 32);
#else #else
#warning target_to_host_sigset #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) 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); 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) const sigset_t *sigset)
{ {
target_sigset_t d; 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, void target_to_host_old_sigset(sigset_t *sigset,
const target_ulong *old_sigset) const abi_ulong *old_sigset)
{ {
target_sigset_t d; target_sigset_t d;
int i; 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; tinfo->_sifields._rt._uid = info->si_uid;
/* XXX: potential problem if 64 bit */ /* XXX: potential problem if 64 bit */
tinfo->_sifields._rt._sigval.sival_ptr = 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 emulated_sigaction *k;
struct sigqueue *q, **pq; struct sigqueue *q, **pq;
target_ulong handler; abi_ulong handler;
#if defined(DEBUG_SIGNAL) #if defined(DEBUG_SIGNAL)
fprintf(stderr, "queue_signal: sig=%d\n", 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, int do_sigaltstack(const struct target_sigaltstack *uss,
struct target_sigaltstack *uoss, struct target_sigaltstack *uoss,
target_ulong sp) abi_ulong sp)
{ {
int ret; int ret;
struct target_sigaltstack oss; struct target_sigaltstack oss;
@ -579,29 +579,29 @@ struct target_fpxreg {
}; };
struct target_xmmreg { struct target_xmmreg {
target_ulong element[4]; abi_ulong element[4];
}; };
struct target_fpstate { struct target_fpstate {
/* Regular FPU environment */ /* Regular FPU environment */
target_ulong cw; abi_ulong cw;
target_ulong sw; abi_ulong sw;
target_ulong tag; abi_ulong tag;
target_ulong ipoff; abi_ulong ipoff;
target_ulong cssel; abi_ulong cssel;
target_ulong dataoff; abi_ulong dataoff;
target_ulong datasel; abi_ulong datasel;
struct target_fpreg _st[8]; struct target_fpreg _st[8];
uint16_t status; uint16_t status;
uint16_t magic; /* 0xffff = regular FPU data only */ uint16_t magic; /* 0xffff = regular FPU data only */
/* FXSR FPU environment */ /* FXSR FPU environment */
target_ulong _fxsr_env[6]; /* FXSR FPU env is ignored */ abi_ulong _fxsr_env[6]; /* FXSR FPU env is ignored */
target_ulong mxcsr; abi_ulong mxcsr;
target_ulong reserved; abi_ulong reserved;
struct target_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ struct target_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
struct target_xmmreg _xmm[8]; struct target_xmmreg _xmm[8];
target_ulong padding[56]; abi_ulong padding[56];
}; };
#define X86_FXSR_MAGIC 0x0000 #define X86_FXSR_MAGIC 0x0000
@ -611,29 +611,29 @@ struct target_sigcontext {
uint16_t fs, __fsh; uint16_t fs, __fsh;
uint16_t es, __esh; uint16_t es, __esh;
uint16_t ds, __dsh; uint16_t ds, __dsh;
target_ulong edi; abi_ulong edi;
target_ulong esi; abi_ulong esi;
target_ulong ebp; abi_ulong ebp;
target_ulong esp; abi_ulong esp;
target_ulong ebx; abi_ulong ebx;
target_ulong edx; abi_ulong edx;
target_ulong ecx; abi_ulong ecx;
target_ulong eax; abi_ulong eax;
target_ulong trapno; abi_ulong trapno;
target_ulong err; abi_ulong err;
target_ulong eip; abi_ulong eip;
uint16_t cs, __csh; uint16_t cs, __csh;
target_ulong eflags; abi_ulong eflags;
target_ulong esp_at_signal; abi_ulong esp_at_signal;
uint16_t ss, __ssh; uint16_t ss, __ssh;
target_ulong fpstate; /* pointer */ abi_ulong fpstate; /* pointer */
target_ulong oldmask; abi_ulong oldmask;
target_ulong cr2; abi_ulong cr2;
}; };
struct target_ucontext { struct target_ucontext {
target_ulong tuc_flags; abi_ulong tuc_flags;
target_ulong tuc_link; abi_ulong tuc_link;
target_stack_t tuc_stack; target_stack_t tuc_stack;
struct target_sigcontext tuc_mcontext; struct target_sigcontext tuc_mcontext;
target_sigset_t tuc_sigmask; /* mask last for extensibility */ target_sigset_t tuc_sigmask; /* mask last for extensibility */
@ -641,20 +641,20 @@ struct target_ucontext {
struct sigframe struct sigframe
{ {
target_ulong pretcode; abi_ulong pretcode;
int sig; int sig;
struct target_sigcontext sc; struct target_sigcontext sc;
struct target_fpstate fpstate; struct target_fpstate fpstate;
target_ulong extramask[TARGET_NSIG_WORDS-1]; abi_ulong extramask[TARGET_NSIG_WORDS-1];
char retcode[8]; char retcode[8];
}; };
struct rt_sigframe struct rt_sigframe
{ {
target_ulong pretcode; abi_ulong pretcode;
int sig; int sig;
target_ulong pinfo; abi_ulong pinfo;
target_ulong puc; abi_ulong puc;
struct target_siginfo info; struct target_siginfo info;
struct target_ucontext uc; struct target_ucontext uc;
struct target_fpstate fpstate; 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] ? current->exec_domain->signal_invmap[sig]
: */sig), : */sig),
&frame->sig); &frame->sig);
err |= __put_user((target_ulong)&frame->info, &frame->pinfo); err |= __put_user((abi_ulong)&frame->info, &frame->pinfo);
err |= __put_user((target_ulong)&frame->uc, &frame->puc); err |= __put_user((abi_ulong)&frame->uc, &frame->puc);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, info);
if (err) if (err)
goto give_sigsegv; goto give_sigsegv;
@ -977,32 +977,32 @@ badframe:
#elif defined(TARGET_ARM) #elif defined(TARGET_ARM)
struct target_sigcontext { struct target_sigcontext {
target_ulong trap_no; abi_ulong trap_no;
target_ulong error_code; abi_ulong error_code;
target_ulong oldmask; abi_ulong oldmask;
target_ulong arm_r0; abi_ulong arm_r0;
target_ulong arm_r1; abi_ulong arm_r1;
target_ulong arm_r2; abi_ulong arm_r2;
target_ulong arm_r3; abi_ulong arm_r3;
target_ulong arm_r4; abi_ulong arm_r4;
target_ulong arm_r5; abi_ulong arm_r5;
target_ulong arm_r6; abi_ulong arm_r6;
target_ulong arm_r7; abi_ulong arm_r7;
target_ulong arm_r8; abi_ulong arm_r8;
target_ulong arm_r9; abi_ulong arm_r9;
target_ulong arm_r10; abi_ulong arm_r10;
target_ulong arm_fp; abi_ulong arm_fp;
target_ulong arm_ip; abi_ulong arm_ip;
target_ulong arm_sp; abi_ulong arm_sp;
target_ulong arm_lr; abi_ulong arm_lr;
target_ulong arm_pc; abi_ulong arm_pc;
target_ulong arm_cpsr; abi_ulong arm_cpsr;
target_ulong fault_address; abi_ulong fault_address;
}; };
struct target_ucontext { struct target_ucontext {
target_ulong tuc_flags; abi_ulong tuc_flags;
target_ulong tuc_link; abi_ulong tuc_link;
target_stack_t tuc_stack; target_stack_t tuc_stack;
struct target_sigcontext tuc_mcontext; struct target_sigcontext tuc_mcontext;
target_sigset_t tuc_sigmask; /* mask last for extensibility */ target_sigset_t tuc_sigmask; /* mask last for extensibility */
@ -1011,8 +1011,8 @@ struct target_ucontext {
struct sigframe struct sigframe
{ {
struct target_sigcontext sc; struct target_sigcontext sc;
target_ulong extramask[TARGET_NSIG_WORDS-1]; abi_ulong extramask[TARGET_NSIG_WORDS-1];
target_ulong retcode; abi_ulong retcode;
}; };
struct rt_sigframe struct rt_sigframe
@ -1021,7 +1021,7 @@ struct rt_sigframe
void *puc; void *puc;
struct target_siginfo info; struct target_siginfo info;
struct target_ucontext uc; struct target_ucontext uc;
target_ulong retcode; abi_ulong retcode;
}; };
#define TARGET_CONFIG_CPU_32 1 #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_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_sigreturn))
#define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_rt_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_SIGRETURN, SWI_THUMB_SIGRETURN,
SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_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 static int
setup_return(CPUState *env, struct emulated_sigaction *ka, 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; abi_ulong handler = (abi_ulong)ka->sa._sa_handler;
target_ulong retcode; abi_ulong retcode;
int thumb = 0; int thumb = 0;
#if defined(TARGET_CONFIG_CPU_32) #if defined(TARGET_CONFIG_CPU_32)
#if 0 #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. * 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 */ #endif /* TARGET_CONFIG_CPU_32 */
if (ka->sa.sa_flags & TARGET_SA_RESTORER) { if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
retcode = (target_ulong)ka->sa.sa_restorer; retcode = (abi_ulong)ka->sa.sa_restorer;
} else { } else {
unsigned int idx = thumb; unsigned int idx = thumb;
@ -1148,10 +1148,10 @@ setup_return(CPUState *env, struct emulated_sigaction *ka,
if (__put_user(retcodes[idx], rc)) if (__put_user(retcodes[idx], rc))
return 1; return 1;
#if 0 #if 0
flush_icache_range((target_ulong)rc, flush_icache_range((abi_ulong)rc,
(target_ulong)(rc + 1)); (abi_ulong)(rc + 1));
#endif #endif
retcode = ((target_ulong)rc) + thumb; retcode = ((abi_ulong)rc) + thumb;
} }
env->regs[0] = usig; 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))) if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
return /* 1 */; return /* 1 */;
__put_user_error(&frame->info, (target_ulong *)&frame->pinfo, err); __put_user_error(&frame->info, (abi_ulong *)&frame->pinfo, err);
__put_user_error(&frame->uc, (target_ulong *)&frame->puc, err); __put_user_error(&frame->uc, (abi_ulong *)&frame->puc, err);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, info);
/* Clear all the bits of the ucontext we don't use. */ /* 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. * arguments for the signal handler.
* -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
*/ */
env->regs[1] = (target_ulong)frame->pinfo; env->regs[1] = (abi_ulong)frame->pinfo;
env->regs[2] = (target_ulong)frame->puc; env->regs[2] = (abi_ulong)frame->puc;
} }
// return err; // return err;
@ -1360,48 +1360,48 @@ badframe:
/* This is what SunOS does, so shall I. */ /* This is what SunOS does, so shall I. */
struct target_sigcontext { struct target_sigcontext {
target_ulong sigc_onstack; /* state to restore */ abi_ulong sigc_onstack; /* state to restore */
target_ulong sigc_mask; /* sigmask to restore */ abi_ulong sigc_mask; /* sigmask to restore */
target_ulong sigc_sp; /* stack pointer */ abi_ulong sigc_sp; /* stack pointer */
target_ulong sigc_pc; /* program counter */ abi_ulong sigc_pc; /* program counter */
target_ulong sigc_npc; /* next program counter */ abi_ulong sigc_npc; /* next program counter */
target_ulong sigc_psr; /* for condition codes etc */ abi_ulong sigc_psr; /* for condition codes etc */
target_ulong sigc_g1; /* User uses these two registers */ abi_ulong sigc_g1; /* User uses these two registers */
target_ulong sigc_o0; /* within the trampoline code. */ abi_ulong sigc_o0; /* within the trampoline code. */
/* Now comes information regarding the users window set /* Now comes information regarding the users window set
* at the time of the signal. * at the time of the signal.
*/ */
target_ulong sigc_oswins; /* outstanding windows */ abi_ulong sigc_oswins; /* outstanding windows */
/* stack ptrs for each regwin buf */ /* stack ptrs for each regwin buf */
char *sigc_spbuf[__SUNOS_MAXWIN]; char *sigc_spbuf[__SUNOS_MAXWIN];
/* Windows to restore after signal */ /* Windows to restore after signal */
struct { struct {
target_ulong locals[8]; abi_ulong locals[8];
target_ulong ins[8]; abi_ulong ins[8];
} sigc_wbuf[__SUNOS_MAXWIN]; } sigc_wbuf[__SUNOS_MAXWIN];
}; };
/* A Sparc stack frame */ /* A Sparc stack frame */
struct sparc_stackf { struct sparc_stackf {
target_ulong locals[8]; abi_ulong locals[8];
target_ulong ins[6]; abi_ulong ins[6];
struct sparc_stackf *fp; struct sparc_stackf *fp;
target_ulong callers_pc; abi_ulong callers_pc;
char *structptr; char *structptr;
target_ulong xargs[6]; abi_ulong xargs[6];
target_ulong xxargs[1]; abi_ulong xxargs[1];
}; };
typedef struct { typedef struct {
struct { struct {
target_ulong psr; abi_ulong psr;
target_ulong pc; abi_ulong pc;
target_ulong npc; abi_ulong npc;
target_ulong y; abi_ulong y;
target_ulong u_regs[16]; /* globals and ins */ abi_ulong u_regs[16]; /* globals and ins */
} si_regs; } si_regs;
int si_mask; int si_mask;
} __siginfo_t; } __siginfo_t;
@ -1421,15 +1421,15 @@ struct target_signal_frame {
struct sparc_stackf ss; struct sparc_stackf ss;
__siginfo_t info; __siginfo_t info;
qemu_siginfo_fpu_t *fpu_save; qemu_siginfo_fpu_t *fpu_save;
target_ulong insns[2] __attribute__ ((aligned (8))); abi_ulong insns[2] __attribute__ ((aligned (8)));
target_ulong extramask[TARGET_NSIG_WORDS - 1]; abi_ulong extramask[TARGET_NSIG_WORDS - 1];
target_ulong extra_size; /* Should be 0 */ abi_ulong extra_size; /* Should be 0 */
qemu_siginfo_fpu_t fpu_state; qemu_siginfo_fpu_t fpu_state;
}; };
struct target_rt_signal_frame { struct target_rt_signal_frame {
struct sparc_stackf ss; struct sparc_stackf ss;
siginfo_t info; siginfo_t info;
target_ulong regs[20]; abi_ulong regs[20];
sigset_t mask; sigset_t mask;
qemu_siginfo_fpu_t *fpu_save; qemu_siginfo_fpu_t *fpu_save;
unsigned int insns[2]; unsigned int insns[2];
@ -1468,7 +1468,7 @@ static inline void *get_sigframe(struct emulated_sigaction *sa, CPUState *env, u
} }
static int 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; int err = 0, i;
@ -1634,7 +1634,7 @@ long do_sigreturn(CPUState *env)
uint32_t up_psr, pc, npc; uint32_t up_psr, pc, npc;
target_sigset_t set; target_sigset_t set;
sigset_t host_set; sigset_t host_set;
target_ulong fpu_save; abi_ulong fpu_save;
int err, i; int err, i;
sf = (struct target_signal_frame *)g2h(env->regwptr[UREG_FP]); 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(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) //if (fpu_save)
// err |= restore_fpu_state(env, 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_O7 18
#define MC_NGREG 19 #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]; typedef target_mc_greg_t target_mc_gregset_t[MC_NGREG];
struct target_mc_fq { struct target_mc_fq {
target_ulong *mcfq_addr; abi_ulong *mcfq_addr;
uint32_t mcfq_insn; uint32_t mcfq_insn;
}; };
@ -1743,9 +1743,9 @@ struct target_mc_fpu {
uint64_t dregs[32]; uint64_t dregs[32];
//uint128_t qregs[16]; //uint128_t qregs[16];
} mcfpu_fregs; } mcfpu_fregs;
target_ulong mcfpu_fsr; abi_ulong mcfpu_fsr;
target_ulong mcfpu_fprs; abi_ulong mcfpu_fprs;
target_ulong mcfpu_gsr; abi_ulong mcfpu_gsr;
struct target_mc_fq *mcfpu_fq; struct target_mc_fq *mcfpu_fq;
unsigned char mcfpu_qcnt; unsigned char mcfpu_qcnt;
unsigned char mcfpu_qentsz; unsigned char mcfpu_qentsz;
@ -1762,15 +1762,15 @@ typedef struct {
struct target_ucontext { struct target_ucontext {
struct target_ucontext *uc_link; struct target_ucontext *uc_link;
target_ulong uc_flags; abi_ulong uc_flags;
target_sigset_t uc_sigmask; target_sigset_t uc_sigmask;
target_mcontext_t uc_mcontext; target_mcontext_t uc_mcontext;
}; };
/* A V9 register window */ /* A V9 register window */
struct target_reg_window { struct target_reg_window {
target_ulong locals[8]; abi_ulong locals[8];
target_ulong ins[8]; abi_ulong ins[8];
}; };
#define TARGET_STACK_BIAS 2047 #define TARGET_STACK_BIAS 2047
@ -1781,12 +1781,12 @@ void sparc64_set_context(CPUSPARCState *env)
struct target_ucontext *ucp = (struct target_ucontext *) struct target_ucontext *ucp = (struct target_ucontext *)
env->regwptr[UREG_I0]; env->regwptr[UREG_I0];
target_mc_gregset_t *grp; target_mc_gregset_t *grp;
target_ulong pc, npc, tstate; abi_ulong pc, npc, tstate;
target_ulong fp, i7; abi_ulong fp, i7;
unsigned char fenab; unsigned char fenab;
int err; int err;
unsigned int i; unsigned int i;
target_ulong *src, *dst; abi_ulong *src, *dst;
grp = &ucp->uc_mcontext.mc_gregs; grp = &ucp->uc_mcontext.mc_gregs;
err = get_user(pc, &((*grp)[MC_PC])); err = get_user(pc, &((*grp)[MC_PC]));
@ -1803,7 +1803,7 @@ void sparc64_set_context(CPUSPARCState *env)
} else { } else {
src = &ucp->uc_sigmask; src = &ucp->uc_sigmask;
dst = &target_set; 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++) i++, dst++, src++)
err |= get_user(dst, src); err |= get_user(dst, src);
if (err) if (err)
@ -1866,10 +1866,10 @@ void sparc64_get_context(CPUSPARCState *env)
env->regwptr[UREG_I0]; env->regwptr[UREG_I0];
target_mc_gregset_t *grp; target_mc_gregset_t *grp;
target_mcontext_t *mcp; target_mcontext_t *mcp;
target_ulong fp, i7; abi_ulong fp, i7;
int err; int err;
unsigned int i; unsigned int i;
target_ulong *src, *dst; abi_ulong *src, *dst;
target_sigset_t target_set; target_sigset_t target_set;
sigset_t set; sigset_t set;
@ -1886,11 +1886,11 @@ void sparc64_get_context(CPUSPARCState *env)
host_to_target_sigset_internal(&target_set, &set); host_to_target_sigset_internal(&target_set, &set);
if (TARGET_NSIG_WORDS == 1) if (TARGET_NSIG_WORDS == 1)
err |= put_user(target_set.sig[0], err |= put_user(target_set.sig[0],
(target_ulong *)&ucp->uc_sigmask); (abi_ulong *)&ucp->uc_sigmask);
else { else {
src = &target_set; src = &target_set;
dst = &ucp->uc_sigmask; 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++) i++, dst++, src++)
err |= put_user(src, dst); err |= put_user(src, dst);
if (err) if (err)
@ -2354,7 +2354,7 @@ long do_rt_sigreturn(CPUState *env)
void process_pending_signals(void *cpu_env) void process_pending_signals(void *cpu_env)
{ {
int sig; int sig;
target_ulong handler; abi_ulong handler;
sigset_t set, old_set; sigset_t set, old_set;
target_sigset_t target_old_set; target_sigset_t target_old_set;
struct emulated_sigaction *k; struct emulated_sigaction *k;

View File

@ -1,9 +1,9 @@
struct target_pt_regs { struct target_pt_regs {
target_ulong psr; abi_ulong psr;
target_ulong pc; abi_ulong pc;
target_ulong npc; abi_ulong npc;
target_ulong y; abi_ulong y;
target_ulong u_regs[16]; abi_ulong u_regs[16];
}; };
#define UNAME_MACHINE "sun4" #define UNAME_MACHINE "sun4"

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -28,7 +28,7 @@ typedef struct target_sigaltstack {
#define UREG_FP UREG_I6 #define UREG_FP UREG_I6
#endif #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]; return state->regwptr[UREG_FP];
} }

View File

@ -1,10 +1,10 @@
struct target_pt_regs { struct target_pt_regs {
target_ulong u_regs[16]; abi_ulong u_regs[16];
target_ulong tstate; abi_ulong tstate;
target_ulong pc; abi_ulong pc;
target_ulong npc; abi_ulong npc;
target_ulong y; abi_ulong y;
target_ulong fprs; abi_ulong fprs;
}; };
#define UNAME_MACHINE "sun4u" #define UNAME_MACHINE "sun4u"

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -28,7 +28,7 @@ typedef struct target_sigaltstack {
#define UREG_FP UREG_I6 #define UREG_FP UREG_I6
#endif #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]; return state->regwptr[UREG_FP];
} }

File diff suppressed because it is too large Load Diff

View File

@ -105,13 +105,13 @@ struct target_sockaddr {
}; };
struct target_timeval { struct target_timeval {
target_long tv_sec; abi_long tv_sec;
target_long tv_usec; abi_long tv_usec;
}; };
struct target_timespec { struct target_timespec {
target_long tv_sec; abi_long tv_sec;
target_long tv_nsec; abi_long tv_nsec;
}; };
struct target_itimerval { struct target_itimerval {
@ -119,7 +119,7 @@ struct target_itimerval {
struct target_timeval it_value; struct target_timeval it_value;
}; };
typedef target_long target_clock_t; typedef abi_long target_clock_t;
#define TARGET_HZ 100 #define TARGET_HZ 100
@ -131,33 +131,33 @@ struct target_tms {
}; };
struct target_utimbuf { struct target_utimbuf {
target_long actime; abi_long actime;
target_long modtime; abi_long modtime;
}; };
struct target_sel_arg_struct { struct target_sel_arg_struct {
target_long n; abi_long n;
target_long inp, outp, exp; abi_long inp, outp, exp;
target_long tvp; abi_long tvp;
}; };
struct target_iovec { struct target_iovec {
target_long iov_base; /* Starting address */ abi_long iov_base; /* Starting address */
target_long iov_len; /* Number of bytes */ abi_long iov_len; /* Number of bytes */
}; };
struct target_msghdr { struct target_msghdr {
target_long msg_name; /* Socket name */ abi_long msg_name; /* Socket name */
int msg_namelen; /* Length of name */ int msg_namelen; /* Length of name */
target_long msg_iov; /* Data blocks */ abi_long msg_iov; /* Data blocks */
target_long msg_iovlen; /* Number of blocks */ abi_long msg_iovlen; /* Number of blocks */
target_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
target_long msg_controllen; /* Length of cmsg list */ abi_long msg_controllen; /* Length of cmsg list */
unsigned int msg_flags; unsigned int msg_flags;
}; };
struct target_cmsghdr { struct target_cmsghdr {
target_long cmsg_len; abi_long cmsg_len;
int cmsg_level; int cmsg_level;
int cmsg_type; int cmsg_type;
}; };
@ -167,8 +167,8 @@ struct target_cmsghdr {
#define TARGET_CMSG_FIRSTHDR(mhdr) \ #define TARGET_CMSG_FIRSTHDR(mhdr) \
((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \ ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \
? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL) ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL)
#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \ #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
& (size_t) ~(sizeof (target_long) - 1)) & (size_t) ~(sizeof (abi_long) - 1))
#define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
+ TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
#define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) #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_rusage {
struct target_timeval ru_utime; /* user time used */ struct target_timeval ru_utime; /* user time used */
struct target_timeval ru_stime; /* system time used */ struct target_timeval ru_stime; /* system time used */
target_long ru_maxrss; /* maximum resident set size */ abi_long ru_maxrss; /* maximum resident set size */
target_long ru_ixrss; /* integral shared memory size */ abi_long ru_ixrss; /* integral shared memory size */
target_long ru_idrss; /* integral unshared data size */ abi_long ru_idrss; /* integral unshared data size */
target_long ru_isrss; /* integral unshared stack size */ abi_long ru_isrss; /* integral unshared stack size */
target_long ru_minflt; /* page reclaims */ abi_long ru_minflt; /* page reclaims */
target_long ru_majflt; /* page faults */ abi_long ru_majflt; /* page faults */
target_long ru_nswap; /* swaps */ abi_long ru_nswap; /* swaps */
target_long ru_inblock; /* block input operations */ abi_long ru_inblock; /* block input operations */
target_long ru_oublock; /* block output operations */ abi_long ru_oublock; /* block output operations */
target_long ru_msgsnd; /* messages sent */ abi_long ru_msgsnd; /* messages sent */
target_long ru_msgrcv; /* messages received */ abi_long ru_msgrcv; /* messages received */
target_long ru_nsignals; /* signals received */ abi_long ru_nsignals; /* signals received */
target_long ru_nvcsw; /* voluntary context switches */ abi_long ru_nvcsw; /* voluntary context switches */
target_long ru_nivcsw; /* involuntary " */ abi_long ru_nivcsw; /* involuntary " */
}; };
typedef struct { typedef struct {
@ -225,8 +225,8 @@ struct kernel_statfs {
}; };
struct target_dirent { struct target_dirent {
target_long d_ino; abi_long d_ino;
target_long d_off; abi_long d_off;
unsigned short d_reclen; unsigned short d_reclen;
char d_name[256]; /* We must not include limits.h! */ char d_name[256]; /* We must not include limits.h! */
}; };
@ -241,20 +241,20 @@ struct target_dirent64 {
/* mostly generic signal stuff */ /* mostly generic signal stuff */
#define TARGET_SIG_DFL ((target_long)0) /* default signal handling */ #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
#define TARGET_SIG_IGN ((target_long)1) /* ignore signal */ #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
#define TARGET_SIG_ERR ((target_long)-1) /* error return from signal */ #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
#ifdef TARGET_MIPS #ifdef TARGET_MIPS
#define TARGET_NSIG 128 #define TARGET_NSIG 128
#else #else
#define TARGET_NSIG 64 #define TARGET_NSIG 64
#endif #endif
#define TARGET_NSIG_BPW TARGET_LONG_BITS #define TARGET_NSIG_BPW TARGET_ABI_BITS
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
typedef struct { typedef struct {
target_ulong sig[TARGET_NSIG_WORDS]; abi_ulong sig[TARGET_NSIG_WORDS];
} target_sigset_t; } target_sigset_t;
#ifdef BSWAP_NEEDED #ifdef BSWAP_NEEDED
@ -271,7 +271,7 @@ static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
} }
#endif #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; int i;
d->sig[0] = set; 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 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 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); const sigset_t *sigset);
void target_to_host_old_sigset(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; struct target_sigaction;
int do_sigaction(int sig, const struct target_sigaction *act, int do_sigaction(int sig, const struct target_sigaction *act,
struct target_sigaction *oact); struct target_sigaction *oact);
@ -453,40 +453,40 @@ struct target_sigaction {
#if defined(TARGET_MIPSN32) #if defined(TARGET_MIPSN32)
uint32_t _sa_handler; uint32_t _sa_handler;
#else #else
target_ulong _sa_handler; abi_ulong _sa_handler;
#endif #endif
target_sigset_t sa_mask; target_sigset_t sa_mask;
}; };
#else #else
struct target_old_sigaction { struct target_old_sigaction {
target_ulong _sa_handler; abi_ulong _sa_handler;
target_ulong sa_mask; abi_ulong sa_mask;
target_ulong sa_flags; abi_ulong sa_flags;
target_ulong sa_restorer; abi_ulong sa_restorer;
}; };
struct target_sigaction { struct target_sigaction {
target_ulong _sa_handler; abi_ulong _sa_handler;
target_ulong sa_flags; abi_ulong sa_flags;
target_ulong sa_restorer; abi_ulong sa_restorer;
target_sigset_t sa_mask; target_sigset_t sa_mask;
}; };
#endif #endif
typedef union target_sigval { typedef union target_sigval {
int sival_int; int sival_int;
target_ulong sival_ptr; abi_ulong sival_ptr;
} target_sigval_t; } target_sigval_t;
#if 0 #if 0
#if defined (TARGET_SPARC) #if defined (TARGET_SPARC)
typedef struct { typedef struct {
struct { struct {
target_ulong psr; abi_ulong psr;
target_ulong pc; abi_ulong pc;
target_ulong npc; abi_ulong npc;
target_ulong y; abi_ulong y;
target_ulong u_regs[16]; /* globals and ins */ abi_ulong u_regs[16]; /* globals and ins */
} si_regs; } si_regs;
int si_mask; int si_mask;
} __siginfo_t; } __siginfo_t;
@ -544,7 +544,7 @@ typedef struct target_siginfo {
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct { struct {
target_ulong _addr; /* faulting insn/memory ref. */ abi_ulong _addr; /* faulting insn/memory ref. */
} _sigfault; } _sigfault;
/* SIGPOLL */ /* SIGPOLL */
@ -614,8 +614,8 @@ typedef struct target_siginfo {
#endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
struct target_rlimit { struct target_rlimit {
target_ulong rlim_cur; abi_ulong rlim_cur;
target_ulong rlim_max; abi_ulong rlim_max;
}; };
struct target_pollfd { struct target_pollfd {
@ -888,24 +888,24 @@ struct target_winsize {
struct target_stat { struct target_stat {
unsigned short st_dev; unsigned short st_dev;
unsigned short __pad1; unsigned short __pad1;
target_ulong st_ino; abi_ulong st_ino;
unsigned short st_mode; unsigned short st_mode;
unsigned short st_nlink; unsigned short st_nlink;
unsigned short st_uid; unsigned short st_uid;
unsigned short st_gid; unsigned short st_gid;
unsigned short st_rdev; unsigned short st_rdev;
unsigned short __pad2; unsigned short __pad2;
target_ulong st_size; abi_ulong st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_blocks; abi_ulong st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong __unused1; abi_ulong __unused1;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong __unused2; abi_ulong __unused2;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong __unused3; abi_ulong __unused3;
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
/* This matches struct stat64 in glibc2.1, hence the absolutely /* This matches struct stat64 in glibc2.1, hence the absolutely
@ -916,31 +916,31 @@ struct target_stat64 {
unsigned char __pad0[10]; unsigned char __pad0[10];
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
target_ulong __st_ino; abi_ulong __st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
target_ulong st_uid; abi_ulong st_uid;
target_ulong st_gid; abi_ulong st_gid;
unsigned short st_rdev; unsigned short st_rdev;
unsigned char __pad3[10]; unsigned char __pad3[10];
long long st_size; long long st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
target_ulong __pad4; /* future possible st_blocks high bits */ abi_ulong __pad4; /* future possible st_blocks high bits */
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong __pad5; abi_ulong __pad5;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong __pad6; abi_ulong __pad6;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong __pad7; /* will be high 32 bits of ctime someday */ abi_ulong __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__((packed)); } __attribute__((packed));
@ -949,50 +949,50 @@ struct target_stat64 {
struct target_eabi_stat64 { struct target_eabi_stat64 {
unsigned long long st_dev; unsigned long long st_dev;
unsigned int __pad1; unsigned int __pad1;
target_ulong __st_ino; abi_ulong __st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
target_ulong st_uid; abi_ulong st_uid;
target_ulong st_gid; abi_ulong st_gid;
unsigned long long st_rdev; unsigned long long st_rdev;
unsigned int __pad2[2]; unsigned int __pad2[2];
long long st_size; long long st_size;
target_ulong st_blksize; abi_ulong st_blksize;
unsigned int __pad3; unsigned int __pad3;
unsigned long long st_blocks; unsigned long long st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__ ((packed)); } __attribute__ ((packed));
#endif #endif
#elif defined(TARGET_SPARC64) #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
struct target_stat { struct target_stat {
unsigned int st_dev; unsigned int st_dev;
target_ulong st_ino; abi_ulong st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
unsigned int st_uid; unsigned int st_uid;
unsigned int st_gid; unsigned int st_gid;
unsigned int st_rdev; unsigned int st_rdev;
target_long st_size; abi_long st_size;
target_long target_st_atime; abi_long target_st_atime;
target_long target_st_mtime; abi_long target_st_mtime;
target_long target_st_ctime; abi_long target_st_ctime;
target_long st_blksize; abi_long st_blksize;
target_long st_blocks; abi_long st_blocks;
target_ulong __unused4[2]; abi_ulong __unused4[2];
}; };
struct target_stat64 { struct target_stat64 {
@ -1016,38 +1016,38 @@ struct target_stat64 {
unsigned char __pad4[4]; unsigned char __pad4[4];
unsigned int st_blocks; unsigned int st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong __unused1; abi_ulong __unused1;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong __unused2; abi_ulong __unused2;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong __unused3; abi_ulong __unused3;
target_ulong __unused4[3]; abi_ulong __unused4[3];
}; };
#elif defined(TARGET_SPARC) #elif defined(TARGET_SPARC)
struct target_stat { struct target_stat {
unsigned short st_dev; unsigned short st_dev;
target_ulong st_ino; abi_ulong st_ino;
unsigned short st_mode; unsigned short st_mode;
short st_nlink; short st_nlink;
unsigned short st_uid; unsigned short st_uid;
unsigned short st_gid; unsigned short st_gid;
unsigned short st_rdev; unsigned short st_rdev;
target_long st_size; abi_long st_size;
target_long target_st_atime; abi_long target_st_atime;
target_ulong __unused1; abi_ulong __unused1;
target_long target_st_mtime; abi_long target_st_mtime;
target_ulong __unused2; abi_ulong __unused2;
target_long target_st_ctime; abi_long target_st_ctime;
target_ulong __unused3; abi_ulong __unused3;
target_long st_blksize; abi_long st_blksize;
target_long st_blocks; abi_long st_blocks;
target_ulong __unused4[2]; abi_ulong __unused4[2];
}; };
struct target_stat64 { struct target_stat64 {
@ -1090,23 +1090,23 @@ struct target_stat64 {
struct target_stat { struct target_stat {
unsigned short st_dev; unsigned short st_dev;
target_ulong st_ino; abi_ulong st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned short st_nlink; unsigned short st_nlink;
unsigned int st_uid; unsigned int st_uid;
unsigned int st_gid; unsigned int st_gid;
unsigned short st_rdev; unsigned short st_rdev;
target_ulong st_size; abi_ulong st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_blocks; abi_ulong st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong __unused1; abi_ulong __unused1;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong __unused2; abi_ulong __unused2;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong __unused3; abi_ulong __unused3;
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
struct target_stat64 { struct target_stat64 {
@ -1119,17 +1119,17 @@ struct target_stat64 {
unsigned long long st_rdev; unsigned long long st_rdev;
long long pad0; long long pad0;
long long st_size; long long st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong pad1; abi_ulong pad1;
long long st_blocks; /* Number 512-byte blocks allocated. */ long long st_blocks; /* Number 512-byte blocks allocated. */
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
#elif defined(TARGET_M68K) #elif defined(TARGET_M68K)
@ -1137,24 +1137,24 @@ struct target_stat64 {
struct target_stat { struct target_stat {
unsigned short st_dev; unsigned short st_dev;
unsigned short __pad1; unsigned short __pad1;
target_ulong st_ino; abi_ulong st_ino;
unsigned short st_mode; unsigned short st_mode;
unsigned short st_nlink; unsigned short st_nlink;
unsigned short st_uid; unsigned short st_uid;
unsigned short st_gid; unsigned short st_gid;
unsigned short st_rdev; unsigned short st_rdev;
unsigned short __pad2; unsigned short __pad2;
target_ulong st_size; abi_ulong st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_blocks; abi_ulong st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong __unused1; abi_ulong __unused1;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong __unused2; abi_ulong __unused2;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong __unused3; abi_ulong __unused3;
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
/* This matches struct stat64 in glibc2.1, hence the absolutely /* This matches struct stat64 in glibc2.1, hence the absolutely
@ -1165,31 +1165,31 @@ struct target_stat64 {
unsigned char __pad1[2]; unsigned char __pad1[2];
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
target_ulong __st_ino; abi_ulong __st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
target_ulong st_uid; abi_ulong st_uid;
target_ulong st_gid; abi_ulong st_gid;
unsigned long long st_rdev; unsigned long long st_rdev;
unsigned char __pad3[2]; unsigned char __pad3[2];
long long st_size; long long st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong __pad4; /* future possible st_blocks high bits */ abi_ulong __pad4; /* future possible st_blocks high bits */
target_ulong st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
unsigned long long st_ino; unsigned long long st_ino;
} __attribute__((packed)); } __attribute__((packed));
@ -1201,7 +1201,7 @@ struct target_stat {
unsigned int st_dev; unsigned int st_dev;
unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 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_mode;
unsigned int st_nlink; unsigned int st_nlink;
@ -1212,7 +1212,7 @@ struct target_stat {
unsigned int st_rdev; unsigned int st_rdev;
unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 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 * 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_blksize;
unsigned int st_pad2; unsigned int st_pad2;
target_ulong st_blocks; abi_ulong st_blocks;
}; };
#elif defined(TARGET_MIPSN32) #elif defined(TARGET_MIPSN32)
@ -1308,29 +1308,29 @@ struct target_stat64 {
struct target_stat { struct target_stat {
unsigned st_dev; unsigned st_dev;
target_long st_pad1[3]; /* Reserved for network id */ abi_long st_pad1[3]; /* Reserved for network id */
target_ulong st_ino; abi_ulong st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
int st_uid; int st_uid;
int st_gid; int st_gid;
unsigned st_rdev; unsigned st_rdev;
target_long st_pad2[2]; abi_long st_pad2[2];
target_long st_size; abi_long st_size;
target_long st_pad3; abi_long st_pad3;
/* /*
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
* but we don't have it under Linux. * but we don't have it under Linux.
*/ */
target_long target_st_atime; abi_long target_st_atime;
target_long target_st_atime_nsec; abi_long target_st_atime_nsec;
target_long target_st_mtime; abi_long target_st_mtime;
target_long target_st_mtime_nsec; abi_long target_st_mtime_nsec;
target_long target_st_ctime; abi_long target_st_ctime;
target_long target_st_ctime_nsec; abi_long target_st_ctime_nsec;
target_long st_blksize; abi_long st_blksize;
target_long st_blocks; abi_long st_blocks;
target_long st_pad4[14]; abi_long st_pad4[14];
}; };
/* /*
@ -1340,8 +1340,8 @@ struct target_stat {
*/ */
struct target_stat64 { struct target_stat64 {
target_ulong st_dev; abi_ulong st_dev;
target_ulong st_pad0[3]; /* Reserved for st_dev expansion */ abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
uint64_t st_ino; uint64_t st_ino;
@ -1351,8 +1351,8 @@ struct target_stat64 {
int st_uid; int st_uid;
int st_gid; int st_gid;
target_ulong st_rdev; abi_ulong st_rdev;
target_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
int64_t st_size; int64_t st_size;
@ -1360,17 +1360,17 @@ struct target_stat64 {
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
* but we don't have it under Linux. * but we don't have it under Linux.
*/ */
target_long target_st_atime; abi_long target_st_atime;
target_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
target_long target_st_mtime; abi_long target_st_mtime;
target_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
target_long target_st_ctime; abi_long target_st_ctime;
target_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_pad2; abi_ulong st_pad2;
int64_t st_blocks; int64_t st_blocks;
}; };
@ -1385,10 +1385,10 @@ struct target_stat {
unsigned int st_uid; unsigned int st_uid;
unsigned int st_gid; unsigned int st_gid;
unsigned int st_rdev; unsigned int st_rdev;
target_long st_size; abi_long st_size;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
unsigned int st_blksize; unsigned int st_blksize;
unsigned int st_blocks; unsigned int st_blocks;
unsigned int st_flags; unsigned int st_flags;
@ -1396,11 +1396,11 @@ struct target_stat {
}; };
struct target_stat64 { struct target_stat64 {
target_ulong st_dev; abi_ulong st_dev;
target_ulong st_ino; abi_ulong st_ino;
target_ulong st_rdev; abi_ulong st_rdev;
target_long st_size; abi_long st_size;
target_ulong st_blocks; abi_ulong st_blocks;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_uid; unsigned int st_uid;
@ -1409,36 +1409,36 @@ struct target_stat64 {
unsigned int st_nlink; unsigned int st_nlink;
unsigned int __pad0; unsigned int __pad0;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
target_long __unused[3]; abi_long __unused[3];
}; };
#elif defined(TARGET_SH4) #elif defined(TARGET_SH4)
struct target_stat { struct target_stat {
target_ulong st_dev; abi_ulong st_dev;
target_ulong st_ino; abi_ulong st_ino;
unsigned short st_mode; unsigned short st_mode;
unsigned short st_nlink; unsigned short st_nlink;
unsigned short st_uid; unsigned short st_uid;
unsigned short st_gid; unsigned short st_gid;
target_ulong st_rdev; abi_ulong st_rdev;
target_ulong st_size; abi_ulong st_size;
target_ulong st_blksize; abi_ulong st_blksize;
target_ulong st_blocks; abi_ulong st_blocks;
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
/* This matches struct stat64 in glibc2.1, hence the absolutely /* This matches struct stat64 in glibc2.1, hence the absolutely
@ -1449,30 +1449,30 @@ struct target_stat64 {
unsigned char __pad0[4]; unsigned char __pad0[4];
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
target_ulong __st_ino; abi_ulong __st_ino;
unsigned int st_mode; unsigned int st_mode;
unsigned int st_nlink; unsigned int st_nlink;
target_ulong st_uid; abi_ulong st_uid;
target_ulong st_gid; abi_ulong st_gid;
unsigned long long st_rdev; unsigned long long st_rdev;
unsigned char __pad3[4]; unsigned char __pad3[4];
long long st_size; long long st_size;
target_ulong st_blksize; abi_ulong st_blksize;
unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
target_ulong target_st_atime; abi_ulong target_st_atime;
target_ulong target_st_atime_nsec; abi_ulong target_st_atime_nsec;
target_ulong target_st_mtime; abi_ulong target_st_mtime;
target_ulong target_st_mtime_nsec; abi_ulong target_st_mtime_nsec;
target_ulong target_st_ctime; abi_ulong target_st_ctime;
target_ulong target_st_ctime_nsec; abi_ulong target_st_ctime_nsec;
unsigned long long st_ino; unsigned long long st_ino;
}; };
@ -1504,19 +1504,19 @@ struct target_statfs {
}; };
#else #else
struct target_statfs { struct target_statfs {
target_long f_type; abi_long f_type;
target_long f_bsize; abi_long f_bsize;
target_long f_frsize; /* Fragment size - unsupported */ abi_long f_frsize; /* Fragment size - unsupported */
target_long f_blocks; abi_long f_blocks;
target_long f_bfree; abi_long f_bfree;
target_long f_files; abi_long f_files;
target_long f_ffree; abi_long f_ffree;
target_long f_bavail; abi_long f_bavail;
/* Linux specials */ /* Linux specials */
target_fsid_t f_fsid; target_fsid_t f_fsid;
target_long f_namelen; abi_long f_namelen;
target_long f_spare[6]; abi_long f_spare[6];
}; };
#endif #endif
@ -1688,8 +1688,8 @@ struct target_statfs64 {
struct target_flock { struct target_flock {
short l_type; short l_type;
short l_whence; short l_whence;
target_ulong l_start; abi_ulong l_start;
target_ulong l_len; abi_ulong l_len;
int l_pid; int l_pid;
}; };
@ -1856,20 +1856,20 @@ struct target_eabi_flock64 {
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
struct target_sysinfo { struct target_sysinfo {
target_long uptime; /* Seconds since boot */ abi_long uptime; /* Seconds since boot */
target_ulong loads[3]; /* 1, 5, and 15 minute load averages */ abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
target_ulong totalram; /* Total usable main memory size */ abi_ulong totalram; /* Total usable main memory size */
target_ulong freeram; /* Available memory size */ abi_ulong freeram; /* Available memory size */
target_ulong sharedram; /* Amount of shared memory */ abi_ulong sharedram; /* Amount of shared memory */
target_ulong bufferram; /* Memory used by buffers */ abi_ulong bufferram; /* Memory used by buffers */
target_ulong totalswap; /* Total swap space size */ abi_ulong totalswap; /* Total swap space size */
target_ulong freeswap; /* swap space still available */ abi_ulong freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */ unsigned short procs; /* Number of current processes */
unsigned short pad; /* explicit padding for m68k */ unsigned short pad; /* explicit padding for m68k */
target_ulong totalhigh; /* Total high memory size */ abi_ulong totalhigh; /* Total high memory size */
target_ulong freehigh; /* Available high memory size */ abi_ulong freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */ 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" #include "socket.h"

View File

@ -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; TaskState *ts = env->opaque;
struct target_vm86plus_struct * target_v86; struct target_vm86plus_struct * target_v86;

View File

@ -2,30 +2,30 @@
#define __USER_DS (0x2B) #define __USER_DS (0x2B)
struct target_pt_regs { struct target_pt_regs {
target_ulong r15; abi_ulong r15;
target_ulong r14; abi_ulong r14;
target_ulong r13; abi_ulong r13;
target_ulong r12; abi_ulong r12;
target_ulong rbp; abi_ulong rbp;
target_ulong rbx; abi_ulong rbx;
/* arguments: non interrupts/non tracing syscalls only save upto here*/ /* arguments: non interrupts/non tracing syscalls only save upto here*/
target_ulong r11; abi_ulong r11;
target_ulong r10; abi_ulong r10;
target_ulong r9; abi_ulong r9;
target_ulong r8; abi_ulong r8;
target_ulong rax; abi_ulong rax;
target_ulong rcx; abi_ulong rcx;
target_ulong rdx; abi_ulong rdx;
target_ulong rsi; abi_ulong rsi;
target_ulong rdi; abi_ulong rdi;
target_ulong orig_rax; abi_ulong orig_rax;
/* end of arguments */ /* end of arguments */
/* cpu exception frame or undefined */ /* cpu exception frame or undefined */
target_ulong rip; abi_ulong rip;
target_ulong cs; abi_ulong cs;
target_ulong eflags; abi_ulong eflags;
target_ulong rsp; abi_ulong rsp;
target_ulong ss; abi_ulong ss;
/* top of stack page */ /* top of stack page */
}; };
@ -41,7 +41,7 @@ struct target_pt_regs {
#if 0 // Redefine this #if 0 // Redefine this
struct target_modify_ldt_ldt_s { struct target_modify_ldt_ldt_s {
unsigned int entry_number; unsigned int entry_number;
target_ulong base_addr; abi_ulong base_addr;
unsigned int limit; unsigned int limit;
unsigned int seg_32bit:1; unsigned int seg_32bit:1;
unsigned int contents:2; unsigned int contents:2;
@ -54,7 +54,7 @@ struct target_modify_ldt_ldt_s {
#else #else
struct target_modify_ldt_ldt_s { struct target_modify_ldt_ldt_s {
unsigned int entry_number; unsigned int entry_number;
target_ulong base_addr; abi_ulong base_addr;
unsigned int limit; unsigned int limit;
unsigned int flags; unsigned int flags;
}; };
@ -71,8 +71,8 @@ struct target_ipc64_perm
unsigned short __pad1; unsigned short __pad1;
unsigned short seq; unsigned short seq;
unsigned short __pad2; unsigned short __pad2;
target_ulong __unused1; abi_ulong __unused1;
target_ulong __unused2; abi_ulong __unused2;
}; };
struct target_msqid64_ds { struct target_msqid64_ds {
@ -80,13 +80,13 @@ struct target_msqid64_ds {
unsigned int msg_stime; /* last msgsnd time */ unsigned int msg_stime; /* last msgsnd time */
unsigned int msg_rtime; /* last msgrcv time */ unsigned int msg_rtime; /* last msgrcv time */
unsigned int msg_ctime; /* last change time */ unsigned int msg_ctime; /* last change time */
target_ulong msg_cbytes; /* current number of bytes on queue */ abi_ulong msg_cbytes; /* current number of bytes on queue */
target_ulong msg_qnum; /* number of messages in queue */ abi_ulong msg_qnum; /* number of messages in queue */
target_ulong msg_qbytes; /* max number of bytes on queue */ abi_ulong msg_qbytes; /* max number of bytes on queue */
unsigned int msg_lspid; /* pid of last msgsnd */ unsigned int msg_lspid; /* pid of last msgsnd */
unsigned int msg_lrpid; /* last receive pid */ unsigned int msg_lrpid; /* last receive pid */
target_ulong __unused4; abi_ulong __unused4;
target_ulong __unused5; abi_ulong __unused5;
}; };
#define UNAME_MACHINE "x86_64" #define UNAME_MACHINE "x86_64"

View File

@ -6,9 +6,9 @@
/* this struct defines a stack used during syscall handling */ /* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack { typedef struct target_sigaltstack {
target_ulong ss_sp; abi_ulong ss_sp;
target_long ss_flags; abi_long ss_flags;
target_ulong ss_size; abi_ulong ss_size;
} target_stack_t; } target_stack_t;
@ -21,7 +21,7 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048 #define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192 #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]; return state->regs[R_ESP];
} }

View File

@ -1,20 +1,26 @@
#ifdef TARGET_ABI32
#define ADDR(x) ((x) & 0xffffffff)
#else
#define ADDR(x) (x)
#endif
/*** Integer load ***/ /*** Integer load ***/
#define SPARC_LD_OP(name, qp) \ #define SPARC_LD_OP(name, qp) \
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ 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) \ #define SPARC_LD_OP_S(name, qp) \
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ 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) \ #define SPARC_ST_OP(name, op) \
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \ void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
{ \ { \
glue(op, MEMSUFFIX)(T0, T1); \ glue(op, MEMSUFFIX)(ADDR(T0), T1); \
} }
SPARC_LD_OP(ld, ldl); SPARC_LD_OP(ld, ldl);
@ -30,60 +36,60 @@ SPARC_ST_OP(sth, stw);
void OPPROTO glue(op_std, MEMSUFFIX)(void) void OPPROTO glue(op_std, MEMSUFFIX)(void)
{ {
glue(stl, MEMSUFFIX)(T0, T1); glue(stl, MEMSUFFIX)(ADDR(T0), T1);
glue(stl, MEMSUFFIX)((T0 + 4), T2); glue(stl, MEMSUFFIX)((ADDR(T0 + 4)), T2);
} }
void OPPROTO glue(op_ldstub, MEMSUFFIX)(void) void OPPROTO glue(op_ldstub, MEMSUFFIX)(void)
{ {
T1 = glue(ldub, MEMSUFFIX)(T0); T1 = glue(ldub, MEMSUFFIX)(ADDR(T0));
glue(stb, MEMSUFFIX)(T0, 0xff); /* XXX: Should be Atomically */ glue(stb, MEMSUFFIX)(ADDR(T0), 0xff); /* XXX: Should be Atomically */
} }
void OPPROTO glue(op_swap, MEMSUFFIX)(void) void OPPROTO glue(op_swap, MEMSUFFIX)(void)
{ {
target_ulong tmp = glue(ldl, MEMSUFFIX)(T0); target_ulong tmp = glue(ldl, MEMSUFFIX)(ADDR(T0));
glue(stl, MEMSUFFIX)(T0, T1); /* XXX: Should be Atomically */ glue(stl, MEMSUFFIX)(ADDR(T0), T1); /* XXX: Should be Atomically */
T1 = tmp; T1 = tmp;
} }
void OPPROTO glue(op_ldd, MEMSUFFIX)(void) void OPPROTO glue(op_ldd, MEMSUFFIX)(void)
{ {
T1 = glue(ldl, MEMSUFFIX)(T0); T1 = glue(ldl, MEMSUFFIX)(ADDR(T0));
T0 = glue(ldl, MEMSUFFIX)((T0 + 4)); T0 = glue(ldl, MEMSUFFIX)((ADDR(T0 + 4)));
} }
/*** Floating-point store ***/ /*** Floating-point store ***/
void OPPROTO glue(op_stf, MEMSUFFIX) (void) 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) void OPPROTO glue(op_stdf, MEMSUFFIX) (void)
{ {
glue(stfq, MEMSUFFIX)(T0, DT0); glue(stfq, MEMSUFFIX)(ADDR(T0), DT0);
} }
/*** Floating-point load ***/ /*** Floating-point load ***/
void OPPROTO glue(op_ldf, MEMSUFFIX) (void) 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) void OPPROTO glue(op_lddf, MEMSUFFIX) (void)
{ {
DT0 = glue(ldfq, MEMSUFFIX)(T0); DT0 = glue(ldfq, MEMSUFFIX)(ADDR(T0));
} }
#ifdef TARGET_SPARC64 #ifdef TARGET_SPARC64
void OPPROTO glue(op_lduw, MEMSUFFIX)(void) 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) 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); SPARC_LD_OP(ldx, ldq);

View File

@ -136,13 +136,13 @@ const argtype *thunk_convert(void *dst, const void *src,
case TYPE_ULONGLONG: case TYPE_ULONGLONG:
*(uint64_t *)dst = tswap64(*(uint64_t *)src); *(uint64_t *)dst = tswap64(*(uint64_t *)src);
break; break;
#if HOST_LONG_BITS == 32 && TARGET_LONG_BITS == 32 #if HOST_LONG_BITS == 32 && TARGET_ABI_BITS == 32
case TYPE_LONG: case TYPE_LONG:
case TYPE_ULONG: case TYPE_ULONG:
case TYPE_PTRVOID: case TYPE_PTRVOID:
*(uint32_t *)dst = tswap32(*(uint32_t *)src); *(uint32_t *)dst = tswap32(*(uint32_t *)src);
break; break;
#elif HOST_LONG_BITS == 64 && TARGET_LONG_BITS == 32 #elif HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 32
case TYPE_LONG: case TYPE_LONG:
case TYPE_ULONG: case TYPE_ULONG:
case TYPE_PTRVOID: case TYPE_PTRVOID:

View File

@ -98,7 +98,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
if (is_host) { if (is_host) {
return HOST_LONG_SIZE; return HOST_LONG_SIZE;
} else { } else {
return TARGET_LONG_SIZE; return TARGET_ABI_BITS / 8;
} }
break; break;
case TYPE_ARRAY: case TYPE_ARRAY:
@ -135,7 +135,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
if (is_host) { if (is_host) {
return HOST_LONG_SIZE; return HOST_LONG_SIZE;
} else { } else {
return TARGET_LONG_SIZE; return TARGET_ABI_BITS / 8;
} }
break; break;
case TYPE_ARRAY: case TYPE_ARRAY: