Commit 2f619698 authored by Fabrice Bellard's avatar Fabrice Bellard
Browse files

suppressed tgetx and tputx (initial patch by Thayne Harbaugh)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3653 c046a42c-6fe2-441c-8c8c-71466251a162
parent 67276f53
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -165,8 +165,14 @@ static void arm_semi_flen_cb(CPUState *env, target_ulong ret, target_ulong err)
#endif
}

#define ARG(n) tget32(args + (n) * 4)
#define SET_ARG(n, val) tput32(args + (n) * 4,val)
#define ARG(n)					\
({						\
    target_ulong __arg;				\
    /* FIXME - handle get_user() failure */	\
    get_user_ual(__arg, args + (n) * 4);	\
    __arg;					\
})
#define SET_ARG(n, val) put_user_ual(val, args + (n) * 4)
uint32_t do_arm_semihosting(CPUState *env)
{
    target_ulong args;
@@ -213,7 +219,11 @@ uint32_t do_arm_semihosting(CPUState *env)
        }
    case SYS_WRITEC:
        {
          char c = tget8(args);
          char c;

          if (get_user_u8(c, args))
              /* FIXME - should this error code be -TARGET_EFAULT ? */
              return (uint32_t)-1;
          /* Write to debug console.  stderr is near enough.  */
          if (use_gdb_syscalls()) {
                gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args);
+11 −14
Original line number Diff line number Diff line
@@ -179,8 +179,9 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
      regs->ARM_cpsr |= CPSR_T;
    regs->ARM_pc = infop->entry & 0xfffffffe;
    regs->ARM_sp = infop->start_stack;
    regs->ARM_r2 = tgetl(stack + 8); /* envp */
    regs->ARM_r1 = tgetl(stack + 4); /* envp */
    /* FIXME - what to for failure of get_user()? */
    get_user_ual(regs->ARM_r2, stack + 8); /* envp */
    get_user_ual(regs->ARM_r1, stack + 4); /* envp */
    /* XXX: it seems that r0 is zeroed after ! */
    regs->ARM_r0 = 0;
    /* For uClinux PIC binaries.  */
@@ -341,7 +342,8 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
     * but this is what the ABI wants and is needed to allow
     * execution of PPC BSD programs.
     */
    _regs->gpr[3] = tgetl(pos);
    /* FIXME - what to for failure of get_user()? */
    get_user_ual(_regs->gpr[3], pos);
    pos += sizeof(abi_ulong);
    _regs->gpr[4] = pos;
    for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong))
@@ -733,7 +735,8 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss)
        if (nbyte) {
	    nbyte = qemu_host_page_size - nbyte;
	    do {
		tput8(elf_bss, 0);
                /* FIXME - what to do if put_user() fails? */
		put_user_u8(0, elf_bss);
                elf_bss++;
	    } while (--nbyte);
        }
@@ -782,17 +785,11 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
        /* This is correct because Linux defines
         * elf_addr_t as Elf32_Off / Elf64_Off
         */
#if ELF_CLASS == ELFCLASS32
#define NEW_AUX_ENT(id, val) do {		\
            sp -= n; tput32(sp, val); \
            sp -= n; tput32(sp, id); \
            sp -= n; put_user_ual(val, sp);	\
            sp -= n; put_user_ual(id, sp);	\
          } while(0)
#else
#define NEW_AUX_ENT(id, val) do { \
            sp -= n; tput64(sp, val); \
            sp -= n; tput64(sp, id); \
          } while(0)
#endif

        NEW_AUX_ENT (AT_NULL, 0);

        /* There must be exactly DLINFO_ITEMS entries here.  */
+21 −10
Original line number Diff line number Diff line
@@ -598,14 +598,16 @@ static int load_flat_file(struct linux_binprm * bprm,
        rp = datapos;
        while (1) {
            abi_ulong addr;
            addr = tgetl(rp);
            if (get_user_ual(addr, rp))
                return -EFAULT;
            if (addr == -1)
                break;
            if (addr) {
                addr = calc_reloc(addr, libinfo, id, 0);
                if (addr == RELOC_FAILED)
                    return -ENOEXEC;
                tputl(rp, addr);
                if (put_user_ual(addr, rp))
                    return -EFAULT;
            }
            rp += sizeof(abi_ulong);
        }
@@ -629,14 +631,16 @@ static int load_flat_file(struct linux_binprm * bprm,
            /* Get the address of the pointer to be
               relocated (of course, the address has to be
               relocated first).  */
            relval = tgetl(reloc + i * sizeof (abi_ulong));
            if (get_user_ual(relval, reloc + i * sizeof(abi_ulong)))
                return -EFAULT;
            addr = flat_get_relocate_addr(relval);
            rp = calc_reloc(addr, libinfo, id, 1);
            if (rp == RELOC_FAILED)
                return -ENOEXEC;

            /* Get the pointer's value.  */
            addr = tgetl(rp);
            if (get_user_ual(addr, rp))
                return -EFAULT;
            if (addr != 0) {
                /*
                 * Do the relocation.  PIC relocs in the data section are
@@ -652,13 +656,15 @@ static int load_flat_file(struct linux_binprm * bprm,
                    return -ENOEXEC;

                /* Write back the relocated pointer.  */
                tputl(rp, addr);
                if (put_user_ual(addr, rp))
                    return -EFAULT;
            }
        }
    } else {
        for (i = 0; i < relocs; i++) {
            abi_ulong relval;
            relval = tgetl(reloc + i * sizeof (abi_ulong));
            if (get_user_ual(relval, reloc + i * sizeof(abi_ulong)))
                return -EFAULT;
            old_reloc(&libinfo[0], relval);
        }
    }
@@ -744,9 +750,12 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
            p = libinfo[i].start_data;
            for (j=0; j<MAX_SHARED_LIBS; j++) {
                p -= 4;
                tput32(p, libinfo[j].loaded
                /* FIXME - handle put_user() failures */
                if (put_user_ual(libinfo[j].loaded
                                 ? libinfo[j].start_data
                          : UNLOADED_LIB);
                                 : UNLOADED_LIB,
                                 p))
                    return -EFAULT;
            }
        }
    }
@@ -779,7 +788,9 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
    for (i = MAX_SHARED_LIBS-1; i>0; i--) {
            if (libinfo[i].loaded) {
                    /* Push previos first to call address */
                    --sp;	put_user(start_addr, sp);
                    --sp;
                    if (put_user_ual(start_addr, sp))
                        return -EFAULT;
                    start_addr = libinfo[i].entry;
            }
    }
+18 −7
Original line number Diff line number Diff line
@@ -124,21 +124,32 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
    sp -= (argc + 1) * n;
    argv = sp;
    if (push_ptr) {
        sp -= n; tputl(sp, envp);
        sp -= n; tputl(sp, argv);
        /* FIXME - handle put_user() failures */
        sp -= n;
        put_user_ual(envp, sp);
        sp -= n;
        put_user_ual(argv, sp);
    }
    sp -= n; tputl(sp, argc);
    sp -= n;
    /* FIXME - handle put_user() failures */
    put_user_ual(argc, sp);

    while (argc-- > 0) {
        tputl(argv, stringp); argv += n;
        /* FIXME - handle put_user() failures */
        put_user_ual(stringp, argv);
        argv += n;
        stringp += target_strlen(stringp) + 1;
    }
    tputl(argv, 0);
    /* FIXME - handle put_user() failures */
    put_user_ual(0, argv);
    while (envc-- > 0) {
        tputl(envp, stringp); envp += n;
        /* FIXME - handle put_user() failures */
        put_user_ual(stringp, envp);
        envp += n;
        stringp += target_strlen(stringp) + 1;
    }
    tputl(envp, 0);
    /* FIXME - handle put_user() failures */
    put_user_ual(0, envp);

    return sp;
}
+19 −11
Original line number Diff line number Diff line
@@ -380,7 +380,8 @@ void cpu_loop(CPUARMState *env)

                /* we handle the FPU emulation here, as Linux */
                /* we get the opcode */
                opcode = tget32(env->regs[15]);
                /* FIXME - what to do if get_user() fails? */
                get_user_u32(opcode, env->regs[15]);

                if (EmulateAll(opcode, &ts->fpa, env) == 0) {
                    info.si_signo = SIGILL;
@@ -401,20 +402,24 @@ void cpu_loop(CPUARMState *env)
                /* system call */
                if (trapnr == EXCP_BKPT) {
                    if (env->thumb) {
                        insn = tget16(env->regs[15]);
                        /* FIXME - what to do if get_user() fails? */
                        get_user_u16(insn, env->regs[15]);
                        n = insn & 0xff;
                        env->regs[15] += 2;
                    } else {
                        insn = tget32(env->regs[15]);
                        /* FIXME - what to do if get_user() fails? */
                        get_user_u32(insn, env->regs[15]);
                        n = (insn & 0xf) | ((insn >> 4) & 0xff0);
                        env->regs[15] += 4;
                    }
                } else {
                    if (env->thumb) {
                        insn = tget16(env->regs[15] - 2);
                        /* FIXME - what to do if get_user() fails? */
                        get_user_u16(insn, env->regs[15] - 2);
                        n = insn & 0xff;
                    } else {
                        insn = tget32(env->regs[15] - 4);
                        /* FIXME - what to do if get_user() fails? */
                        get_user_u32(insn, env->regs[15] - 4);
                        n = insn & 0xffffff;
                    }
                }
@@ -520,7 +525,8 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
           (int)sp_ptr, cwp1);
#endif
    for(i = 0; i < 16; i++) {
        tputl(sp_ptr, env->regbase[get_reg_index(env, cwp1, 8 + i)]);
        /* FIXME - what to do if put_user() fails? */
        put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr);
        sp_ptr += sizeof(abi_ulong);
    }
}
@@ -556,7 +562,8 @@ static void restore_window(CPUSPARCState *env)
           (int)sp_ptr, cwp1);
#endif
    for(i = 0; i < 16; i++) {
        env->regbase[get_reg_index(env, cwp1, 8 + i)] = tgetl(sp_ptr);
        /* FIXME - what to do if get_user() fails? */
        get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr);
        sp_ptr += sizeof(abi_ulong);
    }
    env->wim = new_wim;
@@ -1533,10 +1540,11 @@ void cpu_loop(CPUMIPSState *env)
                sp_reg = env->gpr[29][env->current_tc];
                switch (nb_args) {
                /* these arguments are taken from the stack */
                case 8: arg8 = tgetl(sp_reg + 28);
                case 7: arg7 = tgetl(sp_reg + 24);
                case 6: arg6 = tgetl(sp_reg + 20);
                case 5: arg5 = tgetl(sp_reg + 16);
                /* FIXME - what to do if get_user() fails? */
                case 8: get_user_ual(arg8, sp_reg + 28);
                case 7: get_user_ual(arg7, sp_reg + 24);
                case 6: get_user_ual(arg6, sp_reg + 20);
                case 5: get_user_ual(arg5, sp_reg + 16);
                default:
                    break;
                }
Loading