Patchwork [0/7] NPTL support for PPC, v2

login
register
mail settings
Submitter Martin Mohring
Date Aug. 4, 2009, 4:19 p.m.
Message ID <4A785FA5.2080807@opensuse.org>
Download mbox | patch
Permalink /patch/30727/
State Superseded
Headers show

Comments

Martin Mohring - Aug. 4, 2009, 4:19 p.m.
Nathan Froyd wrote:
> This patch series adds NPTL support in Linux user-mode emulation to
> 32-bit PowerPC targets.
>
> The main complication comes from implementing atomic instructions
> properly.  We chose to implement a simplistic model:
>
> - reserved loads record the value loaded;
>
> - conditional stores check that the memory at the effective address
>   contains the value loaded by the previous reserved load, in addition
>   to all other checks.  if so, the store succeeds; otherwise, it fails.
>
> It is possible to implement something more sophisticated using mprotect:
>
> - reserved loads write-protect the page from which the value is loaded;
>
> - regular stores to the page (through SIGSEGV handling) remove the write
>   protection (which is roughly how the architecture really works);
>
> - conditional stores fail if the page was not write-protected, in
>   addition to all other checks.  If the store succeeds, then the page is
>   unprotected.
>
> but the simple scheme works well enough and should be somewhat faster.
> The simple scheme is what's already done for system mode, too; it's even
> slightly dumber in system mode because we don't check for equality of
> values.
>
> malc asked me to compare the approach taken in this patch series versus
> an mprotect-based approach.  I did so, and found that there was no
> difference between the two and that this approach was faster (no
> surprise).
>
> The patch series has been tested against the glibc testsuite, where it
> passes a good chunk (90%+) of the testsuite.  The other 10% are
> basically things that are not going to work in QEMU anytime soon
> (e.g. sharing futexes between multiple processes, using clone(2)
> directly, etc.).
>
> This is an update to the patch series I sent a month or so ago; the
> changes are rather trivial: a formatting fix or two and a fix for a
> ppc64 compilation error.
>
> -Nathan
>
>
>   
Attached you will find an addon patch to activate uid16 also for powerpc
user mode linux.
It is needed because many distros i found use uid16 calls also on powerpc.

Cheers, Martin

Patch

diff -r -u qemu-0.11git2009.06.04.1212.orig/linux-user/ppc/syscall_nr.h qemu-0.11git2009.06.04.1212/linux-user/ppc/syscall_nr.h
--- qemu-0.11git2009.06.04.1212.orig/linux-user/ppc/syscall_nr.h	2009-04-25 15:24:45.000000000 +0200
+++ qemu-0.11git2009.06.04.1212/linux-user/ppc/syscall_nr.h	2009-06-05 20:15:32.047746675 +0200
@@ -17,15 +17,15 @@ 
 #define TARGET_NR_time                    13
 #define TARGET_NR_mknod                   14
 #define TARGET_NR_chmod                   15
-#define TARGET_NR_lchown32                16
+#define TARGET_NR_lchown                  16
 #define TARGET_NR_break                   17
 #define TARGET_NR_oldstat                 18
 #define TARGET_NR_lseek                   19
 #define TARGET_NR_getpid                  20
 #define TARGET_NR_mount                   21
 #define TARGET_NR_umount                  22
-#define TARGET_NR_setuid32                23
-#define TARGET_NR_getuid32                24
+#define TARGET_NR_setuid                  23
+#define TARGET_NR_getuid                  24
 #define TARGET_NR_stime                   25
 #define TARGET_NR_ptrace                  26
 #define TARGET_NR_alarm                   27
@@ -47,11 +47,11 @@ 
 #define TARGET_NR_times                   43
 #define TARGET_NR_prof                    44
 #define TARGET_NR_brk                     45
-#define TARGET_NR_setgid32                46
-#define TARGET_NR_getgid32                47
+#define TARGET_NR_setgid                  46
+#define TARGET_NR_getgid                  47
 #define TARGET_NR_signal                  48
-#define TARGET_NR_geteuid32               49
-#define TARGET_NR_getegid32               50
+#define TARGET_NR_geteuid                 49
+#define TARGET_NR_getegid                 50
 #define TARGET_NR_acct                    51
 #define TARGET_NR_umount2                 52
 #define TARGET_NR_lock                    53
@@ -71,8 +71,8 @@ 
 #define TARGET_NR_sigaction               67
 #define TARGET_NR_sgetmask                68
 #define TARGET_NR_ssetmask                69
-#define TARGET_NR_setreuid32              70
-#define TARGET_NR_setregid32              71
+#define TARGET_NR_setreuid                70
+#define TARGET_NR_setregid                71
 #define TARGET_NR_sigsuspend              72
 #define TARGET_NR_sigpending              73
 #define TARGET_NR_sethostname             74
@@ -81,8 +81,8 @@ 
 #define TARGET_NR_getrusage               77
 #define TARGET_NR_gettimeofday            78
 #define TARGET_NR_settimeofday            79
-#define TARGET_NR_getgroups32             80
-#define TARGET_NR_setgroups32             81
+#define TARGET_NR_getgroups               80
+#define TARGET_NR_setgroups               81
 #define TARGET_NR_select                  82
 #define TARGET_NR_symlink                 83
 #define TARGET_NR_oldlstat                84
@@ -96,7 +96,7 @@ 
 #define TARGET_NR_truncate                92
 #define TARGET_NR_ftruncate               93
 #define TARGET_NR_fchmod                  94
-#define TARGET_NR_fchown32                95
+#define TARGET_NR_fchown                  95
 #define TARGET_NR_getpriority             96
 #define TARGET_NR_setpriority             97
 #define TARGET_NR_profil                  98
@@ -139,8 +139,8 @@ 
 #define TARGET_NR_sysfs                  135
 #define TARGET_NR_personality            136
 #define TARGET_NR_afs_syscall            137 /* Syscall for Andrew File System */
-#define TARGET_NR_setfsuid32             138
-#define TARGET_NR_setfsgid32             139
+#define TARGET_NR_setfsuid               138
+#define TARGET_NR_setfsgid               139
 #define TARGET_NR__llseek                140
 #define TARGET_NR_getdents               141
 #define TARGET_NR__newselect             142
@@ -182,7 +182,7 @@ 
 #define TARGET_NR_rt_sigsuspend          178
 #define TARGET_NR_pread64                179
 #define TARGET_NR_pwrite64               180
-#define TARGET_NR_chown32                181
+#define TARGET_NR_chown                  181
 #define TARGET_NR_getcwd                 182
 #define TARGET_NR_capget                 183
 #define TARGET_NR_capset                 184
diff -r -u qemu-0.11git2009.06.16.1935/linux-user/syscall_defs.h qemu-0.11git2009.06.16.1935.new/linux-user/syscall_defs.h
--- qemu-0.11git2009.06.16.1935/linux-user/syscall_defs.h	2009-06-17 00:35:05.000000000 +0200
+++ qemu-0.11git2009.06.16.1935.new/linux-user/syscall_defs.h	2009-06-17 01:28:28.000000000 +0200
@@ -49,7 +49,7 @@ 
 #define TARGET_IOC_TYPEBITS	8
 
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
-    || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
+    || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) || defined(TARGET_PPC)
     /* 16 bit uid wrappers emulation */
 #define USE_UID16
 #endif