Revision 992f48a0
b/Makefile.target | ||
---|---|---|
31 | 31 |
endif |
32 | 32 |
ifdef CONFIG_LINUX_USER |
33 | 33 |
VPATH+=:$(SRC_PATH)/linux-user |
34 |
CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) |
|
34 |
ifndef TARGET_ABI_DIR |
|
35 |
TARGET_ABI_DIR=$(TARGET_ARCH) |
|
36 |
endif |
|
37 |
CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
|
35 | 38 |
endif |
36 | 39 |
BASE_CFLAGS= |
37 | 40 |
BASE_LDFLAGS= |
... | ... | |
66 | 69 |
TARGET_ARCH2=mips64el |
67 | 70 |
endif |
68 | 71 |
endif |
72 |
ifeq ($(TARGET_ARCH),sparc64) |
|
73 |
ifeq ($(TARGET_ABI_DIR),sparc) |
|
74 |
TARGET_ARCH2=sparc32plus |
|
75 |
endif |
|
76 |
endif |
|
69 | 77 |
QEMU_USER=qemu-$(TARGET_ARCH2) |
70 | 78 |
# system emulator name |
71 | 79 |
ifdef CONFIG_SOFTMMU |
b/configure | ||
---|---|---|
504 | 504 |
fi |
505 | 505 |
# the following are Linux specific |
506 | 506 |
if [ "$linux_user" = "yes" ] ; then |
507 |
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" |
|
507 |
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"
|
|
508 | 508 |
fi |
509 | 509 |
# the following are Darwin specific |
510 | 510 |
if [ "$darwin_user" = "yes" ] ; then |
... | ... | |
933 | 933 |
[ "$target_cpu" = "armeb" ] && target_bigendian=yes |
934 | 934 |
[ "$target_cpu" = "sparc" ] && target_bigendian=yes |
935 | 935 |
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes |
936 |
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes |
|
936 | 937 |
[ "$target_cpu" = "ppc" ] && target_bigendian=yes |
937 | 938 |
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes |
938 | 939 |
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes |
... | ... | |
1026 | 1027 |
echo "#define TARGET_SPARC 1" >> $config_h |
1027 | 1028 |
echo "#define TARGET_SPARC64 1" >> $config_h |
1028 | 1029 |
elfload32="yes" |
1030 |
elif test "$target_cpu" = "sparc32plus" ; then |
|
1031 |
echo "TARGET_ARCH=sparc64" >> $config_mak |
|
1032 |
echo "TARGET_ABI_DIR=sparc" >> $config_mak |
|
1033 |
echo "#define TARGET_ARCH \"sparc64\"" >> $config_h |
|
1034 |
echo "#define TARGET_SPARC 1" >> $config_h |
|
1035 |
echo "#define TARGET_SPARC64 1" >> $config_h |
|
1036 |
echo "#define TARGET_ABI32 1" >> $config_h |
|
1029 | 1037 |
elif test "$target_cpu" = "ppc" ; then |
1030 | 1038 |
echo "TARGET_ARCH=ppc" >> $config_mak |
1031 | 1039 |
echo "#define TARGET_ARCH \"ppc\"" >> $config_h |
... | ... | |
1113 | 1121 |
echo "#define CONFIG_DARWIN_USER 1" >> $config_h |
1114 | 1122 |
fi |
1115 | 1123 |
|
1116 |
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 |
|
1124 |
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
|
|
1117 | 1125 |
echo "CONFIG_SOFTFLOAT=yes" >> $config_mak |
1118 | 1126 |
echo "#define CONFIG_SOFTFLOAT 1" >> $config_h |
1119 | 1127 |
fi |
b/linux-user/alpha/syscall.h | ||
---|---|---|
2 | 2 |
#define __USER_DS (1) |
3 | 3 |
|
4 | 4 |
struct target_pt_regs { |
5 |
target_ulong r0;
|
|
6 |
target_ulong r1;
|
|
7 |
target_ulong r2;
|
|
8 |
target_ulong r3;
|
|
9 |
target_ulong r4;
|
|
10 |
target_ulong r5;
|
|
11 |
target_ulong r6;
|
|
12 |
target_ulong r7;
|
|
13 |
target_ulong r8;
|
|
14 |
target_ulong r19;
|
|
15 |
target_ulong r20;
|
|
16 |
target_ulong r21;
|
|
17 |
target_ulong r22;
|
|
18 |
target_ulong r23;
|
|
19 |
target_ulong r24;
|
|
20 |
target_ulong r25;
|
|
21 |
target_ulong r26;
|
|
22 |
target_ulong r27;
|
|
23 |
target_ulong r28;
|
|
24 |
target_ulong hae;
|
|
5 |
abi_ulong r0;
|
|
6 |
abi_ulong r1;
|
|
7 |
abi_ulong r2;
|
|
8 |
abi_ulong r3;
|
|
9 |
abi_ulong r4;
|
|
10 |
abi_ulong r5;
|
|
11 |
abi_ulong r6;
|
|
12 |
abi_ulong r7;
|
|
13 |
abi_ulong r8;
|
|
14 |
abi_ulong r19;
|
|
15 |
abi_ulong r20;
|
|
16 |
abi_ulong r21;
|
|
17 |
abi_ulong r22;
|
|
18 |
abi_ulong r23;
|
|
19 |
abi_ulong r24;
|
|
20 |
abi_ulong r25;
|
|
21 |
abi_ulong r26;
|
|
22 |
abi_ulong r27;
|
|
23 |
abi_ulong r28;
|
|
24 |
abi_ulong hae;
|
|
25 | 25 |
/* JRP - These are the values provided to a0-a2 by PALcode */ |
26 |
target_ulong trap_a0;
|
|
27 |
target_ulong trap_a1;
|
|
28 |
target_ulong trap_a2;
|
|
26 |
abi_ulong trap_a0;
|
|
27 |
abi_ulong trap_a1;
|
|
28 |
abi_ulong trap_a2;
|
|
29 | 29 |
/* These are saved by PAL-code: */ |
30 |
target_ulong ps;
|
|
31 |
target_ulong pc;
|
|
32 |
target_ulong gp;
|
|
33 |
target_ulong r16;
|
|
34 |
target_ulong r17;
|
|
35 |
target_ulong r18;
|
|
30 |
abi_ulong ps;
|
|
31 |
abi_ulong pc;
|
|
32 |
abi_ulong gp;
|
|
33 |
abi_ulong r16;
|
|
34 |
abi_ulong r17;
|
|
35 |
abi_ulong r18;
|
|
36 | 36 |
/* Those is needed by qemu to temporary store the user stack pointer */ |
37 |
target_ulong usp;
|
|
38 |
target_ulong unique;
|
|
37 |
abi_ulong usp;
|
|
38 |
abi_ulong unique;
|
|
39 | 39 |
}; |
40 | 40 |
|
41 | 41 |
#define UNAME_MACHINE "alpha" |
b/linux-user/alpha/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 4096 |
22 | 22 |
#define TARGET_SIGSTKSZ 16384 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUAlphaState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->ir[IR_SP]; |
27 | 27 |
} |
b/linux-user/arm/syscall.h | ||
---|---|---|
3 | 3 |
stack during a system call. */ |
4 | 4 |
|
5 | 5 |
struct target_pt_regs { |
6 |
target_long uregs[18];
|
|
6 |
abi_long uregs[18];
|
|
7 | 7 |
}; |
8 | 8 |
|
9 | 9 |
#define ARM_cpsr uregs[16] |
b/linux-user/arm/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUARMState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->regs[13]; |
27 | 27 |
} |
b/linux-user/cris/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_ulong ss_size;
|
|
11 |
target_long ss_flags;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_ulong ss_size;
|
|
11 |
abi_long ss_flags;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUCRISState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->regs[14]; |
27 | 27 |
} |
b/linux-user/elfload.c | ||
---|---|---|
172 | 172 |
|
173 | 173 |
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) |
174 | 174 |
{ |
175 |
target_long stack = infop->start_stack;
|
|
175 |
abi_long stack = infop->start_stack;
|
|
176 | 176 |
memset(regs, 0, sizeof(*regs)); |
177 | 177 |
regs->ARM_cpsr = 0x10; |
178 | 178 |
if (infop->entry & 1) |
... | ... | |
214 | 214 |
|
215 | 215 |
#define ELF_START_MMAP 0x80000000 |
216 | 216 |
|
217 |
#ifndef TARGET_ABI32 |
|
217 | 218 |
#define elf_check_arch(x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) |
219 |
#else |
|
220 |
#define elf_check_arch(x) ( (x) == EM_SPARC32PLUS || (x) == EM_SPARC ) |
|
221 |
#endif |
|
218 | 222 |
|
219 | 223 |
#define ELF_CLASS ELFCLASS64 |
220 | 224 |
#define ELF_DATA ELFDATA2MSB |
... | ... | |
224 | 228 |
|
225 | 229 |
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) |
226 | 230 |
{ |
231 |
#ifndef TARGET_ABI32 |
|
227 | 232 |
regs->tstate = 0; |
233 |
#endif |
|
228 | 234 |
regs->pc = infop->entry; |
229 | 235 |
regs->npc = regs->pc + 4; |
230 | 236 |
regs->y = 0; |
237 |
#ifdef TARGET_ABI32 |
|
238 |
regs->u_regs[14] = infop->start_stack - 16 * 4; |
|
239 |
#else |
|
231 | 240 |
if (personality(infop->personality) == PER_LINUX32) |
232 | 241 |
regs->u_regs[14] = infop->start_stack - 16 * 4; |
233 | 242 |
else |
234 | 243 |
regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; |
244 |
#endif |
|
235 | 245 |
} |
236 | 246 |
|
237 | 247 |
#else |
... | ... | |
313 | 323 |
|
314 | 324 |
static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop) |
315 | 325 |
{ |
316 |
target_ulong pos = infop->start_stack;
|
|
317 |
target_ulong tmp;
|
|
326 |
abi_ulong pos = infop->start_stack;
|
|
327 |
abi_ulong tmp;
|
|
318 | 328 |
#ifdef TARGET_PPC64 |
319 |
target_ulong entry, toc;
|
|
329 |
abi_ulong entry, toc;
|
|
320 | 330 |
#endif |
321 | 331 |
|
322 | 332 |
_regs->msr = 1 << MSR_PR; /* Set user mode */ |
... | ... | |
333 | 343 |
* execution of PPC BSD programs. |
334 | 344 |
*/ |
335 | 345 |
_regs->gpr[3] = tgetl(pos); |
336 |
pos += sizeof(target_ulong);
|
|
346 |
pos += sizeof(abi_ulong);
|
|
337 | 347 |
_regs->gpr[4] = pos; |
338 |
for (tmp = 1; tmp != 0; pos += sizeof(target_ulong))
|
|
348 |
for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong))
|
|
339 | 349 |
tmp = ldl(pos); |
340 | 350 |
_regs->gpr[5] = pos; |
341 | 351 |
} |
... | ... | |
475 | 485 |
#define ELF_HWCAP 0 |
476 | 486 |
#endif |
477 | 487 |
|
478 |
#ifdef OVERRIDE_ELF_CLASS
|
|
488 |
#ifdef TARGET_ABI32
|
|
479 | 489 |
#undef ELF_CLASS |
480 |
#define ELF_CLASS OVERRIDE_ELF_CLASS
|
|
490 |
#define ELF_CLASS ELFCLASS32
|
|
481 | 491 |
#undef bswaptls |
482 | 492 |
#define bswaptls(ptr) bswap32s(ptr) |
483 | 493 |
#endif |
... | ... | |
588 | 598 |
* to be put directly into the top of new user memory. |
589 | 599 |
* |
590 | 600 |
*/ |
591 |
static target_ulong copy_elf_strings(int argc,char ** argv, void **page,
|
|
592 |
target_ulong p)
|
|
601 |
static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
|
|
602 |
abi_ulong p)
|
|
593 | 603 |
{ |
594 | 604 |
char *tmp, *tmp1, *pag = NULL; |
595 | 605 |
int len, offset = 0; |
... | ... | |
638 | 648 |
return p; |
639 | 649 |
} |
640 | 650 |
|
641 |
static target_ulong setup_arg_pages(target_ulong p, struct linux_binprm *bprm,
|
|
642 |
struct image_info *info)
|
|
651 |
static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm,
|
|
652 |
struct image_info *info) |
|
643 | 653 |
{ |
644 |
target_ulong stack_base, size, error;
|
|
654 |
abi_ulong stack_base, size, error;
|
|
645 | 655 |
int i; |
646 | 656 |
|
647 | 657 |
/* Create enough stack to hold everything. If we don't use |
... | ... | |
677 | 687 |
return p; |
678 | 688 |
} |
679 | 689 |
|
680 |
static void set_brk(target_ulong start, target_ulong end)
|
|
690 |
static void set_brk(abi_ulong start, abi_ulong end)
|
|
681 | 691 |
{ |
682 | 692 |
/* page-align the start and end addresses... */ |
683 | 693 |
start = HOST_PAGE_ALIGN(start); |
... | ... | |
696 | 706 |
/* We need to explicitly zero any fractional pages after the data |
697 | 707 |
section (i.e. bss). This would contain the junk from the file that |
698 | 708 |
should not be in memory. */ |
699 |
static void padzero(target_ulong elf_bss, target_ulong last_bss)
|
|
709 |
static void padzero(abi_ulong elf_bss, abi_ulong last_bss)
|
|
700 | 710 |
{ |
701 |
target_ulong nbyte;
|
|
711 |
abi_ulong nbyte;
|
|
702 | 712 |
|
703 | 713 |
if (elf_bss >= last_bss) |
704 | 714 |
return; |
... | ... | |
709 | 719 |
patch target_mmap(), but it is more complicated as the file |
710 | 720 |
size must be known */ |
711 | 721 |
if (qemu_real_host_page_size < qemu_host_page_size) { |
712 |
target_ulong end_addr, end_addr1;
|
|
722 |
abi_ulong end_addr, end_addr1;
|
|
713 | 723 |
end_addr1 = (elf_bss + qemu_real_host_page_size - 1) & |
714 | 724 |
~(qemu_real_host_page_size - 1); |
715 | 725 |
end_addr = HOST_PAGE_ALIGN(elf_bss); |
... | ... | |
731 | 741 |
} |
732 | 742 |
|
733 | 743 |
|
734 |
static target_ulong create_elf_tables(target_ulong p, int argc, int envc,
|
|
735 |
struct elfhdr * exec,
|
|
736 |
target_ulong load_addr,
|
|
737 |
target_ulong load_bias,
|
|
738 |
target_ulong interp_load_addr, int ibcs,
|
|
739 |
struct image_info *info)
|
|
744 |
static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
|
745 |
struct elfhdr * exec, |
|
746 |
abi_ulong load_addr,
|
|
747 |
abi_ulong load_bias,
|
|
748 |
abi_ulong interp_load_addr, int ibcs,
|
|
749 |
struct image_info *info) |
|
740 | 750 |
{ |
741 |
target_ulong sp;
|
|
751 |
abi_ulong sp;
|
|
742 | 752 |
int size; |
743 |
target_ulong u_platform;
|
|
753 |
abi_ulong u_platform;
|
|
744 | 754 |
const char *k_platform; |
745 | 755 |
const int n = sizeof(elf_addr_t); |
746 | 756 |
|
... | ... | |
756 | 766 |
/* |
757 | 767 |
* Force 16 byte _final_ alignment here for generality. |
758 | 768 |
*/ |
759 |
sp = sp &~ (target_ulong)15;
|
|
769 |
sp = sp &~ (abi_ulong)15;
|
|
760 | 770 |
size = (DLINFO_ITEMS + 1) * 2; |
761 | 771 |
if (k_platform) |
762 | 772 |
size += 2; |
... | ... | |
786 | 796 |
NEW_AUX_ENT (AT_NULL, 0); |
787 | 797 |
|
788 | 798 |
/* There must be exactly DLINFO_ITEMS entries here. */ |
789 |
NEW_AUX_ENT(AT_PHDR, (target_ulong)(load_addr + exec->e_phoff));
|
|
790 |
NEW_AUX_ENT(AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
|
|
791 |
NEW_AUX_ENT(AT_PHNUM, (target_ulong)(exec->e_phnum));
|
|
792 |
NEW_AUX_ENT(AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
|
|
793 |
NEW_AUX_ENT(AT_BASE, (target_ulong)(interp_load_addr));
|
|
794 |
NEW_AUX_ENT(AT_FLAGS, (target_ulong)0);
|
|
799 |
NEW_AUX_ENT(AT_PHDR, (abi_ulong)(load_addr + exec->e_phoff));
|
|
800 |
NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
|
|
801 |
NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
|
|
802 |
NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
|
|
803 |
NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_load_addr));
|
|
804 |
NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
|
|
795 | 805 |
NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry); |
796 |
NEW_AUX_ENT(AT_UID, (target_ulong) getuid());
|
|
797 |
NEW_AUX_ENT(AT_EUID, (target_ulong) geteuid());
|
|
798 |
NEW_AUX_ENT(AT_GID, (target_ulong) getgid());
|
|
799 |
NEW_AUX_ENT(AT_EGID, (target_ulong) getegid());
|
|
800 |
NEW_AUX_ENT(AT_HWCAP, (target_ulong) ELF_HWCAP);
|
|
806 |
NEW_AUX_ENT(AT_UID, (abi_ulong) getuid());
|
|
807 |
NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid());
|
|
808 |
NEW_AUX_ENT(AT_GID, (abi_ulong) getgid());
|
|
809 |
NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid());
|
|
810 |
NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);
|
|
801 | 811 |
if (k_platform) |
802 | 812 |
NEW_AUX_ENT(AT_PLATFORM, u_platform); |
803 | 813 |
#ifdef ARCH_DLINFO |
... | ... | |
814 | 824 |
} |
815 | 825 |
|
816 | 826 |
|
817 |
static target_ulong load_elf_interp(struct elfhdr * interp_elf_ex,
|
|
818 |
int interpreter_fd,
|
|
819 |
target_ulong *interp_load_addr)
|
|
827 |
static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex,
|
|
828 |
int interpreter_fd, |
|
829 |
abi_ulong *interp_load_addr)
|
|
820 | 830 |
{ |
821 | 831 |
struct elf_phdr *elf_phdata = NULL; |
822 | 832 |
struct elf_phdr *eppnt; |
823 |
target_ulong load_addr = 0;
|
|
833 |
abi_ulong load_addr = 0;
|
|
824 | 834 |
int load_addr_set = 0; |
825 | 835 |
int retval; |
826 |
target_ulong last_bss, elf_bss;
|
|
827 |
target_ulong error;
|
|
836 |
abi_ulong last_bss, elf_bss;
|
|
837 |
abi_ulong error;
|
|
828 | 838 |
int i; |
829 | 839 |
|
830 | 840 |
elf_bss = 0; |
... | ... | |
838 | 848 |
if ((interp_elf_ex->e_type != ET_EXEC && |
839 | 849 |
interp_elf_ex->e_type != ET_DYN) || |
840 | 850 |
!elf_check_arch(interp_elf_ex->e_machine)) { |
841 |
return ~((target_ulong)0UL);
|
|
851 |
return ~((abi_ulong)0UL);
|
|
842 | 852 |
} |
843 | 853 |
|
844 | 854 |
|
845 | 855 |
/* Now read in all of the header information */ |
846 | 856 |
|
847 | 857 |
if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) |
848 |
return ~(target_ulong)0UL;
|
|
858 |
return ~(abi_ulong)0UL;
|
|
849 | 859 |
|
850 | 860 |
elf_phdata = (struct elf_phdr *) |
851 | 861 |
malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); |
852 | 862 |
|
853 | 863 |
if (!elf_phdata) |
854 |
return ~((target_ulong)0UL);
|
|
864 |
return ~((abi_ulong)0UL);
|
|
855 | 865 |
|
856 | 866 |
/* |
857 | 867 |
* If the size of this structure has changed, then punt, since |
... | ... | |
859 | 869 |
*/ |
860 | 870 |
if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) { |
861 | 871 |
free(elf_phdata); |
862 |
return ~((target_ulong)0UL);
|
|
872 |
return ~((abi_ulong)0UL);
|
|
863 | 873 |
} |
864 | 874 |
|
865 | 875 |
retval = lseek(interpreter_fd, interp_elf_ex->e_phoff, SEEK_SET); |
... | ... | |
900 | 910 |
if (eppnt->p_type == PT_LOAD) { |
901 | 911 |
int elf_type = MAP_PRIVATE | MAP_DENYWRITE; |
902 | 912 |
int elf_prot = 0; |
903 |
target_ulong vaddr = 0;
|
|
904 |
target_ulong k;
|
|
913 |
abi_ulong vaddr = 0;
|
|
914 |
abi_ulong k;
|
|
905 | 915 |
|
906 | 916 |
if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; |
907 | 917 |
if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; |
... | ... | |
921 | 931 |
/* Real error */ |
922 | 932 |
close(interpreter_fd); |
923 | 933 |
free(elf_phdata); |
924 |
return ~((target_ulong)0UL);
|
|
934 |
return ~((abi_ulong)0UL);
|
|
925 | 935 |
} |
926 | 936 |
|
927 | 937 |
if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) { |
... | ... | |
966 | 976 |
free(elf_phdata); |
967 | 977 |
|
968 | 978 |
*interp_load_addr = load_addr; |
969 |
return ((target_ulong) interp_elf_ex->e_entry) + load_addr;
|
|
979 |
return ((abi_ulong) interp_elf_ex->e_entry) + load_addr;
|
|
970 | 980 |
} |
971 | 981 |
|
972 | 982 |
/* Best attempt to load symbols from this ELF object. */ |
... | ... | |
1054 | 1064 |
struct elfhdr interp_elf_ex; |
1055 | 1065 |
struct exec interp_ex; |
1056 | 1066 |
int interpreter_fd = -1; /* avoid warning */ |
1057 |
target_ulong load_addr, load_bias;
|
|
1067 |
abi_ulong load_addr, load_bias;
|
|
1058 | 1068 |
int load_addr_set = 0; |
1059 | 1069 |
unsigned int interpreter_type = INTERPRETER_NONE; |
1060 | 1070 |
unsigned char ibcs2_interpreter; |
1061 | 1071 |
int i; |
1062 |
target_ulong mapped_addr;
|
|
1072 |
abi_ulong mapped_addr;
|
|
1063 | 1073 |
struct elf_phdr * elf_ppnt; |
1064 | 1074 |
struct elf_phdr *elf_phdata; |
1065 |
target_ulong elf_bss, k, elf_brk;
|
|
1075 |
abi_ulong elf_bss, k, elf_brk;
|
|
1066 | 1076 |
int retval; |
1067 | 1077 |
char * elf_interpreter; |
1068 |
target_ulong elf_entry, interp_load_addr = 0;
|
|
1078 |
abi_ulong elf_entry, interp_load_addr = 0;
|
|
1069 | 1079 |
int status; |
1070 |
target_ulong start_code, end_code, start_data, end_data;
|
|
1071 |
target_ulong reloc_func_desc = 0;
|
|
1072 |
target_ulong elf_stack;
|
|
1080 |
abi_ulong start_code, end_code, start_data, end_data;
|
|
1081 |
abi_ulong reloc_func_desc = 0;
|
|
1082 |
abi_ulong elf_stack;
|
|
1073 | 1083 |
char passed_fileno[6]; |
1074 | 1084 |
|
1075 | 1085 |
ibcs2_interpreter = 0; |
... | ... | |
1125 | 1135 |
elf_brk = 0; |
1126 | 1136 |
|
1127 | 1137 |
|
1128 |
elf_stack = ~((target_ulong)0UL);
|
|
1138 |
elf_stack = ~((abi_ulong)0UL);
|
|
1129 | 1139 |
elf_interpreter = NULL; |
1130 |
start_code = ~((target_ulong)0UL);
|
|
1140 |
start_code = ~((abi_ulong)0UL);
|
|
1131 | 1141 |
end_code = 0; |
1132 | 1142 |
start_data = 0; |
1133 | 1143 |
end_data = 0; |
... | ... | |
1263 | 1273 |
/* OK, This is the point of no return */ |
1264 | 1274 |
info->end_data = 0; |
1265 | 1275 |
info->end_code = 0; |
1266 |
info->start_mmap = (target_ulong)ELF_START_MMAP;
|
|
1276 |
info->start_mmap = (abi_ulong)ELF_START_MMAP;
|
|
1267 | 1277 |
info->mmap = 0; |
1268 |
elf_entry = (target_ulong) elf_ex.e_entry;
|
|
1278 |
elf_entry = (abi_ulong) elf_ex.e_entry;
|
|
1269 | 1279 |
|
1270 | 1280 |
/* Do this so that we can load the interpreter, if need be. We will |
1271 | 1281 |
change some of these later */ |
... | ... | |
1282 | 1292 |
for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { |
1283 | 1293 |
int elf_prot = 0; |
1284 | 1294 |
int elf_flags = 0; |
1285 |
target_ulong error;
|
|
1295 |
abi_ulong error;
|
|
1286 | 1296 |
|
1287 | 1297 |
if (elf_ppnt->p_type != PT_LOAD) |
1288 | 1298 |
continue; |
... | ... | |
1374 | 1384 |
close(interpreter_fd); |
1375 | 1385 |
free(elf_interpreter); |
1376 | 1386 |
|
1377 |
if (elf_entry == ~((target_ulong)0UL)) {
|
|
1387 |
if (elf_entry == ~((abi_ulong)0UL)) {
|
|
1378 | 1388 |
printf("Unable to load interpreter\n"); |
1379 | 1389 |
free(elf_phdata); |
1380 | 1390 |
exit(-1); |
b/linux-user/elfload32.c | ||
---|---|---|
1 |
#define OVERRIDE_ELF_CLASS ELFCLASS32
|
|
1 |
#define TARGET_ABI32
|
|
2 | 2 |
#define load_elf_binary load_elf_binary32 |
3 | 3 |
#define do_init_thread do_init_thread32 |
4 | 4 |
|
b/linux-user/flat.h | ||
---|---|---|
22 | 22 |
|
23 | 23 |
struct flat_hdr { |
24 | 24 |
char magic[4]; |
25 |
target_ulong rev; /* version (as above) */
|
|
26 |
target_ulong entry; /* Offset of first executable instruction
|
|
27 |
with text segment from beginning of file */
|
|
28 |
target_ulong data_start; /* Offset of data segment from beginning of
|
|
29 |
file */
|
|
30 |
target_ulong data_end; /* Offset of end of data segment
|
|
31 |
from beginning of file */
|
|
32 |
target_ulong bss_end; /* Offset of end of bss segment from beginning
|
|
33 |
of file */
|
|
25 |
abi_ulong rev; /* version (as above) */
|
|
26 |
abi_ulong entry; /* Offset of first executable instruction
|
|
27 |
with text segment from beginning of file */
|
|
28 |
abi_ulong data_start; /* Offset of data segment from beginning of
|
|
29 |
file */
|
|
30 |
abi_ulong data_end; /* Offset of end of data segment
|
|
31 |
from beginning of file */
|
|
32 |
abi_ulong bss_end; /* Offset of end of bss segment from beginning
|
|
33 |
of file */
|
|
34 | 34 |
|
35 | 35 |
/* (It is assumed that data_end through bss_end forms the bss segment.) */ |
36 | 36 |
|
37 |
target_ulong stack_size; /* Size of stack, in bytes */
|
|
38 |
target_ulong reloc_start; /* Offset of relocation records from
|
|
39 |
beginning of file */
|
|
40 |
target_ulong reloc_count; /* Number of relocation records */
|
|
41 |
target_ulong flags;
|
|
42 |
target_ulong build_date; /* When the program/library was built */
|
|
43 |
target_ulong filler[5]; /* Reservered, set to zero */
|
|
37 |
abi_ulong stack_size; /* Size of stack, in bytes */
|
|
38 |
abi_ulong reloc_start; /* Offset of relocation records from
|
|
39 |
beginning of file */
|
|
40 |
abi_ulong reloc_count; /* Number of relocation records */
|
|
41 |
abi_ulong flags;
|
|
42 |
abi_ulong build_date; /* When the program/library was built */
|
|
43 |
abi_ulong filler[5]; /* Reservered, set to zero */
|
|
44 | 44 |
}; |
45 | 45 |
|
46 | 46 |
#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ |
b/linux-user/flatload.c | ||
---|---|---|
63 | 63 |
#define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */ |
64 | 64 |
|
65 | 65 |
struct lib_info { |
66 |
target_ulong start_code; /* Start of text segment */
|
|
67 |
target_ulong start_data; /* Start of data segment */
|
|
68 |
target_ulong end_data; /* Start of bss section */
|
|
69 |
target_ulong start_brk; /* End of data segment */
|
|
70 |
target_ulong text_len; /* Length of text segment */
|
|
71 |
target_ulong entry; /* Start address for this module */
|
|
72 |
target_ulong build_date; /* When this one was compiled */
|
|
66 |
abi_ulong start_code; /* Start of text segment */
|
|
67 |
abi_ulong start_data; /* Start of data segment */
|
|
68 |
abi_ulong end_data; /* Start of bss section */
|
|
69 |
abi_ulong start_brk; /* End of data segment */
|
|
70 |
abi_ulong text_len; /* Length of text segment */
|
|
71 |
abi_ulong entry; /* Start address for this module */
|
|
72 |
abi_ulong build_date; /* When this one was compiled */
|
|
73 | 73 |
short loaded; /* Has this library been loaded? */ |
74 | 74 |
}; |
75 | 75 |
|
... | ... | |
89 | 89 |
*/ |
90 | 90 |
|
91 | 91 |
/* Push a block of strings onto the guest stack. */ |
92 |
static target_ulong copy_strings(target_ulong p, int n, char **s)
|
|
92 |
static abi_ulong copy_strings(abi_ulong p, int n, char **s)
|
|
93 | 93 |
{ |
94 | 94 |
int len; |
95 | 95 |
|
... | ... | |
102 | 102 |
return p; |
103 | 103 |
} |
104 | 104 |
|
105 |
int target_pread(int fd, target_ulong ptr, target_ulong len,
|
|
106 |
target_ulong offset)
|
|
105 |
int target_pread(int fd, abi_ulong ptr, abi_ulong len,
|
|
106 |
abi_ulong offset)
|
|
107 | 107 |
{ |
108 | 108 |
void *buf; |
109 | 109 |
int ret; |
... | ... | |
262 | 262 |
|
263 | 263 |
/****************************************************************************/ |
264 | 264 |
|
265 |
static target_ulong
|
|
266 |
calc_reloc(target_ulong r, struct lib_info *p, int curid, int internalp)
|
|
265 |
static abi_ulong
|
|
266 |
calc_reloc(abi_ulong r, struct lib_info *p, int curid, int internalp)
|
|
267 | 267 |
{ |
268 |
target_ulong addr;
|
|
268 |
abi_ulong addr;
|
|
269 | 269 |
int id; |
270 |
target_ulong start_brk;
|
|
271 |
target_ulong start_data;
|
|
272 |
target_ulong text_len;
|
|
273 |
target_ulong start_code;
|
|
270 |
abi_ulong start_brk;
|
|
271 |
abi_ulong start_data;
|
|
272 |
abi_ulong text_len;
|
|
273 |
abi_ulong start_code;
|
|
274 | 274 |
|
275 | 275 |
#ifdef CONFIG_BINFMT_SHARED_FLAT |
276 | 276 |
#error needs checking |
... | ... | |
381 | 381 |
/****************************************************************************/ |
382 | 382 |
|
383 | 383 |
static int load_flat_file(struct linux_binprm * bprm, |
384 |
struct lib_info *libinfo, int id, target_ulong *extra_stack)
|
|
384 |
struct lib_info *libinfo, int id, abi_ulong *extra_stack)
|
|
385 | 385 |
{ |
386 | 386 |
struct flat_hdr * hdr; |
387 |
target_ulong textpos = 0, datapos = 0, result;
|
|
388 |
target_ulong realdatastart = 0;
|
|
389 |
target_ulong text_len, data_len, bss_len, stack_len, flags;
|
|
390 |
target_ulong memp = 0; /* for finding the brk area */
|
|
391 |
target_ulong extra;
|
|
392 |
target_ulong reloc = 0, rp;
|
|
387 |
abi_ulong textpos = 0, datapos = 0, result;
|
|
388 |
abi_ulong realdatastart = 0;
|
|
389 |
abi_ulong text_len, data_len, bss_len, stack_len, flags;
|
|
390 |
abi_ulong memp = 0; /* for finding the brk area */
|
|
391 |
abi_ulong extra;
|
|
392 |
abi_ulong reloc = 0, rp;
|
|
393 | 393 |
int i, rev, relocs = 0; |
394 |
target_ulong fpos;
|
|
395 |
target_ulong start_code, end_code;
|
|
396 |
target_ulong indx_len;
|
|
394 |
abi_ulong fpos;
|
|
395 |
abi_ulong start_code, end_code;
|
|
396 |
abi_ulong indx_len;
|
|
397 | 397 |
|
398 | 398 |
hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
399 | 399 |
|
... | ... | |
440 | 440 |
/* |
441 | 441 |
* calculate the extra space we need to map in |
442 | 442 |
*/ |
443 |
extra = relocs * sizeof(target_ulong);
|
|
443 |
extra = relocs * sizeof(abi_ulong);
|
|
444 | 444 |
if (extra < bss_len + stack_len) |
445 | 445 |
extra = bss_len + stack_len; |
446 | 446 |
|
447 | 447 |
/* Add space for library base pointers. Make sure this does not |
448 | 448 |
misalign the doesn't misalign the data segment. */ |
449 |
indx_len = MAX_SHARED_LIBS * sizeof(target_ulong);
|
|
450 |
indx_len = (indx_len + 15) & ~(target_ulong)15;
|
|
449 |
indx_len = MAX_SHARED_LIBS * sizeof(abi_ulong);
|
|
450 |
indx_len = (indx_len + 15) & ~(abi_ulong)15;
|
|
451 | 451 |
|
452 | 452 |
/* |
453 | 453 |
* there are a couple of cases here, the separate code/data |
... | ... | |
485 | 485 |
#ifdef CONFIG_BINFMT_ZFLAT |
486 | 486 |
if (flags & FLAT_FLAG_GZDATA) { |
487 | 487 |
result = decompress_exec(bprm, fpos, (char *) datapos, |
488 |
data_len + (relocs * sizeof(target_ulong)))
|
|
488 |
data_len + (relocs * sizeof(abi_ulong)))
|
|
489 | 489 |
} else |
490 | 490 |
#endif |
491 | 491 |
{ |
492 | 492 |
result = target_pread(bprm->fd, datapos, |
493 |
data_len + (relocs * sizeof(target_ulong)),
|
|
493 |
data_len + (relocs * sizeof(abi_ulong)),
|
|
494 | 494 |
fpos); |
495 | 495 |
} |
496 | 496 |
if (result < 0) { |
... | ... | |
544 | 544 |
text_len, 0); |
545 | 545 |
if (result >= 0) { |
546 | 546 |
result = target_pread(bprm->fd, datapos, |
547 |
data_len + (relocs * sizeof(target_ulong)),
|
|
547 |
data_len + (relocs * sizeof(abi_ulong)),
|
|
548 | 548 |
ntohl(hdr->data_start)); |
549 | 549 |
} |
550 | 550 |
} |
... | ... | |
597 | 597 |
if (flags & FLAT_FLAG_GOTPIC) { |
598 | 598 |
rp = datapos; |
599 | 599 |
while (1) { |
600 |
target_ulong addr;
|
|
600 |
abi_ulong addr;
|
|
601 | 601 |
addr = tgetl(rp); |
602 | 602 |
if (addr == -1) |
603 | 603 |
break; |
... | ... | |
607 | 607 |
return -ENOEXEC; |
608 | 608 |
tputl(rp, addr); |
609 | 609 |
} |
610 |
rp += sizeof(target_ulong);
|
|
610 |
rp += sizeof(abi_ulong);
|
|
611 | 611 |
} |
612 | 612 |
} |
613 | 613 |
|
... | ... | |
624 | 624 |
*/ |
625 | 625 |
if (rev > OLD_FLAT_VERSION) { |
626 | 626 |
for (i = 0; i < relocs; i++) { |
627 |
target_ulong addr, relval;
|
|
627 |
abi_ulong addr, relval;
|
|
628 | 628 |
|
629 | 629 |
/* Get the address of the pointer to be |
630 | 630 |
relocated (of course, the address has to be |
631 | 631 |
relocated first). */ |
632 |
relval = tgetl(reloc + i * sizeof (target_ulong));
|
|
632 |
relval = tgetl(reloc + i * sizeof (abi_ulong));
|
|
633 | 633 |
addr = flat_get_relocate_addr(relval); |
634 | 634 |
rp = calc_reloc(addr, libinfo, id, 1); |
635 | 635 |
if (rp == RELOC_FAILED) |
... | ... | |
657 | 657 |
} |
658 | 658 |
} else { |
659 | 659 |
for (i = 0; i < relocs; i++) { |
660 |
target_ulong relval;
|
|
661 |
relval = tgetl(reloc + i * sizeof (target_ulong));
|
|
660 |
abi_ulong relval;
|
|
661 |
relval = tgetl(reloc + i * sizeof (abi_ulong));
|
|
662 | 662 |
old_reloc(&libinfo[0], relval); |
663 | 663 |
} |
664 | 664 |
} |
... | ... | |
712 | 712 |
struct image_info * info) |
713 | 713 |
{ |
714 | 714 |
struct lib_info libinfo[MAX_SHARED_LIBS]; |
715 |
target_ulong p = bprm->p;
|
|
716 |
target_ulong stack_len;
|
|
717 |
target_ulong start_addr;
|
|
718 |
target_ulong sp;
|
|
715 |
abi_ulong p = bprm->p;
|
|
716 |
abi_ulong stack_len;
|
|
717 |
abi_ulong start_addr;
|
|
718 |
abi_ulong sp;
|
|
719 | 719 |
int res; |
720 | 720 |
int i, j; |
721 | 721 |
|
... | ... | |
740 | 740 |
/* Update data segment pointers for all libraries */ |
741 | 741 |
for (i=0; i<MAX_SHARED_LIBS; i++) { |
742 | 742 |
if (libinfo[i].loaded) { |
743 |
target_ulong p;
|
|
743 |
abi_ulong p;
|
|
744 | 744 |
p = libinfo[i].start_data; |
745 | 745 |
for (j=0; j<MAX_SHARED_LIBS; j++) { |
746 | 746 |
p -= 4; |
... | ... | |
758 | 758 |
p = copy_strings(p, bprm->envc, bprm->envp); |
759 | 759 |
p = copy_strings(p, bprm->argc, bprm->argv); |
760 | 760 |
/* Align stack. */ |
761 |
sp = p & ~(target_ulong)(sizeof(target_ulong) - 1);
|
|
761 |
sp = p & ~(abi_ulong)(sizeof(abi_ulong) - 1);
|
|
762 | 762 |
/* Enforce final stack alignment of 16 bytes. This is sufficient |
763 | 763 |
for all current targets, and excess alignment is harmless. */ |
764 | 764 |
stack_len = bprm->envc + bprm->argc + 2; |
765 | 765 |
stack_len += 3; /* argc, arvg, argp */ |
766 |
stack_len *= sizeof(target_ulong);
|
|
766 |
stack_len *= sizeof(abi_ulong);
|
|
767 | 767 |
if ((sp + stack_len) & 15) |
768 | 768 |
sp -= 16 - ((sp + stack_len) & 15); |
769 | 769 |
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1); |
b/linux-user/i386/syscall.h | ||
---|---|---|
31 | 31 |
|
32 | 32 |
struct target_modify_ldt_ldt_s { |
33 | 33 |
unsigned int entry_number; |
34 |
target_ulong base_addr;
|
|
34 |
abi_ulong base_addr;
|
|
35 | 35 |
unsigned int limit; |
36 | 36 |
unsigned int flags; |
37 | 37 |
}; |
... | ... | |
79 | 79 |
/* |
80 | 80 |
* normal regs, with special meaning for the segment descriptors.. |
81 | 81 |
*/ |
82 |
target_long ebx;
|
|
83 |
target_long ecx;
|
|
84 |
target_long edx;
|
|
85 |
target_long esi;
|
|
86 |
target_long edi;
|
|
87 |
target_long ebp;
|
|
88 |
target_long eax;
|
|
89 |
target_long __null_ds;
|
|
90 |
target_long __null_es;
|
|
91 |
target_long __null_fs;
|
|
92 |
target_long __null_gs;
|
|
93 |
target_long orig_eax;
|
|
94 |
target_long eip;
|
|
82 |
abi_long ebx;
|
|
83 |
abi_long ecx;
|
|
84 |
abi_long edx;
|
|
85 |
abi_long esi;
|
|
86 |
abi_long edi;
|
|
87 |
abi_long ebp;
|
|
88 |
abi_long eax;
|
|
89 |
abi_long __null_ds;
|
|
90 |
abi_long __null_es;
|
|
91 |
abi_long __null_fs;
|
|
92 |
abi_long __null_gs;
|
|
93 |
abi_long orig_eax;
|
|
94 |
abi_long eip;
|
|
95 | 95 |
unsigned short cs, __csh; |
96 |
target_long eflags;
|
|
97 |
target_long esp;
|
|
96 |
abi_long eflags;
|
|
97 |
abi_long esp;
|
|
98 | 98 |
unsigned short ss, __ssh; |
99 | 99 |
/* |
100 | 100 |
* these are specific to v86 mode: |
... | ... | |
106 | 106 |
}; |
107 | 107 |
|
108 | 108 |
struct target_revectored_struct { |
109 |
target_ulong __map[8]; /* 256 bits */
|
|
109 |
abi_ulong __map[8]; /* 256 bits */
|
|
110 | 110 |
}; |
111 | 111 |
|
112 | 112 |
struct target_vm86_struct { |
113 | 113 |
struct target_vm86_regs regs; |
114 |
target_ulong flags;
|
|
115 |
target_ulong screen_bitmap;
|
|
116 |
target_ulong cpu_type;
|
|
114 |
abi_ulong flags;
|
|
115 |
abi_ulong screen_bitmap;
|
|
116 |
abi_ulong cpu_type;
|
|
117 | 117 |
struct target_revectored_struct int_revectored; |
118 | 118 |
struct target_revectored_struct int21_revectored; |
119 | 119 |
}; |
... | ... | |
124 | 124 |
#define TARGET_VM86_SCREEN_BITMAP 0x0001 |
125 | 125 |
|
126 | 126 |
struct target_vm86plus_info_struct { |
127 |
target_ulong flags;
|
|
127 |
abi_ulong flags;
|
|
128 | 128 |
#define TARGET_force_return_for_pic (1 << 0) |
129 | 129 |
#define TARGET_vm86dbg_active (1 << 1) /* for debugger */ |
130 | 130 |
#define TARGET_vm86dbg_TFpendig (1 << 2) /* for debugger */ |
... | ... | |
134 | 134 |
|
135 | 135 |
struct target_vm86plus_struct { |
136 | 136 |
struct target_vm86_regs regs; |
137 |
target_ulong flags;
|
|
138 |
target_ulong screen_bitmap;
|
|
139 |
target_ulong cpu_type;
|
|
137 |
abi_ulong flags;
|
|
138 |
abi_ulong screen_bitmap;
|
|
139 |
abi_ulong cpu_type;
|
|
140 | 140 |
struct target_revectored_struct int_revectored; |
141 | 141 |
struct target_revectored_struct int21_revectored; |
142 | 142 |
struct target_vm86plus_info_struct vm86plus; |
b/linux-user/i386/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUX86State *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->regs[R_ESP]; |
27 | 27 |
} |
b/linux-user/linuxload.c | ||
---|---|---|
13 | 13 |
#define NGROUPS 32 |
14 | 14 |
|
15 | 15 |
/* ??? This should really be somewhere else. */ |
16 |
void memcpy_to_target(target_ulong dest, const void *src,
|
|
16 |
void memcpy_to_target(abi_ulong dest, const void *src,
|
|
17 | 17 |
unsigned long len) |
18 | 18 |
{ |
19 | 19 |
void *host_ptr; |
... | ... | |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
/* Construct the envp and argv tables on the target stack. */ |
112 |
target_ulong loader_build_argptr(int envc, int argc, target_ulong sp,
|
|
113 |
target_ulong stringp, int push_ptr)
|
|
112 |
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
|
|
113 |
abi_ulong stringp, int push_ptr)
|
|
114 | 114 |
{ |
115 |
int n = sizeof(target_ulong);
|
|
116 |
target_ulong envp;
|
|
117 |
target_ulong argv;
|
|
115 |
int n = sizeof(abi_ulong);
|
|
116 |
abi_ulong envp;
|
|
117 |
abi_ulong argv;
|
|
118 | 118 |
|
119 | 119 |
sp -= (envc + 1) * n; |
120 | 120 |
envp = sp; |
b/linux-user/m68k/syscall.h | ||
---|---|---|
3 | 3 |
stack during a system call. */ |
4 | 4 |
|
5 | 5 |
struct target_pt_regs { |
6 |
target_long d1, d2, d3, d4, d5, d6, d7;
|
|
7 |
target_long a0, a1, a2, a3, a4, a5, a6;
|
|
8 |
target_ulong d0;
|
|
9 |
target_ulong usp;
|
|
10 |
target_ulong orig_d0;
|
|
6 |
abi_long d1, d2, d3, d4, d5, d6, d7;
|
|
7 |
abi_long a0, a1, a2, a3, a4, a5, a6;
|
|
8 |
abi_ulong d0;
|
|
9 |
abi_ulong usp;
|
|
10 |
abi_ulong orig_d0;
|
|
11 | 11 |
int16_t stkadj; |
12 | 12 |
uint16_t sr; |
13 |
target_ulong pc;
|
|
13 |
abi_ulong pc;
|
|
14 | 14 |
uint16_t fntvex; |
15 | 15 |
uint16_t __fill; |
16 | 16 |
}; |
b/linux-user/m68k/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
b/linux-user/main.c | ||
---|---|---|
168 | 168 |
void cpu_loop(CPUX86State *env) |
169 | 169 |
{ |
170 | 170 |
int trapnr; |
171 |
target_ulong pc;
|
|
171 |
abi_ulong pc;
|
|
172 | 172 |
target_siginfo_t info; |
173 | 173 |
|
174 | 174 |
for(;;) { |
... | ... | |
305 | 305 |
#ifdef TARGET_ARM |
306 | 306 |
|
307 | 307 |
/* XXX: find a better solution */ |
308 |
extern void tb_invalidate_page_range(target_ulong start, target_ulong end);
|
|
308 |
extern void tb_invalidate_page_range(abi_ulong start, abi_ulong end);
|
|
309 | 309 |
|
310 |
static void arm_cache_flush(target_ulong start, target_ulong last)
|
|
310 |
static void arm_cache_flush(abi_ulong start, abi_ulong last)
|
|
311 | 311 |
{ |
312 |
target_ulong addr, last1;
|
|
312 |
abi_ulong addr, last1;
|
|
313 | 313 |
|
314 | 314 |
if (last < start) |
315 | 315 |
return; |
... | ... | |
474 | 474 |
static inline void save_window_offset(CPUSPARCState *env, int cwp1) |
475 | 475 |
{ |
476 | 476 |
unsigned int i; |
477 |
target_ulong sp_ptr;
|
|
477 |
abi_ulong sp_ptr;
|
|
478 | 478 |
|
479 | 479 |
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; |
480 | 480 |
#if defined(DEBUG_WIN) |
... | ... | |
483 | 483 |
#endif |
484 | 484 |
for(i = 0; i < 16; i++) { |
485 | 485 |
tputl(sp_ptr, env->regbase[get_reg_index(env, cwp1, 8 + i)]); |
486 |
sp_ptr += sizeof(target_ulong);
|
|
486 |
sp_ptr += sizeof(abi_ulong);
|
|
487 | 487 |
} |
488 | 488 |
} |
489 | 489 |
|
... | ... | |
505 | 505 |
static void restore_window(CPUSPARCState *env) |
506 | 506 |
{ |
507 | 507 |
unsigned int new_wim, i, cwp1; |
508 |
target_ulong sp_ptr;
|
|
508 |
abi_ulong sp_ptr;
|
|
509 | 509 |
|
510 | 510 |
new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) & |
511 | 511 |
((1LL << NWINDOWS) - 1); |
... | ... | |
519 | 519 |
#endif |
520 | 520 |
for(i = 0; i < 16; i++) { |
521 | 521 |
env->regbase[get_reg_index(env, cwp1, 8 + i)] = tgetl(sp_ptr); |
522 |
sp_ptr += sizeof(target_ulong);
|
|
522 |
sp_ptr += sizeof(abi_ulong);
|
|
523 | 523 |
} |
524 | 524 |
env->wim = new_wim; |
525 | 525 |
#ifdef TARGET_SPARC64 |
... | ... | |
572 | 572 |
env->regwptr[2], env->regwptr[3], |
573 | 573 |
env->regwptr[4], env->regwptr[5]); |
574 | 574 |
if ((unsigned int)ret >= (unsigned int)(-515)) { |
575 |
#ifdef TARGET_SPARC64
|
|
575 |
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
|
576 | 576 |
env->xcc |= PSR_CARRY; |
577 | 577 |
#else |
578 | 578 |
env->psr |= PSR_CARRY; |
579 | 579 |
#endif |
580 | 580 |
ret = -ret; |
581 | 581 |
} else { |
582 |
#ifdef TARGET_SPARC64
|
|
582 |
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
|
583 | 583 |
env->xcc &= ~PSR_CARRY; |
584 | 584 |
#else |
585 | 585 |
env->psr &= ~PSR_CARRY; |
... | ... | |
591 | 591 |
env->npc = env->npc + 4; |
592 | 592 |
break; |
593 | 593 |
case 0x83: /* flush windows */ |
594 |
#ifdef TARGET_ABI32 |
|
595 |
case 0x103: |
|
596 |
#endif |
|
594 | 597 |
flush_windows(env); |
595 | 598 |
/* next instruction */ |
596 | 599 |
env->pc = env->npc; |
... | ... | |
1489 | 1492 |
ret = -ENOSYS; |
1490 | 1493 |
} else { |
1491 | 1494 |
int nb_args; |
1492 |
target_ulong sp_reg;
|
|
1493 |
target_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
|
|
1495 |
abi_ulong sp_reg;
|
|
1496 |
abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
|
|
1494 | 1497 |
|
1495 | 1498 |
nb_args = mips_syscall_args[syscall_num]; |
1496 | 1499 |
sp_reg = env->gpr[29][env->current_tc]; |
... | ... | |
2239 | 2242 |
int i; |
2240 | 2243 |
|
2241 | 2244 |
for(i = 0; i < 28; i++) { |
2242 |
env->ir[i] = ((target_ulong *)regs)[i];
|
|
2245 |
env->ir[i] = ((abi_ulong *)regs)[i];
|
|
2243 | 2246 |
} |
2244 | 2247 |
env->ipr[IPR_USP] = regs->usp; |
2245 | 2248 |
env->ir[30] = regs->usp; |
b/linux-user/mips/syscall.h | ||
---|---|---|
4 | 4 |
|
5 | 5 |
struct target_pt_regs { |
6 | 6 |
/* Pad bytes for argument save space on the stack. */ |
7 |
target_ulong pad0[6];
|
|
7 |
abi_ulong pad0[6];
|
|
8 | 8 |
|
9 | 9 |
/* Saved main processor registers. */ |
10 |
target_ulong regs[32];
|
|
10 |
abi_ulong regs[32];
|
|
11 | 11 |
|
12 | 12 |
/* Saved special registers. */ |
13 |
target_ulong cp0_status;
|
|
14 |
target_ulong lo;
|
|
15 |
target_ulong hi;
|
|
16 |
target_ulong cp0_badvaddr;
|
|
17 |
target_ulong cp0_cause;
|
|
18 |
target_ulong cp0_epc;
|
|
13 |
abi_ulong cp0_status;
|
|
14 |
abi_ulong lo;
|
|
15 |
abi_ulong hi;
|
|
16 |
abi_ulong cp0_badvaddr;
|
|
17 |
abi_ulong cp0_cause;
|
|
18 |
abi_ulong cp0_epc;
|
|
19 | 19 |
}; |
20 | 20 |
|
21 | 21 |
/* Target errno definitions taken from asm-mips/errno.h */ |
b/linux-user/mips/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_long ss_sp;
|
|
10 |
target_ulong ss_size;
|
|
11 |
target_long ss_flags;
|
|
9 |
abi_long ss_sp;
|
|
10 |
abi_ulong ss_size;
|
|
11 |
abi_long ss_flags;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->gpr[29][state->current_tc]; |
27 | 27 |
} |
b/linux-user/mips64/syscall.h | ||
---|---|---|
4 | 4 |
|
5 | 5 |
struct target_pt_regs { |
6 | 6 |
/* Saved main processor registers. */ |
7 |
target_ulong regs[32];
|
|
7 |
abi_ulong regs[32];
|
|
8 | 8 |
|
9 | 9 |
/* Saved special registers. */ |
10 |
target_ulong cp0_status;
|
|
11 |
target_ulong lo;
|
|
12 |
target_ulong hi;
|
|
13 |
target_ulong cp0_badvaddr;
|
|
14 |
target_ulong cp0_cause;
|
|
15 |
target_ulong cp0_epc;
|
|
10 |
abi_ulong cp0_status;
|
|
11 |
abi_ulong lo;
|
|
12 |
abi_ulong hi;
|
|
13 |
abi_ulong cp0_badvaddr;
|
|
14 |
abi_ulong cp0_cause;
|
|
15 |
abi_ulong cp0_epc;
|
|
16 | 16 |
}; |
17 | 17 |
|
18 | 18 |
/* Target errno definitions taken from asm-mips/errno.h */ |
b/linux-user/mips64/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_long ss_sp;
|
|
10 |
target_ulong ss_size;
|
|
11 |
target_long ss_flags;
|
|
9 |
abi_long ss_sp;
|
|
10 |
abi_ulong ss_size;
|
|
11 |
abi_long ss_flags;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->gpr[29][state->current_tc]; |
27 | 27 |
} |
b/linux-user/mmap.c | ||
---|---|---|
30 | 30 |
//#define DEBUG_MMAP |
31 | 31 |
|
32 | 32 |
/* NOTE: all the constants are the HOST ones, but addresses are target. */ |
33 |
int target_mprotect(target_ulong start, target_ulong len, int prot)
|
|
33 |
int target_mprotect(abi_ulong start, abi_ulong len, int prot)
|
|
34 | 34 |
{ |
35 |
target_ulong end, host_start, host_end, addr;
|
|
35 |
abi_ulong end, host_start, host_end, addr;
|
|
36 | 36 |
int prot1, ret; |
37 | 37 |
|
38 | 38 |
#ifdef DEBUG_MMAP |
... | ... | |
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
/* map an incomplete host page */ |
99 |
static int mmap_frag(target_ulong real_start,
|
|
100 |
target_ulong start, target_ulong end,
|
|
101 |
int prot, int flags, int fd, target_ulong offset)
|
|
99 |
static int mmap_frag(abi_ulong real_start,
|
|
100 |
abi_ulong start, abi_ulong end,
|
|
101 |
int prot, int flags, int fd, abi_ulong offset)
|
|
102 | 102 |
{ |
103 |
target_ulong real_end, ret, addr;
|
|
103 |
abi_ulong real_end, ret, addr;
|
|
104 | 104 |
void *host_start; |
105 | 105 |
int prot1, prot_new; |
106 | 106 |
|
... | ... | |
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
/* NOTE: all the constants are the HOST ones */ |
155 |
target_long target_mmap(target_ulong start, target_ulong len, int prot,
|
|
156 |
int flags, int fd, target_ulong offset)
|
|
155 |
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
|
156 |
int flags, int fd, abi_ulong offset)
|
|
157 | 157 |
{ |
158 |
target_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len;
|
|
158 |
abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len;
|
|
159 | 159 |
unsigned long host_start; |
160 | 160 |
#if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__) || \ |
161 | 161 |
defined(__ia64) || defined(__mips__) |
162 |
static target_ulong last_start = 0x40000000;
|
|
162 |
static abi_ulong last_start = 0x40000000;
|
|
163 | 163 |
#elif defined(__CYGWIN__) |
164 | 164 |
/* Cygwin doesn't have a whole lot of address space. */ |
165 |
static target_ulong last_start = 0x18000000;
|
|
165 |
static abi_ulong last_start = 0x18000000;
|
|
166 | 166 |
#endif |
167 | 167 |
|
168 | 168 |
#ifdef DEBUG_MMAP |
... | ... | |
228 | 228 |
* TARGET_PAGE_SIZE, see exec.c. qemu_real_host_page_size is the |
229 | 229 |
* hosts real page size. |
230 | 230 |
*/ |
231 |
target_ulong host_end;
|
|
231 |
abi_ulong host_end;
|
|
232 | 232 |
unsigned long host_aligned_start; |
233 | 233 |
|
234 | 234 |
host_len = HOST_PAGE_ALIGN(host_len + qemu_host_page_size |
... | ... | |
354 | 354 |
return start; |
355 | 355 |
} |
356 | 356 |
|
357 |
int target_munmap(target_ulong start, target_ulong len)
|
|
357 |
int target_munmap(abi_ulong start, abi_ulong len)
|
|
358 | 358 |
{ |
359 |
target_ulong end, real_start, real_end, addr;
|
|
359 |
abi_ulong end, real_start, real_end, addr;
|
|
360 | 360 |
int prot, ret; |
361 | 361 |
|
362 | 362 |
#ifdef DEBUG_MMAP |
... | ... | |
408 | 408 |
|
409 | 409 |
/* XXX: currently, we only handle MAP_ANONYMOUS and not MAP_FIXED |
410 | 410 |
blocks which have been allocated starting on a host page */ |
411 |
target_long target_mremap(target_ulong old_addr, target_ulong old_size,
|
|
412 |
target_ulong new_size, unsigned long flags,
|
|
413 |
target_ulong new_addr)
|
|
411 |
abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
|
|
412 |
abi_ulong new_size, unsigned long flags,
|
|
413 |
abi_ulong new_addr)
|
|
414 | 414 |
{ |
415 | 415 |
int prot; |
416 | 416 |
unsigned long host_addr; |
... | ... | |
426 | 426 |
return new_addr; |
427 | 427 |
} |
428 | 428 |
|
429 |
int target_msync(target_ulong start, target_ulong len, int flags)
|
|
429 |
int target_msync(abi_ulong start, abi_ulong len, int flags)
|
|
430 | 430 |
{ |
431 |
target_ulong end;
|
|
431 |
abi_ulong end;
|
|
432 | 432 |
|
433 | 433 |
if (start & ~TARGET_PAGE_MASK) |
434 | 434 |
return -EINVAL; |
b/linux-user/ppc/syscall.h | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/* ioctls */ |
46 | 46 |
struct target_revectored_struct { |
47 |
target_ulong __map[8]; /* 256 bits */
|
|
47 |
abi_ulong __map[8]; /* 256 bits */
|
|
48 | 48 |
}; |
49 | 49 |
|
50 | 50 |
/* |
b/linux-user/ppc/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUPPCState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->gpr[1]; |
27 | 27 |
} |
b/linux-user/ppc64/syscall.h | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/* ioctls */ |
46 | 46 |
struct target_revectored_struct { |
47 |
target_ulong __map[8]; /* 256 bits */
|
|
47 |
abi_ulong __map[8]; /* 256 bits */
|
|
48 | 48 |
}; |
49 | 49 |
|
50 | 50 |
/* |
b/linux-user/ppc64/target_signal.h | ||
---|---|---|
6 | 6 |
/* this struct defines a stack used during syscall handling */ |
7 | 7 |
|
8 | 8 |
typedef struct target_sigaltstack { |
9 |
target_ulong ss_sp;
|
|
10 |
target_long ss_flags;
|
|
11 |
target_ulong ss_size;
|
|
9 |
abi_ulong ss_sp;
|
|
10 |
abi_long ss_flags;
|
|
11 |
abi_ulong ss_size;
|
|
12 | 12 |
} target_stack_t; |
13 | 13 |
|
14 | 14 |
|
... | ... | |
21 | 21 |
#define TARGET_MINSIGSTKSZ 2048 |
22 | 22 |
#define TARGET_SIGSTKSZ 8192 |
23 | 23 |
|
24 |
static inline target_ulong get_sp_from_cpustate(CPUPPCState *state)
|
|
24 |
static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state)
|
|
25 | 25 |
{ |
26 | 26 |
return state->gpr[1]; |
27 | 27 |
} |
b/linux-user/qemu.h | ||
---|---|---|
1 | 1 |
#ifndef QEMU_H |
2 | 2 |
#define QEMU_H |
3 | 3 |
|
4 |
#include "thunk.h" |
|
5 |
|
|
6 | 4 |
#include <signal.h> |
7 | 5 |
#include <string.h> |
8 |
#include "syscall_defs.h" |
|
9 | 6 |
|
10 | 7 |
#include "cpu.h" |
8 |
|
|
9 |
#ifdef TARGET_ABI32 |
|
10 |
typedef uint32_t abi_ulong; |
|
11 |
typedef int32_t abi_long; |
|
12 |
#define TARGET_ABI_BITS 32 |
|
13 |
#else |
|
14 |
typedef target_ulong abi_ulong; |
Also available in: Unified diff