diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2005-06-21 20:16:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 22:07:32 -0400 |
commit | 60b2737de1b1ddfdb90f3ba622634eb49d6f3603 (patch) | |
tree | a352eda5ca213cdae0a2eabd6693b8a4f573e38f /arch/um/sys-x86_64 | |
parent | b77d6adc922b8bbf8b16b67f567958c42962cf88 (diff) |
[PATCH] uml: fix linkage of tt mode against NPTL
With Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
To make sure switcheroo() can execute when we remap all the executable
image, we used a trick to make it use a local copy of errno... this trick
does not work with NPTL glibc, only with LinuxThreads, so use another
(simpler) one to make it work anyway.
Hopefully, a lot improved thanks to merging with the version of Al Viro
(which had his part of problems, though, i.e. removing a fix to another
bug and not fixing the problem on i386).
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/unmap.c | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 608466ad6b22..2bc6f6849010 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -29,3 +29,5 @@ thunk.S-dir = lib | |||
29 | module.c-dir = kernel | 29 | module.c-dir = kernel |
30 | 30 | ||
31 | subdir- := util | 31 | subdir- := util |
32 | |||
33 | include arch/um/scripts/Makefile.unmap | ||
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c new file mode 100644 index 000000000000..bc7094cce47e --- /dev/null +++ b/arch/um/sys-x86_64/unmap.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <linux/mman.h> | ||
7 | #include <asm/unistd.h> | ||
8 | |||
9 | static int errno; | ||
10 | |||
11 | static inline _syscall2(int,munmap,void *,start,size_t,len) | ||
12 | static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset) | ||
13 | int switcheroo(int fd, int prot, void *from, void *to, int size) | ||
14 | { | ||
15 | if(munmap(to, size) < 0){ | ||
16 | return(-1); | ||
17 | } | ||
18 | if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ | ||
19 | return(-1); | ||
20 | } | ||
21 | if(munmap(from, size) < 0){ | ||
22 | return(-1); | ||
23 | } | ||
24 | return(0); | ||
25 | } | ||