Skip to content

Commit

Permalink
Fix bugs for dynamic linked binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
staceyson committed Mar 7, 2013
1 parent 7ea453e commit 8bd8522
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 5 additions & 5 deletions work/qemu-1.4.0/bsd-user/elfload.c
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 2 additions & 6 deletions work/qemu-1.4.0/bsd-user/syscall.c
Expand Up @@ -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;
Expand Down

0 comments on commit 8bd8522

Please sign in to comment.