Skip to contentSkip to conversation

linux-user updates.

PATCH In review [email protected] 2 participants 7 messages Oct 16, 2009 – Oct 17, 2009

lore
Share & tools
lore
#0 lore raw

cover linux-user updates.

From: Riku Voipio <[email protected]>

Long time no update... A set of relatively small patches for comment on the list before sending a pull request.

Max Filippov (1):
linux-user: fix ppc target_stat64 st_blocks layout

Paul Bolle (1):
linux-user: don't zero a buffer twice

Riku Voipio (1):
linux-user: Update ARM hwcaps

Ulrich Hecht (2):
implementations of dup3 and fallocate that are good enough to fool LTP
linux-user: getpriority errno fix

 configure                 |   36 ++++++++++++++++++++++++++++++++++++
 linux-user/elfload.c      |    9 ++++++++-
 linux-user/linuxload.c    |    1 -
 linux-user/syscall.c      |   12 +++++++++++-
 linux-user/syscall_defs.h |    2 +-
 5 files changed, 56 insertions(+), 4 deletions(-)
#1 lore raw

PATCH 1/5 implementations of dup3 and fallocate that are good enough to fool LTP

From: Ulrich Hecht <[email protected]>

updated fallocate check to new configure, added dup3 check as suggested by Jan-Simon Möller.

Riku: updated to apply to current git.

---
 configure            |   36 ++++++++++++++++++++++++++++++++++++
 linux-user/syscall.c |   10 ++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)
configure +36 -0
index ca6d45c..3df9d07 100755
@@ -1569,6 +1569,36 @@ if compile_prog "" "" ; then
   eventfd=yes
 fi
 
+# check for fallocate
+fallocate=no
+cat > $TMPC << EOF
+#include <fcntl.h>
+
+int main(void)
+{
+    fallocate(0, 0, 0, 0);
+    return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+  fallocate=yes
+fi
+
+# check for dup3
+dup3=no
+cat > $TMPC << EOF
+#include <unistd.h>
+
+int main(void)
+{
+    dup3(0, 0, 0);
+    return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+  dup3=yes
+fi
+
 # Check if tools are available to build documentation.
 if test "$docs" != "no" ; then
   if test -x "`which texi2html 2>/dev/null`" -a \
@@ -1950,6 +1980,12 @@ fi
 if test "$eventfd" = "yes" ; then
   echo "CONFIG_EVENTFD=y" >> $config_host_mak
 fi
+if test "$fallocate" = "yes" ; then
+  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
+fi
+if test "$dup3" = "yes" ; then
+  echo "CONFIG_DUP3=y" >> $config_host_mak
+fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
linux-user/syscall.c +10 -0
index bf06d14..d07c381 100644
@@ -4746,6 +4746,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
     case TARGET_NR_dup2:
         ret = get_errno(dup2(arg1, arg2));
         break;
+#if defined(CONFIG_DUP3) && defined(TARGET_NR_dup3)
+    case TARGET_NR_dup3:
+        ret = get_errno(dup3(arg1, arg2, arg3));
+        break;
+#endif
 #ifdef TARGET_NR_getppid /* not on alpha */
     case TARGET_NR_getppid:
         ret = get_errno(getppid());
@@ -7013,6 +7018,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
 #endif
 #endif /* CONFIG_EVENTFD  */
+#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
+    case TARGET_NR_fallocate:
+        ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+        break;
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
Signature · 1 line
1.6.2.1
#2 lore raw

PATCH 2/5 linux-user: getpriority errno fix

In reply to [email protected]

From: Ulrich Hecht <[email protected]>

getpriority returned wrong errno; fixes LTP test getpriority02.

---
 linux-user/syscall.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/syscall.c +1 -1
index d07c381..baf00e0 100644
@@ -5311,7 +5311,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         /* libc does special remapping of the return value of
          * sys_getpriority() so it's just easiest to call
          * sys_getpriority() directly rather than through libc. */
-        ret = sys_getpriority(arg1, arg2);
+        ret = get_errno(sys_getpriority(arg1, arg2));
         break;
     case TARGET_NR_setpriority:
         ret = get_errno(setpriority(arg1, arg2, arg3));
Signature · 1 line
1.6.2.1
#3 lore raw

PATCH 3/5 linux-user: fix ppc target_stat64 st_blocks layout

In reply to [email protected]

From: Max Filippov <[email protected]>

Swap __pad1 and st_blocks fields location to maintain proper alignment. This fixes incorrect 'du' and 'stat' report on ppc guest.

---
 linux-user/syscall_defs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/syscall_defs.h +1 -1
index c018165..dce36b2 100644
@@ -1187,8 +1187,8 @@ struct __attribute__((__packed__)) target_stat64 {
 	unsigned long long __pad0;
 	long long      st_size;
 	int	       st_blksize;
-	long long      st_blocks;	/* Number 512-byte blocks allocated. */
 	unsigned int   __pad1;
+	long long      st_blocks;	/* Number 512-byte blocks allocated. */
 	int	       target_st_atime;
         unsigned int   target_st_atime_nsec;
 	int	       target_st_mtime;
Signature · 1 line
1.6.2.1
#4 lore raw

PATCH 4/5 linux-user: don't zero a buffer twice

In reply to [email protected]

From: Paul Bolle <[email protected]>

prepare_binprm() zeroes bprm->buf. That buffer is already zeroed in main() and hasn't been touched since so that is not necessary.

---
 linux-user/linuxload.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
linux-user/linuxload.c +0 -1
index 4091bdc..2d778a2 100644
@@ -96,7 +96,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
 	}
     }
 
-    memset(bprm->buf, 0, sizeof(bprm->buf));
     retval = lseek(bprm->fd, 0L, SEEK_SET);
     if(retval >= 0) {
         retval = read(bprm->fd, bprm->buf, 128);
Signature · 1 line
1.6.2.1
#5 lore raw

PATCH 5/5 linux-user: Update ARM hwcaps

In reply to [email protected]

From: Riku Voipio <[email protected]>

Update ARM hwcaps to match Linux kernel 2.6.31 state

---
 linux-user/elfload.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
linux-user/elfload.c +8 -1
index 62a3f2a..682a813 100644
@@ -330,11 +330,18 @@ enum
   ARM_HWCAP_ARM_FPA       = 1 << 5,
   ARM_HWCAP_ARM_VFP       = 1 << 6,
   ARM_HWCAP_ARM_EDSP      = 1 << 7,
+  ARM_HWCAP_ARM_JAVA      = 1 << 8,
+  ARM_HWCAP_ARM_IWMMXT    = 1 << 9,
+  ARM_HWCAP_ARM_THUMBEE   = 1 << 10,
+  ARM_HWCAP_ARM_NEON      = 1 << 11,
+  ARM_HWCAP_ARM_VFPv3     = 1 << 12,
+  ARM_HWCAP_ARM_VFPv3D16  = 1 << 13,
 };
 
 #define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF              \
                     | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT     \
-                    | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP)
+                    | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP \
+                    | ARM_HWCAP_ARM_NEON | ARM_HWCAP_ARM_VFPv3 )
 
 #endif
 
Signature · 1 line
1.6.2.1
Acked-by on the v1 series
#6 lore raw
In reply to [email protected]
Quoted 18 lines · On Fri, Oct 16, 2009 at 05:02:26PM +0300, [email protected] wrote:

From: Riku Voipio <[email protected]>

Long time no update... A set of relatively small patches for comment on the list before sending a pull request.

Max Filippov (1):
linux-user: fix ppc target_stat64 st_blocks layout

Paul Bolle (1):
linux-user: don't zero a buffer twice

Riku Voipio (1):
linux-user: Update ARM hwcaps

Ulrich Hecht (2):
implementations of dup3 and fallocate that are good enough to fool LTP
linux-user: getpriority errno fix

Quoted 6 lines
 configure                 |   36 ++++++++++++++++++++++++++++++++++++
 linux-user/elfload.c      |    9 ++++++++-
 linux-user/linuxload.c    |    1 -
 linux-user/syscall.c      |   12 +++++++++++-
 linux-user/syscall_defs.h |    2 +-
 5 files changed, 56 insertions(+), 4 deletions(-)

Looks good!