Browse files

Fix bugs for dynamic linked binaries.

  • Loading branch information...
1 parent 7ea453e commit 8bd8522f11382f09722845245eebd9580e5541e4 @staceyson committed Mar 7, 2013
Showing with 7 additions and 11 deletions.
  1. +5 −5 work/qemu-1.4.0/bsd-user/elfload.c
  2. +2 −6 work/qemu-1.4.0/bsd-user/syscall.c
View
10 work/qemu-1.4.0/bsd-user/elfload.c
@@ -403,8 +403,11 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
{
regs->cp0_status = 2 << CP0St_KSU;
- regs->regs[25] = regs->cp0_epc = infop->entry; /* t9 = pc = entry */
+ regs->regs[25] = regs->cp0_epc = infop->entry & ~3; /* t9 = pc = entry */
regs->regs[4] = regs->regs[29] = infop->start_stack; /* a0 = sp = start_stack */
+ regs->regs[5] = 0; /* a1 = 0 */
+ regs->regs[6] = 0; /* a2 = 0 */
+ regs->regs[7] = TARGET_PS_STRINGS; /* a3 = ps_strings */
}
#define USE_ELF_CORE_DUMP
@@ -1445,13 +1448,10 @@ int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
/* JRP - Need to add X86 lib dir stuff here... */
if (strcmp(elf_interpreter,"/usr/lib/libc.so.1") == 0 ||
- strcmp(elf_interpreter,"/usr/lib/ld.so.1") == 0) {
+ strcmp(elf_interpreter,"/libexec/ld-elf.so.1") == 0) {
ibcs2_interpreter = 1;
}
-#if 0
- printf("Using ELF interpreter %s\n", path(elf_interpreter));
-#endif
if (retval >= 0) {
retval = open(path(elf_interpreter), O_RDONLY);
if(retval >= 0) {
View
8 work/qemu-1.4.0/bsd-user/syscall.c
@@ -362,17 +362,13 @@ static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms)
static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms)
{
int ret = 0;
- abi_ulong tmp;
CPUMIPSState *mips_env = (CPUMIPSState *)env;
switch(op) {
case TARGET_MIPS_SET_TLS:
- if (get_user(tmp, parms, abi_ulong))
- ret = -TARGET_EFAULT;
- /* XXX temporary hack to work around FreeBSD 10 problem. */
- if (0 == mips_env->tls_value && tmp != 1)
- mips_env->tls_value = tmp;
+ mips_env->tls_value = parms;
break;
+
case TARGET_MIPS_GET_TLS:
if (put_user(mips_env->tls_value, parms, abi_ulong))
ret = -TARGET_EFAULT;

0 comments on commit 8bd8522

Please sign in to comment.