All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues
@ 2016-09-14 15:21 Aleksandar Markovic
  2016-09-14 15:21 ` [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:21 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

v3->v4:

    - rebased to the latest code
    - added patch on clock_adjtime() support
    - minor commit messages improvements

v2->v3:

    - rebased to the latest code
    - merged patches on adjtimex(), sysfs(), and ustat() from another series
    - added patch on socketcall() support
    - cleanup patches reorganized

v1->v2:

    - improved usage of "#ifdefs" in patch on syslog()
    - removed EIDRM-related code from patch on msgrcv(), since this error
      code is already handled well
    - added three cleanup patches

(also, v1 for some reason did not appear on qemu-devel, but mails are sent)

This series fix certain Qemu user mode issues. The fixes mainly originate
from observation of LTP tests failures for execution in Qemu user mode
on various platforms. The series also contains four cleanup patches.

Aleksandar Markovic (11):
  linux-user: Add support for adjtimex() syscall
  linux-user: Add support for clock_adjtime() syscall
  linux-user: Add support for sysfs() syscall
  linux-user: Add support for ustat() syscall
  linux-user: Fix msgrcv() and msgsnd() syscalls support
  linux-user: Fix socketcall() syscall support
  linux-user: Fix syslog() syscall support
  linux-user: Remove tabs and trailing spaces from linux-user/main.c
  linux-user: Improve braces-related formatting in linux-user/main.c
  linux-user: Improve usage of spaces in linux-user/main.c
  linux-user: Remove a duplicate item from strace.list

 linux-user/main.c         | 1096 +++++++++++++++++++++++----------------------
 linux-user/strace.c       |  118 +++++
 linux-user/strace.list    |   12 +-
 linux-user/syscall.c      |  221 ++++++++-
 linux-user/syscall_defs.h |   53 +++
 5 files changed, 942 insertions(+), 558 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
@ 2016-09-14 15:21 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:21 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch implements Qemu user mode adjtimex() syscall support.

Syscall adjtimex() reads and optionally sets parameters for a clock
adjustment algorithm used in network synchonization or similar scenarios.

The implementation is based on invocation of host's adjtimex(), and
its key part is in the correspondent case segment of the main switch
statement of the function do_syscall(), in file linux-user/syscalls.c.
Also, support for related structure "timex" is added to the file
linux-user/syscall_defs.h, based on its definition in Linux kernel. All
necessary conversions of the data structures from target to host and from
host to target are covered. Two new functions, target_to_host_timex() and
host_to_target_timex(), are provided for the purpose of such conversions.
Moreover, the relevant support for "-strace" Qemu option is included in
files linux-user/strace.c and linux-user/strace.list.

This patch also fixes failures of LTP tests adjtimex01 and adjtimex02, if
executed in Qemu user mode.

Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.c       | 12 +++++++
 linux-user/strace.list    |  2 +-
 linux-user/syscall.c      | 90 ++++++++++++++++++++++++++++++++++++++++++++++-
 linux-user/syscall_defs.h | 28 +++++++++++++++
 4 files changed, 130 insertions(+), 2 deletions(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index cc10dc4..7ddcaf8 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -919,6 +919,18 @@ print_access(const struct syscallname *name,
 }
 #endif
 
+#ifdef TARGET_NR_adjtimex
+static void
+print_adjtimex(const struct syscallname *name,
+    abi_long arg0, abi_long arg1, abi_long arg2,
+    abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    print_pointer(arg0, 1);
+    print_syscall_epilogue(name);
+}
+#endif
+
 #ifdef TARGET_NR_brk
 static void
 print_brk(const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index aa967a2..9a665a8 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -16,7 +16,7 @@
 { TARGET_NR_add_key, "add_key" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_adjtimex
-{ TARGET_NR_adjtimex, "adjtimex" , NULL, NULL, NULL },
+{ TARGET_NR_adjtimex, "adjtimex" , NULL, print_adjtimex, NULL },
 #endif
 #ifdef TARGET_NR_afs_syscall
 { TARGET_NR_afs_syscall, "afs_syscall" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca06943..5643840 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -35,6 +35,7 @@
 #include <sys/swap.h>
 #include <linux/capability.h>
 #include <sched.h>
+#include <sys/timex.h>
 #ifdef __ia64__
 int __clone2(int (*fn)(void *), void *child_stack_base,
              size_t stack_size, int flags, void *arg, ...);
@@ -6578,6 +6579,78 @@ static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1,
 }
 #endif
 
+#ifdef TARGET_NR_adjtimex
+static inline abi_long target_to_host_timex(struct timex *host_buf,
+                                            abi_long target_addr)
+{
+    struct target_timex *target_buf;
+
+    if (!lock_user_struct(VERIFY_READ, target_buf, target_addr, 1)) {
+        return -TARGET_EFAULT;
+    }
+
+    host_buf->modes = tswap32(target_buf->modes);
+    host_buf->offset = tswapal(target_buf->offset);
+    host_buf->freq = tswapal(target_buf->freq);
+    host_buf->maxerror = tswapal(target_buf->maxerror);
+    host_buf->esterror = tswapal(target_buf->esterror);
+    host_buf->status = tswap32(target_buf->status);
+    host_buf->constant = tswapal(target_buf->constant);
+    host_buf->precision = tswapal(target_buf->precision);
+    host_buf->tolerance = tswapal(target_buf->tolerance);
+    host_buf->time.tv_sec = tswapal(target_buf->time.tv_sec);
+    host_buf->time.tv_usec = tswapal(target_buf->time.tv_usec);
+    host_buf->tick = tswapal(target_buf->tick);
+    host_buf->ppsfreq = tswapal(target_buf->ppsfreq);
+    host_buf->jitter = tswapal(target_buf->jitter);
+    host_buf->shift = tswap32(target_buf->shift);
+    host_buf->stabil = tswapal(target_buf->stabil);
+    host_buf->jitcnt = tswapal(target_buf->jitcnt);
+    host_buf->calcnt = tswapal(target_buf->calcnt);
+    host_buf->errcnt = tswapal(target_buf->errcnt);
+    host_buf->stbcnt = tswapal(target_buf->stbcnt);
+    host_buf->tai = tswap32(target_buf->tai);
+
+    unlock_user_struct(target_buf, target_addr, 0);
+    return 0;
+}
+
+static inline abi_long host_to_target_timex(abi_long target_addr,
+                                            struct timex *host_buf)
+{
+    struct target_timex *target_buf;
+
+    if (!lock_user_struct(VERIFY_WRITE, target_buf, target_addr, 0)) {
+        return -TARGET_EFAULT;
+    }
+
+    target_buf->modes = tswap32(host_buf->modes);
+    target_buf->offset = tswapal(host_buf->offset);
+    target_buf->freq = tswapal(host_buf->freq);
+    target_buf->maxerror = tswapal(host_buf->maxerror);
+    target_buf->esterror = tswapal(host_buf->esterror);
+    target_buf->status = tswap32(host_buf->status);
+    target_buf->constant = tswapal(host_buf->constant);
+    target_buf->precision = tswapal(host_buf->precision);
+    target_buf->tolerance = tswapal(host_buf->tolerance);
+    target_buf->time.tv_sec = tswapal(host_buf->time.tv_sec);
+    target_buf->time.tv_usec = tswapal(host_buf->time.tv_usec);
+    target_buf->tick = tswapal(host_buf->tick);
+    target_buf->ppsfreq = tswapal(host_buf->ppsfreq);
+    target_buf->jitter = tswapal(host_buf->jitter);
+    target_buf->shift = tswap32(host_buf->shift);
+    target_buf->stabil = tswapal(host_buf->stabil);
+    target_buf->jitcnt = tswapal(host_buf->jitcnt);
+    target_buf->calcnt = tswapal(host_buf->calcnt);
+    target_buf->errcnt = tswapal(host_buf->errcnt);
+    target_buf->stbcnt = tswapal(host_buf->stbcnt);
+    target_buf->tai = tswap32(host_buf->tai);
+
+    unlock_user_struct(target_buf, target_addr, 1);
+    return 0;
+}
+#endif
+
 static inline abi_long target_to_host_timespec(struct timespec *host_ts,
                                                abi_ulong target_addr)
 {
@@ -9419,8 +9492,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
 #endif
 #endif
+#ifdef TARGET_NR_adjtimex
     case TARGET_NR_adjtimex:
-        goto unimplemented;
+        {
+            struct timex host_buf;
+
+            if (target_to_host_timex(&host_buf, arg1) != 0) {
+                goto efault;
+            }
+            ret = get_errno(adjtimex(&host_buf));
+            if (!is_error(ret) && arg1) {
+                if (host_to_target_timex(arg1, &host_buf) != 0) {
+                    goto efault;
+                }
+            }
+        }
+        break;
+#endif
 #ifdef TARGET_NR_create_module
     case TARGET_NR_create_module:
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 7835654..afd9191 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -207,6 +207,34 @@ struct target_itimerspec {
     struct target_timespec it_value;
 };
 
+struct target_timex {
+    unsigned int modes;          /* Mode selector */
+    abi_long offset;             /* Time offset */
+    abi_long freq;               /* Frequency offset */
+    abi_long maxerror;           /* Maximum error (microseconds) */
+    abi_long esterror;           /* Estimated error (microseconds) */
+    int status;                  /* Clock command/status */
+    abi_long constant;           /* PLL (phase-locked loop) time constant */
+    abi_long precision;          /* Clock precision (microseconds, ro) */
+    abi_long tolerance;          /* Clock freq. tolerance (ppm, ro) */
+    struct target_timeval time;  /* Current time */
+    abi_long tick;               /* Microseconds between clock ticks */
+    abi_long ppsfreq;            /* PPS (pulse per second) frequency */
+    abi_long jitter;             /* PPS jitter (ro); nanoseconds */
+    int shift;                   /* PPS interval duration (seconds) */
+    abi_long stabil;             /* PPS stability */
+    abi_long jitcnt;             /* PPS jitter limit exceeded (ro) */
+    abi_long calcnt;             /* PPS calibration intervals */
+    abi_long errcnt;             /* PPS calibration errors */
+    abi_long stbcnt;             /* PPS stability limit exceeded */
+    int tai;                     /* TAI offset */
+
+    /* Further padding bytes to allow for future expansion */
+    int:32; int:32; int:32; int:32;
+    int:32; int:32; int:32; int:32;
+    int:32; int:32; int:32;
+};
+
 typedef abi_long target_clock_t;
 
 #define TARGET_HZ 100
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
  2016-09-14 15:21 ` [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall Aleksandar Markovic
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch implements Qemu user mode clock_adjtime() syscall support.

The implementation is based on invocation of host's clock_adjtime(), and is
very similar to the implementation of adjtimex() syscall support. The main
difference is the presence of "clockid_t" argument in clock_adjtime().

Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.c    | 13 +++++++++++++
 linux-user/strace.list |  3 +++
 linux-user/syscall.c   | 19 ++++++++++++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 7ddcaf8..4524c70 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -968,6 +968,19 @@ print_chmod(const struct syscallname *name,
 }
 #endif
 
+#ifdef TARGET_NR_clock_adjtime
+static void
+print_clock_adjtime(const struct syscallname *name,
+    abi_long arg0, abi_long arg1, abi_long arg2,
+    abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    print_raw_param("%d", arg0, 0);
+    print_pointer(arg1, 1);
+    print_syscall_epilogue(name);
+}
+#endif
+
 #ifdef TARGET_NR_clone
 static void do_print_clone(unsigned int flags, abi_ulong newsp,
                            abi_ulong parent_tidptr, target_ulong newtls,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 9a665a8..00b2e9b 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -72,6 +72,9 @@
 #ifdef TARGET_NR_chroot
 { TARGET_NR_chroot, "chroot" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_clock_adjtime
+{ TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL },
+#endif
 #ifdef TARGET_NR_clock_getres
 { TARGET_NR_clock_getres, "clock_getres" , NULL, NULL, NULL },
 #endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5643840..eab9207 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6579,7 +6579,7 @@ static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1,
 }
 #endif
 
-#ifdef TARGET_NR_adjtimex
+#if defined(TARGET_NR_adjtimex) || defined(TARGET_NR_clock_adjtime)
 static inline abi_long target_to_host_timex(struct timex *host_buf,
                                             abi_long target_addr)
 {
@@ -9509,6 +9509,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         }
         break;
 #endif
+#ifdef TARGET_NR_clock_adjtime
+    case TARGET_NR_clock_adjtime:
+        {
+            struct timex host_buf;
+
+            if (target_to_host_timex(&host_buf, arg2) != 0) {
+                goto efault;
+            }
+            ret = get_errno(clock_adjtime(arg1, &host_buf));
+            if (!is_error(ret) && arg1) {
+                if (host_to_target_timex(arg2, &host_buf) != 0) {
+                    goto efault;
+                }
+            }
+        }
+        break;
+#endif
 #ifdef TARGET_NR_create_module
     case TARGET_NR_create_module:
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
  2016-09-14 15:21 ` [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall Aleksandar Markovic
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch implements Qemu user mode sysfs() syscall support.

Syscall sysfs() involves returning information about the filesystem types
currently present in the kernel, and can operate in three distinct flavors,
depending on its first argument.

The implementation is based on invocation of host's sysfs(), and
its key part is in the correspondent case segment of the main switch
statement of the function do_syscall(), in file linux-user/syscalls.c.
All necessary conversions of data structures from target to host and from
host to target are covered. Based on the value of the first argument, three
cases are distinguished, and such conversions are implemented separately
for each case. Relevant support for "-strace" option is included in files
linux-user/strace.c and linux-user/strace.list.

This patch also fixes failures of LTP tests sysfs01, sysfs02, sysfs03,
sysfs04, sysfs05, and sysfs06, if executed in Qemu user mode.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.c    | 25 +++++++++++++++++++++++++
 linux-user/strace.list |  2 +-
 linux-user/syscall.c   | 42 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 4524c70..61911e7 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -2151,6 +2151,31 @@ print_kill(const struct syscallname *name,
 }
 #endif
 
+#if defined(TARGET_NR_sysfs)
+static void
+print_sysfs(const struct syscallname *name,
+    abi_long arg0, abi_long arg1, abi_long arg2,
+    abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    switch (arg0) {
+    case 1:
+        print_raw_param("%d", arg0, 1);
+        print_string(arg1, 1);
+        break;
+    case 2:
+        print_raw_param("%d", arg0, 0);
+        print_raw_param("%u", arg1, 0);
+        print_pointer(arg2, 1);
+        break;
+    default:
+        print_raw_param("%d", arg0, 1);
+        break;
+    }
+    print_syscall_epilogue(name);
+}
+#endif
+
 /*
  * An array of all of the syscalls we know about
  */
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 00b2e9b..0bf1bea 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1371,7 +1371,7 @@
 { TARGET_NR_sys_epoll_wait, "sys_epoll_wait" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_sysfs
-{ TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL },
+{ TARGET_NR_sysfs, "sysfs" , NULL, print_sysfs, NULL },
 #endif
 #ifdef TARGET_NR_sysinfo
 { TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index eab9207..3436ee6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9549,7 +9549,47 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #ifdef TARGET_NR_sysfs
     case TARGET_NR_sysfs:
-        goto unimplemented;
+        switch (arg1) {
+        case 1:
+            {
+                if (arg2 != 0) {
+                    p = lock_user_string(arg2);
+                    if (!p) {
+                        goto efault;
+                    }
+                    ret = get_errno(syscall(__NR_sysfs, arg1, p));
+                    unlock_user(p, arg2, 0);
+                } else {
+                    ret = get_errno(syscall(__NR_sysfs, arg1, NULL));
+                }
+            }
+            break;
+        case 2:
+            {
+                if (arg3 != 0) {
+                    char buf[PATH_MAX];
+                    int len;
+                    memset(buf, 0, PATH_MAX);
+                    ret = get_errno(syscall(__NR_sysfs, arg1, arg2, buf));
+                    len = PATH_MAX;
+                    if (len > strlen(buf)) {
+                        len = strlen(buf);
+                    }
+                    if (copy_to_user(arg3, buf, len) != 0) {
+                        goto efault;
+                    }
+                } else {
+                    ret = get_errno(syscall(__NR_sysfs, arg1, arg2, NULL));
+                }
+            }
+            break;
+        case 3:
+            ret = get_errno(syscall(__NR_sysfs, arg1));
+            break;
+        default:
+            ret = -EINVAL;
+        }
+        break;
 #endif
     case TARGET_NR_personality:
         ret = get_errno(personality(arg1));
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch implements Qemu user mode ustat() syscall support.

Syscall ustat() returns information about a mounted filesystem.

The implementation is similar to the implementations of statfs(),
fstatfs() and other related syscalls. It is based on invocation of
host's ustat(), and its key part is in the correspondent case segment
of the main switch statement of the function do_syscall(), in file
linux-user/syscalls.c. All necessary conversions of data structures
from target to host and from host to target are covered. Sufficient
support for "-strace" option for this syscall is already present,
and this patch does not change it.

This patch also fixes failures of LTP tests ustat01, and ustat02, if
executed on Qemu-emulated systems.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3436ee6..7f8ae41 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -48,6 +48,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <sys/shm.h>
 #include <sys/sem.h>
 #include <sys/statfs.h>
+#include <ustat.h>
 #include <utime.h>
 #include <sys/sysinfo.h>
 #include <sys/signalfd.h>
@@ -8098,7 +8099,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
 #ifdef TARGET_NR_ustat
     case TARGET_NR_ustat:
-        goto unimplemented;
+    {
+        struct ustat ust;
+        int cnt;
+        ret = get_errno(ustat(arg1, &ust));
+
+        if (!is_error(ret)) {
+            struct ustat *target_ust;
+
+            if (!lock_user_struct(VERIFY_WRITE, target_ust, arg2, 0)) {
+                goto efault;
+            }
+
+            __put_user(ust.f_tfree, &target_ust->f_tfree);
+            __put_user(ust.f_tinode, &target_ust->f_tinode);
+
+            for (cnt = 0; cnt < 6; cnt++) {
+                __put_user(ust.f_fname[cnt], &target_ust->f_fname[cnt]);
+                __put_user(ust.f_fpack[cnt], &target_ust->f_fpack[cnt]);
+            }
+            unlock_user_struct(target_ust, arg2, 1);
+        }
+        break;
+      }
 #endif
 #ifdef TARGET_NR_dup2
     case TARGET_NR_dup2:
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (3 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support Aleksandar Markovic
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

If syscalls msgrcv() and msgsnd() fail, they return E2BIG, EACCES,
EAGAIN, EFAULT, EIDRM, EINTR, EINVAL, ENOMEM, or ENOMSG.

By examining negative scenarios of these syscalls for Mips, it was
established that ENOMSG does not have the same value accross all
platforms, but it is nevertheless not included for conversion in
the correspondant conversion table defined in linux-user/syscall.c.
This is certainly a bug, since it leads to the incorrect emulation
of msgrcv() and msgsnd() for scenarios involving ENOMSG.

This patch fixes this by extending the conversion table to include
ENOMSG.

Also, LTP test msgrcv04 will be fixed for some platforms.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7f8ae41..bdc12ae 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -750,6 +750,9 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
 #ifdef ENOTRECOVERABLE
     [ENOTRECOVERABLE]	= TARGET_ENOTRECOVERABLE,
 #endif
+#ifdef ENOMSG
+    [ENOMSG]            = TARGET_ENOMSG,
+#endif
 };
 
 static inline int host_to_target_errno(int err)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (4 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() " Aleksandar Markovic
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

do_socketcall() function in Qemu's syscalls.c is implemented to mirror
corespondant implementation of socketcall() in Linux kernel. (see kernel
source file net/socket.c, definition of socketcall).

However, error codes are wrong for the cases of invalid values of the first
argument. This patch in this sense brings do_socketcall() closer to its
kernel counterpart.

Also, this patch fixes failure of LTP test socketcall02, if executed on some
Qemu emulated sywstems (uer mode).

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index bdc12ae..4ffcce5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3845,15 +3845,18 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         [SOCKOP_getsockopt] = 5,  /* sockfd, level, optname, optval, optlen */
     };
     abi_long a[6]; /* max 6 args */
+    unsigned i;
 
-    /* first, collect the arguments in a[] according to ac[] */
-    if (num >= 0 && num < ARRAY_SIZE(ac)) {
-        unsigned i;
-        assert(ARRAY_SIZE(a) >= ac[num]); /* ensure we have space for args */
-        for (i = 0; i < ac[num]; ++i) {
-            if (get_user_ual(a[i], vptr + i * sizeof(abi_long)) != 0) {
-                return -TARGET_EFAULT;
-            }
+    /* check the range of the first argument num */
+    if (num < 0 || num > ARRAY_SIZE(ac)) {
+        return -TARGET_EINVAL;
+    }
+
+    /* collect the arguments in a[] according to ac[] */
+    assert(ARRAY_SIZE(a) >= ac[num]); /* ensure we have space for args */
+    for (i = 0; i < ac[num]; ++i) {
+        if (get_user_ual(a[i], vptr + i * sizeof(abi_long)) != 0) {
+            return -TARGET_EFAULT;
         }
     }
 
@@ -3901,7 +3904,7 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
         return do_getsockopt(a[0], a[1], a[2], a[3], a[4]);
     default:
         gemu_log("Unsupported socketcall: %d\n", num);
-        return -TARGET_ENOSYS;
+        return -TARGET_EINVAL;
     }
 }
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() syscall support
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (5 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c Aleksandar Markovic
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

There are currently several problems related to syslog() support.

For example, if the second argument "bufp" of target syslog() syscall
is NULL, the current implementation always returns error code EFAULT.
However, NULL is a perfectly valid value for the second argument for
many use cases of this syscall. This is, for example, visible from
this excerpt of man page for syslog(2):

> EINVAL Bad arguments (e.g., bad type; or for type 2, 3, or 4, buf is
>        NULL, or len is less than zero; or for type 8, the level is
>        outside the range 1 to 8).

Moreover, the argument "bufp" is ignored for all cases of values of the
first argument, except 2, 3 and 4. This means that for such cases
(the first argument is not 2, 3 or 4), there is no need to pass "buf"
between host and target, and it can be set to NULL while calling host's
syslog(), without loss of emulation accuracy.

Note also that if "bufp" is NULL and the first argument is 2, 3 or 4, the
correct returned error code is EINVAL, not EFAULT.

All these details are reflected in this patch.

"#ifdef TARGET_NR_syslog" is also proprerly inserted when needed.

Support for Qemu's "-strace" switch for syslog() syscall is included too.

LTP tests syslog11 and syslog12 pass with this patch (while fail without
it), on any platform.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.c       | 68 +++++++++++++++++++++++++++++++++++++++++++++++
 linux-user/strace.list    |  2 +-
 linux-user/syscall.c      | 23 +++++++++++-----
 linux-user/syscall_defs.h | 25 +++++++++++++++++
 4 files changed, 111 insertions(+), 7 deletions(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 61911e7..6177f2c 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1709,6 +1709,74 @@ print_rt_sigprocmask(const struct syscallname *name,
 }
 #endif
 
+#ifdef TARGET_NR_syslog
+static void
+print_syslog_action(abi_ulong arg, int last)
+{
+    switch (arg) {
+        case TARGET_SYSLOG_ACTION_CLOSE: {
+            gemu_log("%s%s", "SYSLOG_ACTION_CLOSE", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_OPEN: {
+            gemu_log("%s%s", "SYSLOG_ACTION_OPEN", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_READ: {
+            gemu_log("%s%s", "SYSLOG_ACTION_READ", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_READ_ALL: {
+            gemu_log("%s%s", "SYSLOG_ACTION_READ_ALL", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_READ_CLEAR: {
+            gemu_log("%s%s", "SYSLOG_ACTION_READ_CLEAR", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_CLEAR: {
+            gemu_log("%s%s", "SYSLOG_ACTION_CLEAR", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_CONSOLE_OFF: {
+            gemu_log("%s%s", "SYSLOG_ACTION_CONSOLE_OFF", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_CONSOLE_ON: {
+            gemu_log("%s%s", "SYSLOG_ACTION_CONSOLE_ON", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL: {
+            gemu_log("%s%s", "SYSLOG_ACTION_CONSOLE_LEVEL", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_SIZE_UNREAD: {
+            gemu_log("%s%s", "SYSLOG_ACTION_SIZE_UNREAD", get_comma(last));
+            break;
+        }
+        case TARGET_SYSLOG_ACTION_SIZE_BUFFER: {
+            gemu_log("%s%s", "SYSLOG_ACTION_SIZE_BUFFER", get_comma(last));
+            break;
+        }
+        default: {
+            print_raw_param("%ld", arg, last);
+        }
+    }
+}
+
+static void
+print_syslog(const struct syscallname *name,
+    abi_long arg0, abi_long arg1, abi_long arg2,
+    abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    print_syslog_action(arg0, 0);
+    print_pointer(arg1, 0);
+    print_raw_param("%d", arg2, 1);
+    print_syscall_epilogue(name);
+}
+#endif
+
 #ifdef TARGET_NR_mknod
 static void
 print_mknod(const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 0bf1bea..2f99ac2 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1380,7 +1380,7 @@
 { TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_syslog
-{ TARGET_NR_syslog, "syslog" , NULL, NULL, NULL },
+{ TARGET_NR_syslog, "syslog" , NULL, print_syslog, NULL },
 #endif
 #ifdef TARGET_NR_sysmips
 { TARGET_NR_sysmips, "sysmips" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4ffcce5..37ce908 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9219,14 +9219,25 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         ret = do_setsockopt(arg1, arg2, arg3, arg4, (socklen_t) arg5);
         break;
 #endif
-
+#ifdef TARGET_NR_syslog
     case TARGET_NR_syslog:
-        if (!(p = lock_user_string(arg2)))
-            goto efault;
-        ret = get_errno(sys_syslog((int)arg1, p, (int)arg3));
-        unlock_user(p, arg2, 0);
+        {
+            if (((int)arg1 == TARGET_SYSLOG_ACTION_READ) ||
+                ((int)arg1 == TARGET_SYSLOG_ACTION_READ_ALL) ||
+                ((int)arg1 == TARGET_SYSLOG_ACTION_READ_CLEAR)) {
+                p = lock_user_string(arg2);
+                if (!p) {
+                    ret = -TARGET_EINVAL;
+                    goto fail;
+                }
+                ret = get_errno(sys_syslog((int)arg1, p, (int)arg3));
+                unlock_user(p, arg2, 0);
+            } else {
+                ret = get_errno(sys_syslog((int)arg1, NULL, (int)arg3));
+            }
+        }
         break;
-
+#endif
     case TARGET_NR_setitimer:
         {
             struct itimerval value, ovalue, *pvalue;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index afd9191..50b1b60 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2661,4 +2661,29 @@ struct target_user_cap_data {
     uint32_t inheritable;
 };
 
+/* from kernel's include/linux/syslog.h */
+
+/* Close the log.  Currently a NOP. */
+#define TARGET_SYSLOG_ACTION_CLOSE          0
+/* Open the log. Currently a NOP. */
+#define TARGET_SYSLOG_ACTION_OPEN           1
+/* Read from the log. */
+#define TARGET_SYSLOG_ACTION_READ           2
+/* Read all messages remaining in the ring buffer. */
+#define TARGET_SYSLOG_ACTION_READ_ALL       3
+/* Read and clear all messages remaining in the ring buffer */
+#define TARGET_SYSLOG_ACTION_READ_CLEAR     4
+/* Clear ring buffer. */
+#define TARGET_SYSLOG_ACTION_CLEAR          5
+/* Disable printk's to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_OFF    6
+/* Enable printk's to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_ON     7
+/* Set level of messages printed to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL  8
+/* Return number of unread characters in the log buffer */
+#define TARGET_SYSLOG_ACTION_SIZE_UNREAD    9
+/* Return size of the log buffer */
+#define TARGET_SYSLOG_ACTION_SIZE_BUFFER   10
+
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (6 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() " Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c Aleksandar Markovic
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

File main.c is frequently a starting point of debugging or
analysing Qemu code for novice devevelopers, and it would be
nice if it had format as clean as posible. This patch starts
improving its format by removing tabs and trailing spaces.

This patch is obtained in this way:

  1. All tabs replaced with spaces, using a tool.
  2. All trailing spaces removed, using a tool.
  3. If step 1 resulted in visually untidy code segments, that was
     manually corrected by inserting or removing spaces only.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/main.c | 812 +++++++++++++++++++++++++++---------------------------
 1 file changed, 406 insertions(+), 406 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 3ad70f8..12042a3 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2043,349 +2043,349 @@ void cpu_loop(CPUPPCState *env)
 # ifdef TARGET_ABI_MIPSO32
 #  define MIPS_SYS(name, args) args,
 static const uint8_t mips_syscall_args[] = {
-	MIPS_SYS(sys_syscall	, 8)	/* 4000 */
-	MIPS_SYS(sys_exit	, 1)
-	MIPS_SYS(sys_fork	, 0)
-	MIPS_SYS(sys_read	, 3)
-	MIPS_SYS(sys_write	, 3)
-	MIPS_SYS(sys_open	, 3)	/* 4005 */
-	MIPS_SYS(sys_close	, 1)
-	MIPS_SYS(sys_waitpid	, 3)
-	MIPS_SYS(sys_creat	, 2)
-	MIPS_SYS(sys_link	, 2)
-	MIPS_SYS(sys_unlink	, 1)	/* 4010 */
-	MIPS_SYS(sys_execve	, 0)
-	MIPS_SYS(sys_chdir	, 1)
-	MIPS_SYS(sys_time	, 1)
-	MIPS_SYS(sys_mknod	, 3)
-	MIPS_SYS(sys_chmod	, 2)	/* 4015 */
-	MIPS_SYS(sys_lchown	, 3)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_stat */
-	MIPS_SYS(sys_lseek	, 3)
-	MIPS_SYS(sys_getpid	, 0)	/* 4020 */
-	MIPS_SYS(sys_mount	, 5)
-	MIPS_SYS(sys_umount	, 1)
-	MIPS_SYS(sys_setuid	, 1)
-	MIPS_SYS(sys_getuid	, 0)
-	MIPS_SYS(sys_stime	, 1)	/* 4025 */
-	MIPS_SYS(sys_ptrace	, 4)
-	MIPS_SYS(sys_alarm	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_fstat */
-	MIPS_SYS(sys_pause	, 0)
-	MIPS_SYS(sys_utime	, 2)	/* 4030 */
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_access	, 2)
-	MIPS_SYS(sys_nice	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* 4035 */
-	MIPS_SYS(sys_sync	, 0)
-	MIPS_SYS(sys_kill	, 2)
-	MIPS_SYS(sys_rename	, 2)
-	MIPS_SYS(sys_mkdir	, 2)
-	MIPS_SYS(sys_rmdir	, 1)	/* 4040 */
-	MIPS_SYS(sys_dup		, 1)
-	MIPS_SYS(sys_pipe	, 0)
-	MIPS_SYS(sys_times	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_brk		, 1)	/* 4045 */
-	MIPS_SYS(sys_setgid	, 1)
-	MIPS_SYS(sys_getgid	, 0)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was signal(2) */
-	MIPS_SYS(sys_geteuid	, 0)
-	MIPS_SYS(sys_getegid	, 0)	/* 4050 */
-	MIPS_SYS(sys_acct	, 0)
-	MIPS_SYS(sys_umount2	, 2)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_ioctl	, 3)
-	MIPS_SYS(sys_fcntl	, 3)	/* 4055 */
-	MIPS_SYS(sys_ni_syscall	, 2)
-	MIPS_SYS(sys_setpgid	, 2)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_olduname	, 1)
-	MIPS_SYS(sys_umask	, 1)	/* 4060 */
-	MIPS_SYS(sys_chroot	, 1)
-	MIPS_SYS(sys_ustat	, 2)
-	MIPS_SYS(sys_dup2	, 2)
-	MIPS_SYS(sys_getppid	, 0)
-	MIPS_SYS(sys_getpgrp	, 0)	/* 4065 */
-	MIPS_SYS(sys_setsid	, 0)
-	MIPS_SYS(sys_sigaction	, 3)
-	MIPS_SYS(sys_sgetmask	, 0)
-	MIPS_SYS(sys_ssetmask	, 1)
-	MIPS_SYS(sys_setreuid	, 2)	/* 4070 */
-	MIPS_SYS(sys_setregid	, 2)
-	MIPS_SYS(sys_sigsuspend	, 0)
-	MIPS_SYS(sys_sigpending	, 1)
-	MIPS_SYS(sys_sethostname	, 2)
-	MIPS_SYS(sys_setrlimit	, 2)	/* 4075 */
-	MIPS_SYS(sys_getrlimit	, 2)
-	MIPS_SYS(sys_getrusage	, 2)
-	MIPS_SYS(sys_gettimeofday, 2)
-	MIPS_SYS(sys_settimeofday, 2)
-	MIPS_SYS(sys_getgroups	, 2)	/* 4080 */
-	MIPS_SYS(sys_setgroups	, 2)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* old_select */
-	MIPS_SYS(sys_symlink	, 2)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_lstat */
-	MIPS_SYS(sys_readlink	, 3)	/* 4085 */
-	MIPS_SYS(sys_uselib	, 1)
-	MIPS_SYS(sys_swapon	, 2)
-	MIPS_SYS(sys_reboot	, 3)
-	MIPS_SYS(old_readdir	, 3)
-	MIPS_SYS(old_mmap	, 6)	/* 4090 */
-	MIPS_SYS(sys_munmap	, 2)
-	MIPS_SYS(sys_truncate	, 2)
-	MIPS_SYS(sys_ftruncate	, 2)
-	MIPS_SYS(sys_fchmod	, 2)
-	MIPS_SYS(sys_fchown	, 3)	/* 4095 */
-	MIPS_SYS(sys_getpriority	, 2)
-	MIPS_SYS(sys_setpriority	, 3)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_statfs	, 2)
-	MIPS_SYS(sys_fstatfs	, 2)	/* 4100 */
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was ioperm(2) */
-	MIPS_SYS(sys_socketcall	, 2)
-	MIPS_SYS(sys_syslog	, 3)
-	MIPS_SYS(sys_setitimer	, 3)
-	MIPS_SYS(sys_getitimer	, 2)	/* 4105 */
-	MIPS_SYS(sys_newstat	, 2)
-	MIPS_SYS(sys_newlstat	, 2)
-	MIPS_SYS(sys_newfstat	, 2)
-	MIPS_SYS(sys_uname	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* 4110 was iopl(2) */
-	MIPS_SYS(sys_vhangup	, 0)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_idle() */
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_vm86 */
-	MIPS_SYS(sys_wait4	, 4)
-	MIPS_SYS(sys_swapoff	, 1)	/* 4115 */
-	MIPS_SYS(sys_sysinfo	, 1)
-	MIPS_SYS(sys_ipc		, 6)
-	MIPS_SYS(sys_fsync	, 1)
-	MIPS_SYS(sys_sigreturn	, 0)
-	MIPS_SYS(sys_clone	, 6)	/* 4120 */
-	MIPS_SYS(sys_setdomainname, 2)
-	MIPS_SYS(sys_newuname	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* sys_modify_ldt */
-	MIPS_SYS(sys_adjtimex	, 1)
-	MIPS_SYS(sys_mprotect	, 3)	/* 4125 */
-	MIPS_SYS(sys_sigprocmask	, 3)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was create_module */
-	MIPS_SYS(sys_init_module	, 5)
-	MIPS_SYS(sys_delete_module, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* 4130	was get_kernel_syms */
-	MIPS_SYS(sys_quotactl	, 0)
-	MIPS_SYS(sys_getpgid	, 1)
-	MIPS_SYS(sys_fchdir	, 1)
-	MIPS_SYS(sys_bdflush	, 2)
-	MIPS_SYS(sys_sysfs	, 3)	/* 4135 */
-	MIPS_SYS(sys_personality	, 1)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* for afs_syscall */
-	MIPS_SYS(sys_setfsuid	, 1)
-	MIPS_SYS(sys_setfsgid	, 1)
-	MIPS_SYS(sys_llseek	, 5)	/* 4140 */
-	MIPS_SYS(sys_getdents	, 3)
-	MIPS_SYS(sys_select	, 5)
-	MIPS_SYS(sys_flock	, 2)
-	MIPS_SYS(sys_msync	, 3)
-	MIPS_SYS(sys_readv	, 3)	/* 4145 */
-	MIPS_SYS(sys_writev	, 3)
-	MIPS_SYS(sys_cacheflush	, 3)
-	MIPS_SYS(sys_cachectl	, 3)
-	MIPS_SYS(sys_sysmips	, 4)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* 4150 */
-	MIPS_SYS(sys_getsid	, 1)
-	MIPS_SYS(sys_fdatasync	, 0)
-	MIPS_SYS(sys_sysctl	, 1)
-	MIPS_SYS(sys_mlock	, 2)
-	MIPS_SYS(sys_munlock	, 2)	/* 4155 */
-	MIPS_SYS(sys_mlockall	, 1)
-	MIPS_SYS(sys_munlockall	, 0)
-	MIPS_SYS(sys_sched_setparam, 2)
-	MIPS_SYS(sys_sched_getparam, 2)
-	MIPS_SYS(sys_sched_setscheduler, 3)	/* 4160 */
-	MIPS_SYS(sys_sched_getscheduler, 1)
-	MIPS_SYS(sys_sched_yield	, 0)
-	MIPS_SYS(sys_sched_get_priority_max, 1)
-	MIPS_SYS(sys_sched_get_priority_min, 1)
-	MIPS_SYS(sys_sched_rr_get_interval, 2)	/* 4165 */
-	MIPS_SYS(sys_nanosleep,	2)
-	MIPS_SYS(sys_mremap	, 5)
-	MIPS_SYS(sys_accept	, 3)
-	MIPS_SYS(sys_bind	, 3)
-	MIPS_SYS(sys_connect	, 3)	/* 4170 */
-	MIPS_SYS(sys_getpeername	, 3)
-	MIPS_SYS(sys_getsockname	, 3)
-	MIPS_SYS(sys_getsockopt	, 5)
-	MIPS_SYS(sys_listen	, 2)
-	MIPS_SYS(sys_recv	, 4)	/* 4175 */
-	MIPS_SYS(sys_recvfrom	, 6)
-	MIPS_SYS(sys_recvmsg	, 3)
-	MIPS_SYS(sys_send	, 4)
-	MIPS_SYS(sys_sendmsg	, 3)
-	MIPS_SYS(sys_sendto	, 6)	/* 4180 */
-	MIPS_SYS(sys_setsockopt	, 5)
-	MIPS_SYS(sys_shutdown	, 2)
-	MIPS_SYS(sys_socket	, 3)
-	MIPS_SYS(sys_socketpair	, 4)
-	MIPS_SYS(sys_setresuid	, 3)	/* 4185 */
-	MIPS_SYS(sys_getresuid	, 3)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* was sys_query_module */
-	MIPS_SYS(sys_poll	, 3)
-	MIPS_SYS(sys_nfsservctl	, 3)
-	MIPS_SYS(sys_setresgid	, 3)	/* 4190 */
-	MIPS_SYS(sys_getresgid	, 3)
-	MIPS_SYS(sys_prctl	, 5)
-	MIPS_SYS(sys_rt_sigreturn, 0)
-	MIPS_SYS(sys_rt_sigaction, 4)
-	MIPS_SYS(sys_rt_sigprocmask, 4)	/* 4195 */
-	MIPS_SYS(sys_rt_sigpending, 2)
-	MIPS_SYS(sys_rt_sigtimedwait, 4)
-	MIPS_SYS(sys_rt_sigqueueinfo, 3)
-	MIPS_SYS(sys_rt_sigsuspend, 0)
-	MIPS_SYS(sys_pread64	, 6)	/* 4200 */
-	MIPS_SYS(sys_pwrite64	, 6)
-	MIPS_SYS(sys_chown	, 3)
-	MIPS_SYS(sys_getcwd	, 2)
-	MIPS_SYS(sys_capget	, 2)
-	MIPS_SYS(sys_capset	, 2)	/* 4205 */
-	MIPS_SYS(sys_sigaltstack	, 2)
-	MIPS_SYS(sys_sendfile	, 4)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_mmap2	, 6)	/* 4210 */
-	MIPS_SYS(sys_truncate64	, 4)
-	MIPS_SYS(sys_ftruncate64	, 4)
-	MIPS_SYS(sys_stat64	, 2)
-	MIPS_SYS(sys_lstat64	, 2)
-	MIPS_SYS(sys_fstat64	, 2)	/* 4215 */
-	MIPS_SYS(sys_pivot_root	, 2)
-	MIPS_SYS(sys_mincore	, 3)
-	MIPS_SYS(sys_madvise	, 3)
-	MIPS_SYS(sys_getdents64	, 3)
-	MIPS_SYS(sys_fcntl64	, 3)	/* 4220 */
-	MIPS_SYS(sys_ni_syscall	, 0)
-	MIPS_SYS(sys_gettid	, 0)
-	MIPS_SYS(sys_readahead	, 5)
-	MIPS_SYS(sys_setxattr	, 5)
-	MIPS_SYS(sys_lsetxattr	, 5)	/* 4225 */
-	MIPS_SYS(sys_fsetxattr	, 5)
-	MIPS_SYS(sys_getxattr	, 4)
-	MIPS_SYS(sys_lgetxattr	, 4)
-	MIPS_SYS(sys_fgetxattr	, 4)
-	MIPS_SYS(sys_listxattr	, 3)	/* 4230 */
-	MIPS_SYS(sys_llistxattr	, 3)
-	MIPS_SYS(sys_flistxattr	, 3)
-	MIPS_SYS(sys_removexattr	, 2)
-	MIPS_SYS(sys_lremovexattr, 2)
-	MIPS_SYS(sys_fremovexattr, 2)	/* 4235 */
-	MIPS_SYS(sys_tkill	, 2)
-	MIPS_SYS(sys_sendfile64	, 5)
-	MIPS_SYS(sys_futex	, 6)
-	MIPS_SYS(sys_sched_setaffinity, 3)
-	MIPS_SYS(sys_sched_getaffinity, 3)	/* 4240 */
-	MIPS_SYS(sys_io_setup	, 2)
-	MIPS_SYS(sys_io_destroy	, 1)
-	MIPS_SYS(sys_io_getevents, 5)
-	MIPS_SYS(sys_io_submit	, 3)
-	MIPS_SYS(sys_io_cancel	, 3)	/* 4245 */
-	MIPS_SYS(sys_exit_group	, 1)
-	MIPS_SYS(sys_lookup_dcookie, 3)
-	MIPS_SYS(sys_epoll_create, 1)
-	MIPS_SYS(sys_epoll_ctl	, 4)
-	MIPS_SYS(sys_epoll_wait	, 3)	/* 4250 */
-	MIPS_SYS(sys_remap_file_pages, 5)
-	MIPS_SYS(sys_set_tid_address, 1)
-	MIPS_SYS(sys_restart_syscall, 0)
-	MIPS_SYS(sys_fadvise64_64, 7)
-	MIPS_SYS(sys_statfs64	, 3)	/* 4255 */
-	MIPS_SYS(sys_fstatfs64	, 2)
-	MIPS_SYS(sys_timer_create, 3)
-	MIPS_SYS(sys_timer_settime, 4)
-	MIPS_SYS(sys_timer_gettime, 2)
-	MIPS_SYS(sys_timer_getoverrun, 1)	/* 4260 */
-	MIPS_SYS(sys_timer_delete, 1)
-	MIPS_SYS(sys_clock_settime, 2)
-	MIPS_SYS(sys_clock_gettime, 2)
-	MIPS_SYS(sys_clock_getres, 2)
-	MIPS_SYS(sys_clock_nanosleep, 4)	/* 4265 */
-	MIPS_SYS(sys_tgkill	, 3)
-	MIPS_SYS(sys_utimes	, 2)
-	MIPS_SYS(sys_mbind	, 4)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* sys_get_mempolicy */
-	MIPS_SYS(sys_ni_syscall	, 0)	/* 4270 sys_set_mempolicy */
-	MIPS_SYS(sys_mq_open	, 4)
-	MIPS_SYS(sys_mq_unlink	, 1)
-	MIPS_SYS(sys_mq_timedsend, 5)
-	MIPS_SYS(sys_mq_timedreceive, 5)
-	MIPS_SYS(sys_mq_notify	, 2)	/* 4275 */
-	MIPS_SYS(sys_mq_getsetattr, 3)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* sys_vserver */
-	MIPS_SYS(sys_waitid	, 4)
-	MIPS_SYS(sys_ni_syscall	, 0)	/* available, was setaltroot */
-	MIPS_SYS(sys_add_key	, 5)
-	MIPS_SYS(sys_request_key, 4)
-	MIPS_SYS(sys_keyctl	, 5)
-	MIPS_SYS(sys_set_thread_area, 1)
-	MIPS_SYS(sys_inotify_init, 0)
-	MIPS_SYS(sys_inotify_add_watch, 3) /* 4285 */
-	MIPS_SYS(sys_inotify_rm_watch, 2)
-	MIPS_SYS(sys_migrate_pages, 4)
-	MIPS_SYS(sys_openat, 4)
-	MIPS_SYS(sys_mkdirat, 3)
-	MIPS_SYS(sys_mknodat, 4)	/* 4290 */
-	MIPS_SYS(sys_fchownat, 5)
-	MIPS_SYS(sys_futimesat, 3)
-	MIPS_SYS(sys_fstatat64, 4)
-	MIPS_SYS(sys_unlinkat, 3)
-	MIPS_SYS(sys_renameat, 4)	/* 4295 */
-	MIPS_SYS(sys_linkat, 5)
-	MIPS_SYS(sys_symlinkat, 3)
-	MIPS_SYS(sys_readlinkat, 4)
-	MIPS_SYS(sys_fchmodat, 3)
-	MIPS_SYS(sys_faccessat, 3)	/* 4300 */
-	MIPS_SYS(sys_pselect6, 6)
-	MIPS_SYS(sys_ppoll, 5)
-	MIPS_SYS(sys_unshare, 1)
-	MIPS_SYS(sys_splice, 6)
-	MIPS_SYS(sys_sync_file_range, 7) /* 4305 */
-	MIPS_SYS(sys_tee, 4)
-	MIPS_SYS(sys_vmsplice, 4)
-	MIPS_SYS(sys_move_pages, 6)
-	MIPS_SYS(sys_set_robust_list, 2)
-	MIPS_SYS(sys_get_robust_list, 3) /* 4310 */
-	MIPS_SYS(sys_kexec_load, 4)
-	MIPS_SYS(sys_getcpu, 3)
-	MIPS_SYS(sys_epoll_pwait, 6)
-	MIPS_SYS(sys_ioprio_set, 3)
-	MIPS_SYS(sys_ioprio_get, 2)
-        MIPS_SYS(sys_utimensat, 4)
-        MIPS_SYS(sys_signalfd, 3)
-        MIPS_SYS(sys_ni_syscall, 0)     /* was timerfd */
-        MIPS_SYS(sys_eventfd, 1)
-        MIPS_SYS(sys_fallocate, 6)      /* 4320 */
-        MIPS_SYS(sys_timerfd_create, 2)
-        MIPS_SYS(sys_timerfd_gettime, 2)
-        MIPS_SYS(sys_timerfd_settime, 4)
-        MIPS_SYS(sys_signalfd4, 4)
-        MIPS_SYS(sys_eventfd2, 2)       /* 4325 */
-        MIPS_SYS(sys_epoll_create1, 1)
-        MIPS_SYS(sys_dup3, 3)
-        MIPS_SYS(sys_pipe2, 2)
-        MIPS_SYS(sys_inotify_init1, 1)
-        MIPS_SYS(sys_preadv, 6)         /* 4330 */
-        MIPS_SYS(sys_pwritev, 6)
-        MIPS_SYS(sys_rt_tgsigqueueinfo, 4)
-        MIPS_SYS(sys_perf_event_open, 5)
-        MIPS_SYS(sys_accept4, 4)
-        MIPS_SYS(sys_recvmmsg, 5)       /* 4335 */
-        MIPS_SYS(sys_fanotify_init, 2)
-        MIPS_SYS(sys_fanotify_mark, 6)
-        MIPS_SYS(sys_prlimit64, 4)
-        MIPS_SYS(sys_name_to_handle_at, 5)
-        MIPS_SYS(sys_open_by_handle_at, 3) /* 4340 */
-        MIPS_SYS(sys_clock_adjtime, 2)
-        MIPS_SYS(sys_syncfs, 1)
+        MIPS_SYS(sys_syscall            , 8)    /* 4000 */
+        MIPS_SYS(sys_exit               , 1)
+        MIPS_SYS(sys_fork               , 0)
+        MIPS_SYS(sys_read               , 3)
+        MIPS_SYS(sys_write              , 3)
+        MIPS_SYS(sys_open               , 3)    /* 4005 */
+        MIPS_SYS(sys_close              , 1)
+        MIPS_SYS(sys_waitpid            , 3)
+        MIPS_SYS(sys_creat              , 2)
+        MIPS_SYS(sys_link               , 2)
+        MIPS_SYS(sys_unlink             , 1)    /* 4010 */
+        MIPS_SYS(sys_execve             , 0)
+        MIPS_SYS(sys_chdir              , 1)
+        MIPS_SYS(sys_time               , 1)
+        MIPS_SYS(sys_mknod              , 3)
+        MIPS_SYS(sys_chmod              , 2)    /* 4015 */
+        MIPS_SYS(sys_lchown             , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_stat */
+        MIPS_SYS(sys_lseek              , 3)
+        MIPS_SYS(sys_getpid             , 0)    /* 4020 */
+        MIPS_SYS(sys_mount              , 5)
+        MIPS_SYS(sys_umount             , 1)
+        MIPS_SYS(sys_setuid             , 1)
+        MIPS_SYS(sys_getuid             , 0)
+        MIPS_SYS(sys_stime              , 1)    /* 4025 */
+        MIPS_SYS(sys_ptrace             , 4)
+        MIPS_SYS(sys_alarm              , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_fstat */
+        MIPS_SYS(sys_pause              , 0)
+        MIPS_SYS(sys_utime              , 2)    /* 4030 */
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_access             , 2)
+        MIPS_SYS(sys_nice               , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* 4035 */
+        MIPS_SYS(sys_sync               , 0)
+        MIPS_SYS(sys_kill               , 2)
+        MIPS_SYS(sys_rename             , 2)
+        MIPS_SYS(sys_mkdir              , 2)
+        MIPS_SYS(sys_rmdir              , 1)    /* 4040 */
+        MIPS_SYS(sys_dup                , 1)
+        MIPS_SYS(sys_pipe               , 0)
+        MIPS_SYS(sys_times              , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_brk                , 1)    /* 4045 */
+        MIPS_SYS(sys_setgid             , 1)
+        MIPS_SYS(sys_getgid             , 0)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was signal(2) */
+        MIPS_SYS(sys_geteuid            , 0)
+        MIPS_SYS(sys_getegid            , 0)    /* 4050 */
+        MIPS_SYS(sys_acct               , 0)
+        MIPS_SYS(sys_umount2            , 2)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_ioctl              , 3)
+        MIPS_SYS(sys_fcntl              , 3)    /* 4055 */
+        MIPS_SYS(sys_ni_syscall         , 2)
+        MIPS_SYS(sys_setpgid            , 2)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_olduname           , 1)
+        MIPS_SYS(sys_umask              , 1)    /* 4060 */
+        MIPS_SYS(sys_chroot             , 1)
+        MIPS_SYS(sys_ustat              , 2)
+        MIPS_SYS(sys_dup2               , 2)
+        MIPS_SYS(sys_getppid            , 0)
+        MIPS_SYS(sys_getpgrp            , 0)    /* 4065 */
+        MIPS_SYS(sys_setsid             , 0)
+        MIPS_SYS(sys_sigaction          , 3)
+        MIPS_SYS(sys_sgetmask           , 0)
+        MIPS_SYS(sys_ssetmask           , 1)
+        MIPS_SYS(sys_setreuid           , 2)    /* 4070 */
+        MIPS_SYS(sys_setregid           , 2)
+        MIPS_SYS(sys_sigsuspend         , 0)
+        MIPS_SYS(sys_sigpending         , 1)
+        MIPS_SYS(sys_sethostname        , 2)
+        MIPS_SYS(sys_setrlimit          , 2)    /* 4075 */
+        MIPS_SYS(sys_getrlimit          , 2)
+        MIPS_SYS(sys_getrusage          , 2)
+        MIPS_SYS(sys_gettimeofday       , 2)
+        MIPS_SYS(sys_settimeofday       , 2)
+        MIPS_SYS(sys_getgroups          , 2)    /* 4080 */
+        MIPS_SYS(sys_setgroups          , 2)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* old_select */
+        MIPS_SYS(sys_symlink            , 2)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_lstat */
+        MIPS_SYS(sys_readlink           , 3)    /* 4085 */
+        MIPS_SYS(sys_uselib             , 1)
+        MIPS_SYS(sys_swapon             , 2)
+        MIPS_SYS(sys_reboot             , 3)
+        MIPS_SYS(old_readdir            , 3)
+        MIPS_SYS(old_mmap               , 6)    /* 4090 */
+        MIPS_SYS(sys_munmap             , 2)
+        MIPS_SYS(sys_truncate           , 2)
+        MIPS_SYS(sys_ftruncate          , 2)
+        MIPS_SYS(sys_fchmod             , 2)
+        MIPS_SYS(sys_fchown             , 3)    /* 4095 */
+        MIPS_SYS(sys_getpriority        , 2)
+        MIPS_SYS(sys_setpriority        , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_statfs             , 2)
+        MIPS_SYS(sys_fstatfs            , 2)    /* 4100 */
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was ioperm(2) */
+        MIPS_SYS(sys_socketcall         , 2)
+        MIPS_SYS(sys_syslog             , 3)
+        MIPS_SYS(sys_setitimer          , 3)
+        MIPS_SYS(sys_getitimer          , 2)    /* 4105 */
+        MIPS_SYS(sys_newstat            , 2)
+        MIPS_SYS(sys_newlstat           , 2)
+        MIPS_SYS(sys_newfstat           , 2)
+        MIPS_SYS(sys_uname              , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* 4110 was iopl(2) */
+        MIPS_SYS(sys_vhangup            , 0)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_idle() */
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_vm86 */
+        MIPS_SYS(sys_wait4              , 4)
+        MIPS_SYS(sys_swapoff            , 1)    /* 4115 */
+        MIPS_SYS(sys_sysinfo            , 1)
+        MIPS_SYS(sys_ipc                , 6)
+        MIPS_SYS(sys_fsync              , 1)
+        MIPS_SYS(sys_sigreturn          , 0)
+        MIPS_SYS(sys_clone              , 6)    /* 4120 */
+        MIPS_SYS(sys_setdomainname      , 2)
+        MIPS_SYS(sys_newuname           , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* sys_modify_ldt */
+        MIPS_SYS(sys_adjtimex           , 1)
+        MIPS_SYS(sys_mprotect           , 3)    /* 4125 */
+        MIPS_SYS(sys_sigprocmask        , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was create_module */
+        MIPS_SYS(sys_init_module        , 5)
+        MIPS_SYS(sys_delete_module      , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* 4130 was get_kernel_syms */
+        MIPS_SYS(sys_quotactl           , 0)
+        MIPS_SYS(sys_getpgid            , 1)
+        MIPS_SYS(sys_fchdir             , 1)
+        MIPS_SYS(sys_bdflush            , 2)
+        MIPS_SYS(sys_sysfs              , 3)    /* 4135 */
+        MIPS_SYS(sys_personality        , 1)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* for afs_syscall */
+        MIPS_SYS(sys_setfsuid           , 1)
+        MIPS_SYS(sys_setfsgid           , 1)
+        MIPS_SYS(sys_llseek             , 5)    /* 4140 */
+        MIPS_SYS(sys_getdents           , 3)
+        MIPS_SYS(sys_select             , 5)
+        MIPS_SYS(sys_flock              , 2)
+        MIPS_SYS(sys_msync              , 3)
+        MIPS_SYS(sys_readv              , 3)    /* 4145 */
+        MIPS_SYS(sys_writev             , 3)
+        MIPS_SYS(sys_cacheflush         , 3)
+        MIPS_SYS(sys_cachectl           , 3)
+        MIPS_SYS(sys_sysmips            , 4)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* 4150 */
+        MIPS_SYS(sys_getsid             , 1)
+        MIPS_SYS(sys_fdatasync          , 0)
+        MIPS_SYS(sys_sysctl             , 1)
+        MIPS_SYS(sys_mlock              , 2)
+        MIPS_SYS(sys_munlock            , 2)    /* 4155 */
+        MIPS_SYS(sys_mlockall           , 1)
+        MIPS_SYS(sys_munlockall         , 0)
+        MIPS_SYS(sys_sched_setparam     , 2)
+        MIPS_SYS(sys_sched_getparam     , 2)
+        MIPS_SYS(sys_sched_setscheduler , 3)     /* 4160 */
+        MIPS_SYS(sys_sched_getscheduler , 1)
+        MIPS_SYS(sys_sched_yield        , 0)
+        MIPS_SYS(sys_sched_get_priority_max     , 1)
+        MIPS_SYS(sys_sched_get_priority_min     , 1)
+        MIPS_SYS(sys_sched_rr_get_interval      , 2)  /* 4165 */
+        MIPS_SYS(sys_nanosleep          , 2)
+        MIPS_SYS(sys_mremap             , 5)
+        MIPS_SYS(sys_accept             , 3)
+        MIPS_SYS(sys_bind               , 3)
+        MIPS_SYS(sys_connect            , 3)    /* 4170 */
+        MIPS_SYS(sys_getpeername        , 3)
+        MIPS_SYS(sys_getsockname        , 3)
+        MIPS_SYS(sys_getsockopt         , 5)
+        MIPS_SYS(sys_listen             , 2)
+        MIPS_SYS(sys_recv               , 4)    /* 4175 */
+        MIPS_SYS(sys_recvfrom           , 6)
+        MIPS_SYS(sys_recvmsg            , 3)
+        MIPS_SYS(sys_send               , 4)
+        MIPS_SYS(sys_sendmsg            , 3)
+        MIPS_SYS(sys_sendto             , 6)    /* 4180 */
+        MIPS_SYS(sys_setsockopt         , 5)
+        MIPS_SYS(sys_shutdown           , 2)
+        MIPS_SYS(sys_socket             , 3)
+        MIPS_SYS(sys_socketpair         , 4)
+        MIPS_SYS(sys_setresuid          , 3)    /* 4185 */
+        MIPS_SYS(sys_getresuid          , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was sys_query_module */
+        MIPS_SYS(sys_poll               , 3)
+        MIPS_SYS(sys_nfsservctl         , 3)
+        MIPS_SYS(sys_setresgid          , 3)    /* 4190 */
+        MIPS_SYS(sys_getresgid          , 3)
+        MIPS_SYS(sys_prctl              , 5)
+        MIPS_SYS(sys_rt_sigreturn       , 0)
+        MIPS_SYS(sys_rt_sigaction       , 4)
+        MIPS_SYS(sys_rt_sigprocmask     , 4)    /* 4195 */
+        MIPS_SYS(sys_rt_sigpending      , 2)
+        MIPS_SYS(sys_rt_sigtimedwait    , 4)
+        MIPS_SYS(sys_rt_sigqueueinfo    , 3)
+        MIPS_SYS(sys_rt_sigsuspend      , 0)
+        MIPS_SYS(sys_pread64            , 6)    /* 4200 */
+        MIPS_SYS(sys_pwrite64           , 6)
+        MIPS_SYS(sys_chown              , 3)
+        MIPS_SYS(sys_getcwd             , 2)
+        MIPS_SYS(sys_capget             , 2)
+        MIPS_SYS(sys_capset             , 2)    /* 4205 */
+        MIPS_SYS(sys_sigaltstack        , 2)
+        MIPS_SYS(sys_sendfile           , 4)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_mmap2              , 6)    /* 4210 */
+        MIPS_SYS(sys_truncate64         , 4)
+        MIPS_SYS(sys_ftruncate64        , 4)
+        MIPS_SYS(sys_stat64             , 2)
+        MIPS_SYS(sys_lstat64            , 2)
+        MIPS_SYS(sys_fstat64            , 2)    /* 4215 */
+        MIPS_SYS(sys_pivot_root         , 2)
+        MIPS_SYS(sys_mincore            , 3)
+        MIPS_SYS(sys_madvise            , 3)
+        MIPS_SYS(sys_getdents64         , 3)
+        MIPS_SYS(sys_fcntl64            , 3)    /* 4220 */
+        MIPS_SYS(sys_ni_syscall         , 0)
+        MIPS_SYS(sys_gettid             , 0)
+        MIPS_SYS(sys_readahead          , 5)
+        MIPS_SYS(sys_setxattr           , 5)
+        MIPS_SYS(sys_lsetxattr          , 5)    /* 4225 */
+        MIPS_SYS(sys_fsetxattr          , 5)
+        MIPS_SYS(sys_getxattr           , 4)
+        MIPS_SYS(sys_lgetxattr          , 4)
+        MIPS_SYS(sys_fgetxattr          , 4)
+        MIPS_SYS(sys_listxattr          , 3)    /* 4230 */
+        MIPS_SYS(sys_llistxattr         , 3)
+        MIPS_SYS(sys_flistxattr         , 3)
+        MIPS_SYS(sys_removexattr        , 2)
+        MIPS_SYS(sys_lremovexattr       , 2)
+        MIPS_SYS(sys_fremovexattr       , 2)    /* 4235 */
+        MIPS_SYS(sys_tkill              , 2)
+        MIPS_SYS(sys_sendfile64         , 5)
+        MIPS_SYS(sys_futex              , 6)
+        MIPS_SYS(sys_sched_setaffinity  , 3)
+        MIPS_SYS(sys_sched_getaffinity  , 3)    /* 4240 */
+        MIPS_SYS(sys_io_setup           , 2)
+        MIPS_SYS(sys_io_destroy         , 1)
+        MIPS_SYS(sys_io_getevents       , 5)
+        MIPS_SYS(sys_io_submit          , 3)
+        MIPS_SYS(sys_io_cancel          , 3)    /* 4245 */
+        MIPS_SYS(sys_exit_group         , 1)
+        MIPS_SYS(sys_lookup_dcookie     , 3)
+        MIPS_SYS(sys_epoll_create       , 1)
+        MIPS_SYS(sys_epoll_ctl          , 4)
+        MIPS_SYS(sys_epoll_wait         , 3)    /* 4250 */
+        MIPS_SYS(sys_remap_file_pages   , 5)
+        MIPS_SYS(sys_set_tid_address    , 1)
+        MIPS_SYS(sys_restart_syscall    , 0)
+        MIPS_SYS(sys_fadvise64_64       , 7)
+        MIPS_SYS(sys_statfs64           , 3)    /* 4255 */
+        MIPS_SYS(sys_fstatfs64          , 2)
+        MIPS_SYS(sys_timer_create       , 3)
+        MIPS_SYS(sys_timer_settime      , 4)
+        MIPS_SYS(sys_timer_gettime      , 2)
+        MIPS_SYS(sys_timer_getoverrun   , 1)    /* 4260 */
+        MIPS_SYS(sys_timer_delete       , 1)
+        MIPS_SYS(sys_clock_settime      , 2)
+        MIPS_SYS(sys_clock_gettime      , 2)
+        MIPS_SYS(sys_clock_getres       , 2)
+        MIPS_SYS(sys_clock_nanosleep    , 4)    /* 4265 */
+        MIPS_SYS(sys_tgkill             , 3)
+        MIPS_SYS(sys_utimes             , 2)
+        MIPS_SYS(sys_mbind              , 4)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* sys_get_mempolicy */
+        MIPS_SYS(sys_ni_syscall         , 0)    /* 4270 sys_set_mempolicy */
+        MIPS_SYS(sys_mq_open            , 4)
+        MIPS_SYS(sys_mq_unlink          , 1)
+        MIPS_SYS(sys_mq_timedsend       , 5)
+        MIPS_SYS(sys_mq_timedreceive    , 5)
+        MIPS_SYS(sys_mq_notify          , 2)    /* 4275 */
+        MIPS_SYS(sys_mq_getsetattr      , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* sys_vserver */
+        MIPS_SYS(sys_waitid             , 4)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* available, was setaltroot */
+        MIPS_SYS(sys_add_key            , 5)
+        MIPS_SYS(sys_request_key        , 4)
+        MIPS_SYS(sys_keyctl             , 5)
+        MIPS_SYS(sys_set_thread_area    , 1)
+        MIPS_SYS(sys_inotify_init       , 0)
+        MIPS_SYS(sys_inotify_add_watch  , 3)    /* 4285 */
+        MIPS_SYS(sys_inotify_rm_watch   , 2)
+        MIPS_SYS(sys_migrate_pages      , 4)
+        MIPS_SYS(sys_openat             , 4)
+        MIPS_SYS(sys_mkdirat            , 3)
+        MIPS_SYS(sys_mknodat            , 4)    /* 4290 */
+        MIPS_SYS(sys_fchownat           , 5)
+        MIPS_SYS(sys_futimesat          , 3)
+        MIPS_SYS(sys_fstatat64          , 4)
+        MIPS_SYS(sys_unlinkat           , 3)
+        MIPS_SYS(sys_renameat           , 4)    /* 4295 */
+        MIPS_SYS(sys_linkat             , 5)
+        MIPS_SYS(sys_symlinkat          , 3)
+        MIPS_SYS(sys_readlinkat         , 4)
+        MIPS_SYS(sys_fchmodat           , 3)
+        MIPS_SYS(sys_faccessat          , 3)    /* 4300 */
+        MIPS_SYS(sys_pselect6           , 6)
+        MIPS_SYS(sys_ppoll              , 5)
+        MIPS_SYS(sys_unshare            , 1)
+        MIPS_SYS(sys_splice             , 6)
+        MIPS_SYS(sys_sync_file_range    , 7)    /* 4305 */
+        MIPS_SYS(sys_tee                , 4)
+        MIPS_SYS(sys_vmsplice           , 4)
+        MIPS_SYS(sys_move_pages         , 6)
+        MIPS_SYS(sys_set_robust_list    , 2)
+        MIPS_SYS(sys_get_robust_list    , 3)    /* 4310 */
+        MIPS_SYS(sys_kexec_load         , 4)
+        MIPS_SYS(sys_getcpu             , 3)
+        MIPS_SYS(sys_epoll_pwait        , 6)
+        MIPS_SYS(sys_ioprio_set         , 3)
+        MIPS_SYS(sys_ioprio_get         , 2)
+        MIPS_SYS(sys_utimensat          , 4)
+        MIPS_SYS(sys_signalfd           , 3)
+        MIPS_SYS(sys_ni_syscall         , 0)    /* was timerfd */
+        MIPS_SYS(sys_eventfd            , 1)
+        MIPS_SYS(sys_fallocate          , 6)    /* 4320 */
+        MIPS_SYS(sys_timerfd_create     , 2)
+        MIPS_SYS(sys_timerfd_gettime    , 2)
+        MIPS_SYS(sys_timerfd_settime    , 4)
+        MIPS_SYS(sys_signalfd4          , 4)
+        MIPS_SYS(sys_eventfd2           , 2)    /* 4325 */
+        MIPS_SYS(sys_epoll_create1      , 1)
+        MIPS_SYS(sys_dup3               , 3)
+        MIPS_SYS(sys_pipe2              , 2)
+        MIPS_SYS(sys_inotify_init1      , 1)
+        MIPS_SYS(sys_preadv             , 6)    /* 4330 */
+        MIPS_SYS(sys_pwritev            , 6)
+        MIPS_SYS(sys_rt_tgsigqueueinfo  , 4)
+        MIPS_SYS(sys_perf_event_open    , 5)
+        MIPS_SYS(sys_accept4            , 4)
+        MIPS_SYS(sys_recvmmsg           , 5)    /* 4335 */
+        MIPS_SYS(sys_fanotify_init      , 2)
+        MIPS_SYS(sys_fanotify_mark      , 6)
+        MIPS_SYS(sys_prlimit64          , 4)
+        MIPS_SYS(sys_name_to_handle_at  , 5)
+        MIPS_SYS(sys_open_by_handle_at  , 3)    /* 4340 */
+        MIPS_SYS(sys_clock_adjtime      , 2)
+        MIPS_SYS(sys_syncfs             , 1)
 };
 #  undef MIPS_SYS
 # endif /* O32 */
@@ -2854,14 +2854,14 @@ void cpu_loop(CPUSH4State *env)
                   }
             }
             break;
-	case 0xa0:
-	case 0xc0:
+        case 0xa0:
+        case 0xc0:
             info.si_signo = TARGET_SIGSEGV;
             info.si_errno = 0;
             info.si_code = TARGET_SEGV_MAPERR;
             info._sifields._sigfault._addr = env->tea;
             queue_signal(env, info.si_signo, &info);
-	    break;
+            break;
 
         default:
             printf ("Unhandled trap: 0x%x\n", trapnr);
@@ -2879,7 +2879,7 @@ void cpu_loop(CPUCRISState *env)
     CPUState *cs = CPU(cris_env_get_cpu(env));
     int trapnr, ret;
     target_siginfo_t info;
-    
+
     while (1) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
@@ -2895,17 +2895,17 @@ void cpu_loop(CPUCRISState *env)
                 queue_signal(env, info.si_signo, &info);
             }
             break;
-	case EXCP_INTERRUPT:
-	  /* just indicate that signals should be handled asap */
-	  break;
+        case EXCP_INTERRUPT:
+          /* just indicate that signals should be handled asap */
+          break;
         case EXCP_BREAK:
-            ret = do_syscall(env, 
-                             env->regs[9], 
-                             env->regs[10], 
-                             env->regs[11], 
-                             env->regs[12], 
-                             env->regs[13], 
-                             env->pregs[7], 
+            ret = do_syscall(env,
+                             env->regs[9],
+                             env->regs[10],
+                             env->regs[11],
+                             env->regs[12],
+                             env->regs[13],
+                             env->pregs[7],
                              env->pregs[11],
                              0, 0);
             if (ret == -TARGET_ERESTARTSYS) {
@@ -2944,7 +2944,7 @@ void cpu_loop(CPUMBState *env)
     CPUState *cs = CPU(mb_env_get_cpu(env));
     int trapnr, ret;
     target_siginfo_t info;
-    
+
     while (1) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
@@ -2960,20 +2960,20 @@ void cpu_loop(CPUMBState *env)
                 queue_signal(env, info.si_signo, &info);
             }
             break;
-	case EXCP_INTERRUPT:
-	  /* just indicate that signals should be handled asap */
-	  break;
+        case EXCP_INTERRUPT:
+          /* just indicate that signals should be handled asap */
+          break;
         case EXCP_BREAK:
             /* Return address is 4 bytes after the call.  */
             env->regs[14] += 4;
             env->sregs[SR_PC] = env->regs[14];
-            ret = do_syscall(env, 
-                             env->regs[12], 
-                             env->regs[5], 
-                             env->regs[6], 
-                             env->regs[7], 
-                             env->regs[8], 
-                             env->regs[9], 
+            ret = do_syscall(env,
+                             env->regs[12],
+                             env->regs[5],
+                             env->regs[6],
+                             env->regs[7],
+                             env->regs[8],
+                             env->regs[9],
                              env->regs[10],
                              0, 0);
             if (ret == -TARGET_ERESTARTSYS) {
@@ -4369,8 +4369,8 @@ int main(int argc, char **argv, char **envp)
     target_argc = argc - optind;
     target_argv = calloc(target_argc + 1, sizeof (char *));
     if (target_argv == NULL) {
-	(void) fprintf(stderr, "Unable to allocate memory for target_argv\n");
-	exit(EXIT_FAILURE);
+        (void) fprintf(stderr, "Unable to allocate memory for target_argv\n");
+        exit(EXIT_FAILURE);
     }
 
     /*
@@ -4602,8 +4602,8 @@ int main(int argc, char **argv, char **envp)
 #elif defined(TARGET_SPARC)
     {
         int i;
-	env->pc = regs->pc;
-	env->npc = regs->npc;
+        env->pc = regs->pc;
+        env->npc = regs->npc;
         env->y = regs->y;
         for(i = 0; i < 8; i++)
             env->gregs[i] = regs->u_regs[i];
@@ -4665,23 +4665,23 @@ int main(int argc, char **argv, char **envp)
         env->regs[12] = regs->r12;
         env->regs[13] = regs->r13;
         env->regs[14] = regs->r14;
-        env->regs[15] = regs->r15;	    
-        env->regs[16] = regs->r16;	    
-        env->regs[17] = regs->r17;	    
-        env->regs[18] = regs->r18;	    
-        env->regs[19] = regs->r19;	    
-        env->regs[20] = regs->r20;	    
-        env->regs[21] = regs->r21;	    
-        env->regs[22] = regs->r22;	    
-        env->regs[23] = regs->r23;	    
-        env->regs[24] = regs->r24;	    
-        env->regs[25] = regs->r25;	    
-        env->regs[26] = regs->r26;	    
-        env->regs[27] = regs->r27;	    
-        env->regs[28] = regs->r28;	    
-        env->regs[29] = regs->r29;	    
-        env->regs[30] = regs->r30;	    
-        env->regs[31] = regs->r31;	    
+        env->regs[15] = regs->r15;
+        env->regs[16] = regs->r16;
+        env->regs[17] = regs->r17;
+        env->regs[18] = regs->r18;
+        env->regs[19] = regs->r19;
+        env->regs[20] = regs->r20;
+        env->regs[21] = regs->r21;
+        env->regs[22] = regs->r22;
+        env->regs[23] = regs->r23;
+        env->regs[24] = regs->r24;
+        env->regs[25] = regs->r25;
+        env->regs[26] = regs->r26;
+        env->regs[27] = regs->r27;
+        env->regs[28] = regs->r28;
+        env->regs[29] = regs->r29;
+        env->regs[30] = regs->r30;
+        env->regs[31] = regs->r31;
         env->sregs[SR_PC] = regs->pc;
     }
 #elif defined(TARGET_MIPS)
@@ -4742,23 +4742,23 @@ int main(int argc, char **argv, char **envp)
     }
 #elif defined(TARGET_CRIS)
     {
-	    env->regs[0] = regs->r0;
-	    env->regs[1] = regs->r1;
-	    env->regs[2] = regs->r2;
-	    env->regs[3] = regs->r3;
-	    env->regs[4] = regs->r4;
-	    env->regs[5] = regs->r5;
-	    env->regs[6] = regs->r6;
-	    env->regs[7] = regs->r7;
-	    env->regs[8] = regs->r8;
-	    env->regs[9] = regs->r9;
-	    env->regs[10] = regs->r10;
-	    env->regs[11] = regs->r11;
-	    env->regs[12] = regs->r12;
-	    env->regs[13] = regs->r13;
-	    env->regs[14] = info->start_stack;
-	    env->regs[15] = regs->acr;	    
-	    env->pc = regs->erp;
+            env->regs[0] = regs->r0;
+            env->regs[1] = regs->r1;
+            env->regs[2] = regs->r2;
+            env->regs[3] = regs->r3;
+            env->regs[4] = regs->r4;
+            env->regs[5] = regs->r5;
+            env->regs[6] = regs->r6;
+            env->regs[7] = regs->r7;
+            env->regs[8] = regs->r8;
+            env->regs[9] = regs->r9;
+            env->regs[10] = regs->r10;
+            env->regs[11] = regs->r11;
+            env->regs[12] = regs->r12;
+            env->regs[13] = regs->r13;
+            env->regs[14] = info->start_stack;
+            env->regs[15] = regs->acr;
+            env->pc = regs->erp;
     }
 #elif defined(TARGET_S390X)
     {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (7 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces " Aleksandar Markovic
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch removes all braces-related errors (reported by checkpatch.pl)
from linux-user/main.c.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/main.c | 188 +++++++++++++++++++++++++++++++-----------------------
 1 file changed, 108 insertions(+), 80 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 12042a3..4c930e2 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -346,9 +346,10 @@ void cpu_loop(CPUX86State *env)
 #ifndef TARGET_X86_64
             if (env->eflags & VM_MASK) {
                 handle_vm86_fault(env);
-            } else
-#endif
+            } else {
+#else
             {
+#endif
                 info.si_signo = TARGET_SIGSEGV;
                 info.si_errno = 0;
                 info.si_code = TARGET_SI_KERNEL;
@@ -359,10 +360,11 @@ void cpu_loop(CPUX86State *env)
         case EXCP0E_PAGE:
             info.si_signo = TARGET_SIGSEGV;
             info.si_errno = 0;
-            if (!(env->error_code & 1))
+            if (!(env->error_code & 1)) {
                 info.si_code = TARGET_SEGV_MAPERR;
-            else
+            } else {
                 info.si_code = TARGET_SEGV_ACCERR;
+            }
             info._sifields._sigfault._addr = env->cr[2];
             queue_signal(env, info.si_signo, &info);
             break;
@@ -370,9 +372,10 @@ void cpu_loop(CPUX86State *env)
 #ifndef TARGET_X86_64
             if (env->eflags & VM_MASK) {
                 handle_vm86_trap(env, trapnr);
-            } else
-#endif
+            } else {
+#else
             {
+#endif
                 /* division by zero */
                 info.si_signo = TARGET_SIGFPE;
                 info.si_errno = 0;
@@ -386,9 +389,10 @@ void cpu_loop(CPUX86State *env)
 #ifndef TARGET_X86_64
             if (env->eflags & VM_MASK) {
                 handle_vm86_trap(env, trapnr);
-            } else
-#endif
+            } else {
+#else
             {
+#endif
                 info.si_signo = TARGET_SIGTRAP;
                 info.si_errno = 0;
                 if (trapnr == EXCP01_DB) {
@@ -406,9 +410,10 @@ void cpu_loop(CPUX86State *env)
 #ifndef TARGET_X86_64
             if (env->eflags & VM_MASK) {
                 handle_vm86_trap(env, trapnr);
-            } else
-#endif
+            } else {
+#else
             {
+#endif
                 info.si_signo = TARGET_SIGSEGV;
                 info.si_errno = 0;
                 info.si_code = TARGET_SI_KERNEL;
@@ -431,13 +436,12 @@ void cpu_loop(CPUX86State *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         default:
@@ -600,8 +604,9 @@ do_kernel_trap(CPUARMState *env)
         cpsr = cpsr_read(env);
         addr = env->regs[2];
         /* FIXME: This should SEGV if the access fails.  */
-        if (get_user_u32(val, addr))
+        if (get_user_u32(val, addr)) {
             val = ~env->regs[0];
+        }
         if (val == env->regs[0]) {
             val = env->regs[1];
             /* FIXME: Check for segfaults.  */
@@ -760,48 +765,68 @@ void cpu_loop(CPUARMState *env)
                     int arm_fpe=0;
 
                     /* translate softfloat flags to FPSR flags */
-                    if (-rc & float_flag_invalid)
-                      arm_fpe |= BIT_IOC;
-                    if (-rc & float_flag_divbyzero)
-                      arm_fpe |= BIT_DZC;
-                    if (-rc & float_flag_overflow)
-                      arm_fpe |= BIT_OFC;
-                    if (-rc & float_flag_underflow)
-                      arm_fpe |= BIT_UFC;
-                    if (-rc & float_flag_inexact)
-                      arm_fpe |= BIT_IXC;
+                    if (-rc & float_flag_invalid) {
+                        arm_fpe |= BIT_IOC;
+                    }
+                    if (-rc & float_flag_divbyzero) {
+                        arm_fpe |= BIT_DZC;
+                    }
+                    if (-rc & float_flag_overflow) {
+                        arm_fpe |= BIT_OFC;
+                    }
+                    if (-rc & float_flag_underflow) {
+                        arm_fpe |= BIT_UFC;
+                    }
+                    if (-rc & float_flag_inexact) {
+                        arm_fpe |= BIT_IXC;
+                    }
 
                     FPSR fpsr = ts->fpa.fpsr;
                     //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
 
                     if (fpsr & (arm_fpe << 16)) { /* exception enabled? */
-                      info.si_signo = TARGET_SIGFPE;
-                      info.si_errno = 0;
-
-                      /* ordered by priority, least first */
-                      if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
-                      if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
-                      if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
-                      if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
-                      if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
-
-                      info._sifields._sigfault._addr = env->regs[15];
-                      queue_signal(env, info.si_signo, &info);
+                        info.si_signo = TARGET_SIGFPE;
+                        info.si_errno = 0;
+
+                        /* ordered by priority, least first */
+                        if (arm_fpe & BIT_IXC) {
+                            info.si_code = TARGET_FPE_FLTRES;
+                        }
+                        if (arm_fpe & BIT_UFC) {
+                            info.si_code = TARGET_FPE_FLTUND;
+                        }
+                        if (arm_fpe & BIT_OFC) {
+                            info.si_code = TARGET_FPE_FLTOVF;
+                        }
+                        if (arm_fpe & BIT_DZC) {
+                            info.si_code = TARGET_FPE_FLTDIV;
+                        }
+                        if (arm_fpe & BIT_IOC) {
+                            info.si_code = TARGET_FPE_FLTINV;
+                        }
+
+                        info._sifields._sigfault._addr = env->regs[15];
+                        queue_signal(env, info.si_signo, &info);
                     } else {
-                      env->regs[15] += 4;
+                        env->regs[15] += 4;
                     }
 
                     /* accumulate unenabled exceptions */
-                    if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
-                      fpsr |= BIT_IXC;
-                    if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
-                      fpsr |= BIT_UFC;
-                    if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
-                      fpsr |= BIT_OFC;
-                    if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
-                      fpsr |= BIT_DZC;
-                    if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
-                      fpsr |= BIT_IOC;
+                    if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) {
+                        fpsr |= BIT_IXC;
+                    }
+                    if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) {
+                        fpsr |= BIT_UFC;
+                    }
+                    if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) {
+                        fpsr |= BIT_OFC;
+                    }
+                    if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) {
+                        fpsr |= BIT_DZC;
+                    }
+                    if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) {
+                        fpsr |= BIT_IOC;
+                    }
                     ts->fpa.fpsr=fpsr;
                 } else { /* everything OK */
                     /* increment PC */
@@ -916,18 +941,18 @@ void cpu_loop(CPUARMState *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         case EXCP_KERNEL_TRAP:
-            if (do_kernel_trap(env))
-              goto error;
+            if (do_kernel_trap(env)) {
+                goto error;
+            }
             break;
         case EXCP_YIELD:
             /* nothing to do here for user-mode, just resume guest code */
@@ -1244,8 +1269,9 @@ static inline int get_reg_index(CPUSPARCState *env, int cwp, int index)
     index = (index + cwp * 16) % (16 * env->nwindows);
     /* wrap handling : if cwp is on the last window, then we use the
        registers 'after' the end */
-    if (index < 8 && env->cwp == env->nwindows - 1)
+    if (index < 8 && env->cwp == env->nwindows - 1) {
         index += 16 * env->nwindows;
+    }
     return index;
 }
 
@@ -1257,8 +1283,9 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
 
     sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
 #ifdef TARGET_SPARC64
-    if (sp_ptr & 3)
+    if (sp_ptr & 3) {
         sp_ptr += SPARC64_STACK_BIAS;
+    }
 #endif
 #if defined(DEBUG_WIN)
     printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n",
@@ -1303,8 +1330,9 @@ static void restore_window(CPUSPARCState *env)
     cwp1 = cpu_cwp_inc(env, env->cwp + 1);
     sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
 #ifdef TARGET_SPARC64
-    if (sp_ptr & 3)
+    if (sp_ptr & 3) {
         sp_ptr += SPARC64_STACK_BIAS;
+    }
 #endif
 #if defined(DEBUG_WIN)
     printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n",
@@ -1317,8 +1345,9 @@ static void restore_window(CPUSPARCState *env)
     }
 #ifdef TARGET_SPARC64
     env->canrestore++;
-    if (env->cleanwin < env->nwindows - 1)
+    if (env->cleanwin < env->nwindows - 1) {
         env->cleanwin++;
+    }
     env->cansave--;
 #else
     env->wim = new_wim;
@@ -1334,11 +1363,13 @@ static void flush_windows(CPUSPARCState *env)
         /* if restore would invoke restore_window(), then we can stop */
         cwp1 = cpu_cwp_inc(env, env->cwp + offset);
 #ifndef TARGET_SPARC64
-        if (env->wim & (1 << cwp1))
+        if (env->wim & (1 << cwp1)) {
             break;
+        }
 #else
-        if (env->canrestore == 0)
+        if (env->canrestore == 0) {
             break;
+        }
         env->cansave++;
         env->canrestore--;
 #endif
@@ -1448,10 +1479,11 @@ void cpu_loop (CPUSPARCState *env)
                 info.si_errno = 0;
                 /* XXX: check env->error_code */
                 info.si_code = TARGET_SEGV_MAPERR;
-                if (trapnr == TT_DFAULT)
+                if (trapnr == TT_DFAULT) {
                     info._sifields._sigfault._addr = env->dmmuregs[4];
-                else
+                } else {
                     info._sifields._sigfault._addr = cpu_tsptr(env)->tpc;
+                }
                 queue_signal(env, info.si_signo, &info);
             }
             break;
@@ -1483,13 +1515,12 @@ void cpu_loop (CPUSPARCState *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         default:
@@ -2577,13 +2608,12 @@ done_syscall:
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         case EXCP_SC:
@@ -2845,13 +2875,12 @@ void cpu_loop(CPUSH4State *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         case 0xa0:
@@ -2919,13 +2948,12 @@ void cpu_loop(CPUCRISState *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         default:
@@ -3033,13 +3061,12 @@ void cpu_loop(CPUMBState *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         default:
@@ -3134,13 +3161,12 @@ void cpu_loop(CPUM68KState *env)
                 int sig;
 
                 sig = gdb_handlesig(cs, TARGET_SIGTRAP);
-                if (sig)
-                  {
+                if (sig) {
                     info.si_signo = sig;
                     info.si_errno = 0;
                     info.si_code = TARGET_TRAP_BRKPT;
                     queue_signal(env, info.si_signo, &info);
-                  }
+                }
             }
             break;
         default:
@@ -4605,10 +4631,12 @@ int main(int argc, char **argv, char **envp)
         env->pc = regs->pc;
         env->npc = regs->npc;
         env->y = regs->y;
-        for(i = 0; i < 8; i++)
+        for (i = 0; i < 8; i++) {
             env->gregs[i] = regs->u_regs[i];
-        for(i = 0; i < 8; i++)
+        }
+        for (i = 0; i < 8; i++) {
             env->regwptr[i] = regs->u_regs[i + 8];
+        }
     }
 #elif defined(TARGET_PPC)
     {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces in linux-user/main.c
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (8 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
  2016-09-14 19:15 ` [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Peter Maydell
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch removes all spaces-related errors (reported by checkpatch.pl)
from linux-user/main.c.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/main.c | 96 +++++++++++++++++++++++++++----------------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 4c930e2..f4b4dc5 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -292,11 +292,11 @@ void cpu_loop(CPUX86State *env)
     abi_ulong ret;
     target_siginfo_t info;
 
-    for(;;) {
+    for (;;) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
-        switch(trapnr) {
+        switch (trapnr) {
         case 0x80:
             /* linux syscall from int $0x80 */
             ret = do_syscall(env,
@@ -738,11 +738,11 @@ void cpu_loop(CPUARMState *env)
     uint32_t addr;
     abi_ulong ret;
 
-    for(;;) {
+    for (;;) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
-        switch(trapnr) {
+        switch (trapnr) {
         case EXCP_UDEF:
             {
                 TaskState *ts = cs->opaque;
@@ -762,7 +762,7 @@ void cpu_loop(CPUARMState *env)
                     info._sifields._sigfault._addr = env->regs[15];
                     queue_signal(env, info.si_signo, &info);
                 } else if (rc < 0) { /* FP exception */
-                    int arm_fpe=0;
+                    int arm_fpe = 0;
 
                     /* translate softfloat flags to FPSR flags */
                     if (-rc & float_flag_invalid) {
@@ -827,7 +827,7 @@ void cpu_loop(CPUARMState *env)
                     if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) {
                         fpsr |= BIT_IOC;
                     }
-                    ts->fpa.fpsr=fpsr;
+                    ts->fpa.fpsr = fpsr;
                 } else { /* everything OK */
                     /* increment PC */
                     env->regs[15] += 4;
@@ -867,7 +867,7 @@ void cpu_loop(CPUARMState *env)
                     /* nop */
                 } else if (n == ARM_NR_semihosting
                            || n == ARM_NR_thumb_semihosting) {
-                    env->regs[0] = do_arm_semihosting (env);
+                    env->regs[0] = do_arm_semihosting(env);
                 } else if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
                     /* linux syscall */
                     if (env->thumb || n == 0) {
@@ -876,7 +876,7 @@ void cpu_loop(CPUARMState *env)
                         n -= ARM_SYSCALL_BASE;
                         env->eabi = 0;
                     }
-                    if ( n > ARM_NR_BASE) {
+                    if (n > ARM_NR_BASE) {
                         switch (n) {
                         case ARM_NR_cacheflush:
                             /* nop */
@@ -1291,7 +1291,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
     printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n",
            sp_ptr, cwp1);
 #endif
-    for(i = 0; i < 16; i++) {
+    for (i = 0; i < 16; 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);
@@ -1338,7 +1338,7 @@ static void restore_window(CPUSPARCState *env)
     printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n",
            sp_ptr, cwp1);
 #endif
-    for(i = 0; i < 16; i++) {
+    for (i = 0; i < 16; i++) {
         /* 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);
@@ -1359,7 +1359,7 @@ static void flush_windows(CPUSPARCState *env)
     int offset, cwp1;
 
     offset = 1;
-    for(;;) {
+    for (;;) {
         /* if restore would invoke restore_window(), then we can stop */
         cwp1 = cpu_cwp_inc(env, env->cwp + offset);
 #ifndef TARGET_SPARC64
@@ -1386,7 +1386,7 @@ static void flush_windows(CPUSPARCState *env)
 #endif
 }
 
-void cpu_loop (CPUSPARCState *env)
+void cpu_loop(CPUSPARCState *env)
 {
     CPUState *cs = CPU(sparc_env_get_cpu(env));
     int trapnr;
@@ -1411,7 +1411,7 @@ void cpu_loop (CPUSPARCState *env)
         case 0x110:
         case 0x16d:
 #endif
-            ret = do_syscall (env, env->gregs[1],
+            ret = do_syscall(env, env->gregs[1],
                               env->regwptr[0], env->regwptr[1],
                               env->regwptr[2], env->regwptr[3],
                               env->regwptr[4], env->regwptr[5],
@@ -1524,11 +1524,11 @@ void cpu_loop (CPUSPARCState *env)
             }
             break;
         default:
-            printf ("Unhandled trap: 0x%x\n", trapnr);
+            printf("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 
@@ -1561,7 +1561,7 @@ uint32_t cpu_ppc_load_atbu(CPUPPCState *env)
 }
 
 uint32_t cpu_ppc601_load_rtcu(CPUPPCState *env)
-__attribute__ (( alias ("cpu_ppc_load_tbu") ));
+__attribute__((alias("cpu_ppc_load_tbu")));
 
 uint32_t cpu_ppc601_load_rtcl(CPUPPCState *env)
 {
@@ -1569,12 +1569,12 @@ uint32_t cpu_ppc601_load_rtcl(CPUPPCState *env)
 }
 
 /* XXX: to be fixed */
-int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp)
+int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp)
 {
     return -1;
 }
 
-int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val)
+int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val)
 {
     return -1;
 }
@@ -1628,9 +1628,9 @@ static int do_store_exclusive(CPUPPCState *env)
                     if (val2 == env->reserve_val2) {
                         if (msr_le) {
                             val2 = val;
-                            val = env->gpr[reg+1];
+                            val = env->gpr[reg + 1];
                         } else {
-                            val2 = env->gpr[reg+1];
+                            val2 = env->gpr[reg + 1];
                         }
                         segv = put_user_u64(val, addr);
                         if (!segv) {
@@ -1665,11 +1665,11 @@ void cpu_loop(CPUPPCState *env)
     int trapnr;
     target_ulong ret;
 
-    for(;;) {
+    for (;;) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
-        switch(trapnr) {
+        switch (trapnr) {
         case POWERPC_EXCP_NONE:
             /* Just go on */
             break;
@@ -2511,11 +2511,11 @@ void cpu_loop(CPUMIPSState *env)
     unsigned int syscall_num;
 # endif
 
-    for(;;) {
+    for (;;) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
-        switch(trapnr) {
+        switch (trapnr) {
         case EXCP_SYSCALL:
             env->active_tc.PC += 4;
 # ifdef TARGET_ABI_MIPSO32
@@ -2893,11 +2893,11 @@ void cpu_loop(CPUSH4State *env)
             break;
 
         default:
-            printf ("Unhandled trap: 0x%x\n", trapnr);
+            printf("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 #endif
@@ -2957,11 +2957,11 @@ void cpu_loop(CPUCRISState *env)
             }
             break;
         default:
-            printf ("Unhandled trap: 0x%x\n", trapnr);
+            printf("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 #endif
@@ -3049,7 +3049,7 @@ void cpu_loop(CPUMBState *env)
                     queue_signal(env, info.si_signo, &info);
                     break;
                 default:
-                    printf ("Unhandled hw-exception: 0x%x\n",
+                    printf("Unhandled hw-exception: 0x%x\n",
                             env->sregs[SR_ESR] & ESR_EC_MASK);
                     cpu_dump_state(cs, stderr, fprintf, 0);
                     exit(EXIT_FAILURE);
@@ -3070,11 +3070,11 @@ void cpu_loop(CPUMBState *env)
             }
             break;
         default:
-            printf ("Unhandled trap: 0x%x\n", trapnr);
+            printf("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 #endif
@@ -3089,11 +3089,11 @@ void cpu_loop(CPUM68KState *env)
     target_siginfo_t info;
     TaskState *ts = cs->opaque;
 
-    for(;;) {
+    for (;;) {
         cpu_exec_start(cs);
         trapnr = cpu_exec(cs);
         cpu_exec_end(cs);
-        switch(trapnr) {
+        switch (trapnr) {
         case EXCP_ILLEGAL:
             {
                 if (ts->sim_syscalls) {
@@ -3405,11 +3405,11 @@ void cpu_loop(CPUAlphaState *env)
             /* Just indicate that signals should be handled asap.  */
             break;
         default:
-            printf ("Unhandled trap: 0x%x\n", trapnr);
+            printf("Unhandled trap: 0x%x\n", trapnr);
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 #endif /* TARGET_ALPHA */
@@ -3536,7 +3536,7 @@ void cpu_loop(CPUS390XState *env)
             cpu_dump_state(cs, stderr, fprintf, 0);
             exit(EXIT_FAILURE);
         }
-        process_pending_signals (env);
+        process_pending_signals(env);
     }
 }
 
@@ -4111,7 +4111,7 @@ static void usage(int exitcode)
         }
     }
 
-    printf("%-*s %-*s Description\n", maxarglen+1, "Argument",
+    printf("%-*s %-*s Description\n", maxarglen + 1, "Argument",
             maxenvlen, "Env-variable");
 
     for (arginfo = arg_table; arginfo->handle_opt != NULL; arginfo++) {
@@ -4279,7 +4279,7 @@ int main(int argc, char **argv, char **envp)
     /* Zero out image_info */
     memset(info, 0, sizeof(struct image_info));
 
-    memset(&bprm, 0, sizeof (bprm));
+    memset(&bprm, 0, sizeof(bprm));
 
     /* Scan interp_prefix dir for replacement files. */
     init_paths(interp_prefix);
@@ -4393,7 +4393,7 @@ int main(int argc, char **argv, char **envp)
      * Prepare copy of argv vector for target.
      */
     target_argc = argc - optind;
-    target_argv = calloc(target_argc + 1, sizeof (char *));
+    target_argv = calloc(target_argc + 1, sizeof(char *));
     if (target_argv == NULL) {
         (void) fprintf(stderr, "Unable to allocate memory for target_argv\n");
         exit(EXIT_FAILURE);
@@ -4519,8 +4519,8 @@ int main(int argc, char **argv, char **envp)
     env->idt.limit = 255;
 #endif
     env->idt.base = target_mmap(0, sizeof(uint64_t) * (env->idt.limit + 1),
-                                PROT_READ|PROT_WRITE,
-                                MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+                                PROT_READ | PROT_WRITE,
+                                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
     idt_table = g2h(env->idt.base);
     set_idt(0, 0);
     set_idt(1, 0);
@@ -4548,8 +4548,8 @@ int main(int argc, char **argv, char **envp)
     {
         uint64_t *gdt_table;
         env->gdt.base = target_mmap(0, sizeof(uint64_t) * TARGET_GDT_ENTRIES,
-                                    PROT_READ|PROT_WRITE,
-                                    MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+                                    PROT_READ | PROT_WRITE,
+                                    MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
         env->gdt.limit = sizeof(uint64_t) * TARGET_GDT_ENTRIES - 1;
         gdt_table = g2h(env->gdt.base);
 #ifdef TARGET_ABI32
@@ -4603,7 +4603,7 @@ int main(int argc, char **argv, char **envp)
         int i;
         cpsr_write(env, regs->uregs[16], CPSR_USER | CPSR_EXEC,
                    CPSRWriteByInstr);
-        for(i = 0; i < 16; i++) {
+        for (i = 0; i < 16; i++) {
             env->regs[i] = regs->uregs[i];
         }
 #ifdef TARGET_WORDS_BIGENDIAN
@@ -4650,7 +4650,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 #endif
         env->nip = regs->nip;
-        for(i = 0; i < 32; i++) {
+        for (i = 0; i < 32; i++) {
             env->gpr[i] = regs->gpr[i];
         }
     }
@@ -4716,7 +4716,7 @@ int main(int argc, char **argv, char **envp)
     {
         int i;
 
-        for(i = 0; i < 32; i++) {
+        for (i = 0; i < 32; i++) {
             env->active_tc.gpr[i] = regs->regs[i];
         }
         env->active_tc.PC = regs->cp0_epc & ~(target_ulong)1;
@@ -4753,7 +4753,7 @@ int main(int argc, char **argv, char **envp)
     {
         int i;
 
-        for(i = 0; i < 16; i++) {
+        for (i = 0; i < 16; i++) {
             env->gregs[i] = regs->regs[i];
         }
         env->pc = regs->pc;
@@ -4762,7 +4762,7 @@ int main(int argc, char **argv, char **envp)
     {
         int i;
 
-        for(i = 0; i < 28; i++) {
+        for (i = 0; i < 28; i++) {
             env->ir[i] = ((abi_ulong *)regs)[i];
         }
         env->ir[IR_SP] = regs->usp;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (9 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces " Aleksandar Markovic
@ 2016-09-14 15:22 ` Aleksandar Markovic
  2016-09-14 19:15 ` [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Peter Maydell
  11 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 15:22 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, petar.jovanovic,
	miodrag.dinic, aleksandar.rikalo, aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

There is a duplicate item in strace.list. It is benign, but it
shouldn't be there. It is the only duplicate in strace.list. This
patch removes it.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.list | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/linux-user/strace.list b/linux-user/strace.list
index 2f99ac2..f74545f 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1532,9 +1532,6 @@
 #ifdef TARGET_NR_utimensat
 { TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL },
 #endif
-#ifdef TARGET_NR_sync_file_range
-{ TARGET_NR_sync_file_range, "sync_file_range", NULL, NULL, NULL },
-#endif
 #ifdef TARGET_NR_sync_file_range2
 { TARGET_NR_sync_file_range2, "sync_file_range2", NULL, NULL, NULL },
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues
  2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
                   ` (10 preceding siblings ...)
  2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
@ 2016-09-14 19:15 ` Peter Maydell
  2016-09-14 20:01   ` Aleksandar Markovic
  11 siblings, 1 reply; 14+ messages in thread
From: Peter Maydell @ 2016-09-14 19:15 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: QEMU Developers, Riku Voipio, Petar Jovanovic, Miodrag Dinic,
	aleksandar.rikalo, Aleksandar Markovic

On 14 September 2016 at 16:21, Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
> This series fix certain Qemu user mode issues. The fixes mainly originate
> from observation of LTP tests failures for execution in Qemu user mode
> on various platforms. The series also contains four cleanup patches.

>   linux-user: Remove tabs and trailing spaces from linux-user/main.c
>   linux-user: Improve braces-related formatting in linux-user/main.c
>   linux-user: Improve usage of spaces in linux-user/main.c

I'm pretty sure these are going to conflict with the various
other linux-user patches currently in-flight, so I'm not sure
they're a great idea right now. (In general awkward conflicts
with other stuff and loss of info from git blame is why we
don't often do whole-file coding style cleanups.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues
  2016-09-14 19:15 ` [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Peter Maydell
@ 2016-09-14 20:01   ` Aleksandar Markovic
  0 siblings, 0 replies; 14+ messages in thread
From: Aleksandar Markovic @ 2016-09-14 20:01 UTC (permalink / raw)
  To: Peter Maydell, Aleksandar Markovic
  Cc: QEMU Developers, Riku Voipio, Petar Jovanovic, Miodrag Dinic,
	Aleksandar Rikalo

OK, these patches will be removed in v5, which is pending. Thanks.

Aleksandar

________________________________________
From: Peter Maydell [peter.maydell@linaro.org]
Sent: Wednesday, September 14, 2016 12:15 PM
To: Aleksandar Markovic
Cc: QEMU Developers; Riku Voipio; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues

On 14 September 2016 at 16:21, Aleksandar Markovic
<aleksandar.markovic@rt-rk.com> wrote:
> This series fix certain Qemu user mode issues. The fixes mainly originate
> from observation of LTP tests failures for execution in Qemu user mode
> on various platforms. The series also contains four cleanup patches.

>   linux-user: Remove tabs and trailing spaces from linux-user/main.c
>   linux-user: Improve braces-related formatting in linux-user/main.c
>   linux-user: Improve usage of spaces in linux-user/main.c

I'm pretty sure these are going to conflict with the various
other linux-user patches currently in-flight, so I'm not sure
they're a great idea right now. (In general awkward conflicts
with other stuff and loss of info from git blame is why we
don't often do whole-file coding style cleanups.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-09-14 20:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 15:21 [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-14 15:21 ` [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() " Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces " Aleksandar Markovic
2016-09-14 15:22 ` [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
2016-09-14 19:15 ` [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues Peter Maydell
2016-09-14 20:01   ` Aleksandar Markovic

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.