aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-10-02 05:18:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:23 -0400
commit5f4c6bc1f369f20807a8e753c2308d1629478c61 (patch)
treea4845eeddcb540309c5890cb94de52ce845e0760
parentfe74290d51bc08e9b90ed7c145d74a22cd50b90e (diff)
[PATCH] Remove the use of _syscallX macros in UML
User mode linux uses _syscallX() to call into the host kernel. The recommended way to do this is to use the syscall() function from libc. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Andi Kleen <ak@muc.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Mikael Starvik <starvik@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Hirokazu Takata <takata.hirokazu@renesas.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Richard Curnow <rc@rc0.org.uk> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Cc: Chris Zankel <chris@zankel.net> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/os-Linux/process.c5
-rw-r--r--arch/um/os-Linux/sys-i386/tls.c5
-rw-r--r--arch/um/os-Linux/tls.c8
-rw-r--r--arch/um/sys-i386/unmap.c11
-rw-r--r--arch/um/sys-x86_64/unmap.c11
5 files changed, 15 insertions, 25 deletions
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index ff203625a4bd..51f0893640a6 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -11,6 +11,7 @@
11#include <sys/mman.h> 11#include <sys/mman.h>
12#include <sys/wait.h> 12#include <sys/wait.h>
13#include <sys/mman.h> 13#include <sys/mman.h>
14#include <sys/syscall.h>
14#include "ptrace_user.h" 15#include "ptrace_user.h"
15#include "os.h" 16#include "os.h"
16#include "user.h" 17#include "user.h"
@@ -140,11 +141,9 @@ void os_usr1_process(int pid)
140 * syscalls, and also breaks with clone(), which does not unshare the TLS. 141 * syscalls, and also breaks with clone(), which does not unshare the TLS.
141 */ 142 */
142 143
143inline _syscall0(pid_t, getpid)
144
145int os_getpid(void) 144int os_getpid(void)
146{ 145{
147 return(getpid()); 146 return(syscall(__NR_getpid));
148} 147}
149 148
150int os_getpgrp(void) 149int os_getpgrp(void)
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c
index 120abbe4e3ce..6e945ab45843 100644
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ b/arch/um/os-Linux/sys-i386/tls.c
@@ -1,10 +1,9 @@
1#include <errno.h> 1#include <errno.h>
2#include <linux/unistd.h> 2#include <linux/unistd.h>
3#include <sys/syscall.h>
3#include "sysdep/tls.h" 4#include "sysdep/tls.h"
4#include "user_util.h" 5#include "user_util.h"
5 6
6static _syscall1(int, get_thread_area, user_desc_t *, u_info);
7
8/* Checks whether host supports TLS, and sets *tls_min according to the value 7/* Checks whether host supports TLS, and sets *tls_min according to the value
9 * valid on the host. 8 * valid on the host.
10 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ 9 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */
@@ -17,7 +16,7 @@ void check_host_supports_tls(int *supports_tls, int *tls_min) {
17 user_desc_t info; 16 user_desc_t info;
18 info.entry_number = val[i]; 17 info.entry_number = val[i];
19 18
20 if (get_thread_area(&info) == 0) { 19 if (syscall(__NR_get_thread_area, &info) == 0) {
21 *tls_min = val[i]; 20 *tls_min = val[i];
22 *supports_tls = 1; 21 *supports_tls = 1;
23 return; 22 return;
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
index 9cb09a45546b..a2de2580b8af 100644
--- a/arch/um/os-Linux/tls.c
+++ b/arch/um/os-Linux/tls.c
@@ -1,5 +1,6 @@
1#include <errno.h> 1#include <errno.h>
2#include <sys/ptrace.h> 2#include <sys/ptrace.h>
3#include <sys/syscall.h>
3#include <asm/ldt.h> 4#include <asm/ldt.h>
4#include "sysdep/tls.h" 5#include "sysdep/tls.h"
5#include "uml-config.h" 6#include "uml-config.h"
@@ -48,14 +49,11 @@ int os_get_thread_area(user_desc_t *info, int pid)
48#ifdef UML_CONFIG_MODE_TT 49#ifdef UML_CONFIG_MODE_TT
49#include "linux/unistd.h" 50#include "linux/unistd.h"
50 51
51static _syscall1(int, get_thread_area, user_desc_t *, u_info);
52static _syscall1(int, set_thread_area, user_desc_t *, u_info);
53
54int do_set_thread_area_tt(user_desc_t *info) 52int do_set_thread_area_tt(user_desc_t *info)
55{ 53{
56 int ret; 54 int ret;
57 55
58 ret = set_thread_area(info); 56 ret = syscall(__NR_set_thread_area,info);
59 if (ret < 0) { 57 if (ret < 0) {
60 ret = -errno; 58 ret = -errno;
61 } 59 }
@@ -66,7 +64,7 @@ int do_get_thread_area_tt(user_desc_t *info)
66{ 64{
67 int ret; 65 int ret;
68 66
69 ret = get_thread_area(info); 67 ret = syscall(__NR_get_thread_area,info);
70 if (ret < 0) { 68 if (ret < 0) {
71 ret = -errno; 69 ret = -errno;
72 } 70 }
diff --git a/arch/um/sys-i386/unmap.c b/arch/um/sys-i386/unmap.c
index 1b0ad0e4adcd..8e55cd5d3d07 100644
--- a/arch/um/sys-i386/unmap.c
+++ b/arch/um/sys-i386/unmap.c
@@ -5,20 +5,17 @@
5 5
6#include <linux/mman.h> 6#include <linux/mman.h>
7#include <asm/unistd.h> 7#include <asm/unistd.h>
8#include <sys/syscall.h>
8 9
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size) 10int switcheroo(int fd, int prot, void *from, void *to, int size)
14{ 11{
15 if(munmap(to, size) < 0){ 12 if (syscall(__NR_munmap, to, size) < 0){
16 return(-1); 13 return(-1);
17 } 14 }
18 if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){ 15 if (syscall(__NR_mmap2, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
19 return(-1); 16 return(-1);
20 } 17 }
21 if(munmap(from, size) < 0){ 18 if (syscall(__NR_munmap, from, size) < 0){
22 return(-1); 19 return(-1);
23 } 20 }
24 return(0); 21 return(0);
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c
index f4a4bffd8a18..57c9286a701b 100644
--- a/arch/um/sys-x86_64/unmap.c
+++ b/arch/um/sys-x86_64/unmap.c
@@ -5,20 +5,17 @@
5 5
6#include <linux/mman.h> 6#include <linux/mman.h>
7#include <asm/unistd.h> 7#include <asm/unistd.h>
8#include <sys/syscall.h>
8 9
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size) 10int switcheroo(int fd, int prot, void *from, void *to, int size)
14{ 11{
15 if(munmap(to, size) < 0){ 12 if (syscall(__NR_munmap, to, size) < 0){
16 return(-1); 13 return(-1);
17 } 14 }
18 if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){ 15 if (syscall(__NR_mmap, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
19 return(-1); 16 return(-1);
20 } 17 }
21 if(munmap(from, size) < 0){ 18 if (syscall(__NR_munmap, from, size) < 0){
22 return(-1); 19 return(-1);
23 } 20 }
24 return(0); 21 return(0);