X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=arm-semi.c;h=a33b8e5c3a924e9af70dd0e1fa826694bf351f92;hb=1ba74fb8f14389282e1b86579a46a38b5710e193;hp=d5fb9a55a73970358bdb54615f3b83e43eb8b1fa;hpb=579a97f7ff4c0f958a5d8adcba717a205bb58567;p=qemu diff --git a/arm-semi.c b/arm-semi.c index d5fb9a5..a33b8e5 100644 --- a/arm-semi.c +++ b/arm-semi.c @@ -16,7 +16,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + * MA 02110-1301, USA. */ #include @@ -33,7 +34,9 @@ #define ARM_ANGEL_HEAP_SIZE (128 * 1024 * 1024) #else -#include "vl.h" +#include "qemu-common.h" +#include "sysemu.h" +#include "gdbstub.h" #endif #define SYS_OPEN 0x01 @@ -165,8 +168,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 +222,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); @@ -350,6 +363,7 @@ uint32_t do_arm_semihosting(CPUState *env) return (uint32_t)-1; ret = set_swi_errno(ts, system(s)); unlock_user(s, ARG(0), 0); + return ret; } case SYS_ERRNO: #ifdef CONFIG_USER_ONLY