Skip to contentSkip to conversation

Enable fork and MIPS64 specific changes in mq_open syscall

PATCH In review [email protected] 2 participants 2 messages Sep 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 Enable fork and MIPS64 specific changes in mq_open syscall

From: Khansa Butt <[email protected]>

---
 configure            |    1 +
 linux-user/syscall.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
configure +1 -0
index 5e45a43..8d39fda 100755
@@ -3286,6 +3286,7 @@ case "$target_arch2" in
     TARGET_ARCH=mips64
     TARGET_BASE_ARCH=mips
     echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
+    target_nptl="yes"
     target_phys_bits=64
     target_long_alignment=8
   ;;
linux-user/syscall.c +9 -2
index 6b73769..97ac9fb 100644
@@ -7799,10 +7799,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         {
             struct mq_attr posix_mq_attr;
 
+#if defined(TARGET_MIPS64)
+            arg2 = arg2 & 0xff;
+            arg2 = arg2 | 0x40;
+#endif
+
             p = lock_user_string(arg1 - 1);
-            if (arg4 != 0)
+            if (arg4 != 0) {
                 copy_from_user_mq_attr (&posix_mq_attr, arg4);
-            ret = get_errno(mq_open(p, arg2, arg3, &posix_mq_attr));
+                ret = get_errno(mq_open(p, arg2, arg3, &posix_mq_attr));
+            } else if (arg4 == 0)
+                ret = get_errno(mq_open(p, arg2, arg3, NULL));
             unlock_user (p, arg1, 0);
         }
         break;
Signature · 1 line
1.7.3.4
#1 lore raw

Am 28.09.2011 06:38, schrieb [email protected]:

Quoted 2 lines

From: Khansa Butt <[email protected]>

Please prefix the subject with "linux-user: ".
Where's the preceding 6 patches?

Patch description is missing.

Quoted 11 lines
---
 configure            |    1 +
 linux-user/syscall.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
configure +0 -0
index 5e45a43..8d39fda 100755

configure case "$target_arch2" in · line 3289

Quoted 4 lines
configure +1 -0
@@ -3286,6 +3286,7 @@ case "$target_arch2" in
     TARGET_ARCH=mips64
     TARGET_BASE_ARCH=mips
     echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
+    target_nptl="yes"

How is this related to the mq_open syscall?
If it isn't, please put it into a separate patch.

Quoted 8 lines
configure +0 -0
     target_phys_bits=64
     target_long_alignment=8
   ;;
linux-user/syscall.c +0 -0
index 6b73769..97ac9fb 100644

linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7804

Quoted 6 lines
linux-user/syscall.c +3 -0
@@ -7799,10 +7799,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         {
             struct mq_attr posix_mq_attr;
 
+#if defined(TARGET_MIPS64)
+            arg2 = arg2 & 0xff;
+            arg2 = arg2 | 0x40;

What's 0x40? Please use a define or enum instead of the magic number. I'd also humbly suggest to add inline comments (in addition to an appropriate description above) to explain *why* this is necessary and correct.

linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7812

Quoted 10 lines
linux-user/syscall.c +6 -2
+#endif
+
             p = lock_user_string(arg1 - 1);
-            if (arg4 != 0)
+            if (arg4 != 0) {
                 copy_from_user_mq_attr (&posix_mq_attr, arg4);
-            ret = get_errno(mq_open(p, arg2, arg3, &posix_mq_attr));
+                ret = get_errno(mq_open(p, arg2, arg3, &posix_mq_attr));
+            } else if (arg4 == 0)
+                ret = get_errno(mq_open(p, arg2, arg3, NULL));

Coding Style requires braces.

linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7815

Quoted 3 lines
linux-user/syscall.c +0 -0
             unlock_user (p, arg1, 0);
         }
         break;

Andreas