All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [patch] Fix uname syscall
Date: Sun, 12 Sep 2004 12:18:04 +0100	[thread overview]
Message-ID: <200409121218.04285.paul@codesourcery.com> (raw)
In-Reply-To: <20040911185407.GE19740@xi.wantstofly.org>

On Saturday 11 September 2004 19:54, Lennert Buytenhek wrote:
> On Sat, Sep 11, 2004 at 07:33:10PM +0100, Paul Brook wrote:
> > +#define UNAME_MACHINE "armv4"
>
> Wouldn't this be armv4l/armv4b (depending on endianness)?

Yes. Updated patch below.

Paul

Index: syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.50
diff -u -p -r1.50 syscall.c
--- syscall.c 19 Jun 2004 16:59:03 -0000 1.50
+++ syscall.c 12 Sep 2004 11:11:26 -0000
@@ -72,6 +72,21 @@
 /* 16 bit uid wrappers emulation */
 #define USE_UID16
 #endif
+#if defined(TARGET_ARM)
+#if defined(TARGET_WORDS_BIGENDIAN)
+#define UNAME_MACHINE "armv4b"
+#else
+#define UNAME_MACHINE "armv4l"
+#endif
+#elif defined(TARGET_I386)
+#define UNAME_MACHINE "i686"
+#elif defined(TARGET_PPC)
+#define UNAME_MACHINE "ppc"
+#elif defined(TARGET_SPARC)
+#define UNAME_MACHINE "sun4"
+#else
+#error unsupported CPU
+#endif
 
 //#include <linux/msdos_fs.h>
 #define VFAT_IOCTL_READDIR_BOTH  _IOR('r', 1, struct dirent [2])
@@ -2391,8 +2410,17 @@ long do_syscall(void *cpu_env, int num, 
         ret = get_errno(setdomainname((const char *)arg1, arg2));
         break;
     case TARGET_NR_uname:
-        /* no need to transcode because we use the linux syscall */
-        ret = get_errno(sys_uname((struct new_utsname *)arg1));
+ {
+     struct new_utsname * buf;
+
+     buf = (struct new_utsname *)arg1;
+     ret = get_errno(sys_uname(buf));
+     if (!is_error(ret)) {
+  /* Overrite the native machine name with whatever is being
+     emulated. */
+  strcpy (buf->machine, UNAME_MACHINE);
+     }
+ }
         break;
 #ifdef TARGET_I386
     case TARGET_NR_modify_ldt:

  reply	other threads:[~2004-09-12 11:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-11 18:33 [Qemu-devel] [patch] Fix uname syscall Paul Brook
2004-09-11 18:54 ` Lennert Buytenhek
2004-09-12 11:18   ` Paul Brook [this message]
2004-09-13 21:23 ` Fabrice Bellard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200409121218.04285.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.