Commit cb0cd969 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] fix ppc64 in kernel syscalls

Thanks to some great debugging work by Olaf Hering and Marcus Meissner
it has been noticed that the current ppc64 syscall code is corrupting
4 bytes past errno. Why we even bothered to set errno beats me, its
unusable in the kernel.

Since we had to reinstate the inline syscall code we can go back to
using it for those few syscalls that we call. Especially now with
Randy's syscall prototype cleanup we should be calling them directly
but we can do that sometime later.
parent f644f166
......@@ -565,35 +565,6 @@ _GLOBAL(kernel_thread)
ld r30,-16(r1)
blr
.section ".toc","aw"
.SYSCALL_ERRNO:
.tc errno[TC],errno
.section ".text"
.align 3
#define SYSCALL(name) \
_GLOBAL(name) \
li r0,__NR_##name; \
sc; \
bnslr; \
ld r4,.SYSCALL_ERRNO@toc(2); \
std r3,0(r4); \
li r3,-1; \
blr
#define __NR__exit __NR_exit
SYSCALL(setsid)
SYSCALL(open)
SYSCALL(read)
SYSCALL(write)
SYSCALL(lseek)
SYSCALL(close)
SYSCALL(dup)
SYSCALL(execve)
SYSCALL(waitpid)
#ifdef CONFIG_PPC_ISERIES /* hack hack hack */
#define ppc_rtas sys_ni_syscall
#endif
......
......@@ -399,15 +399,19 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
/*
* System call prototypes.
*/
extern pid_t setsid(void);
extern int write(int fd, const char *buf, off_t count);
extern int read(int fd, char *buf, off_t count);
extern off_t lseek(int fd, off_t offset, int count);
extern int dup(int fd);
extern int execve(const char *file, char **argv, char **envp);
extern int open(const char *file, int flag, int mode);
extern int close(int fd);
extern pid_t waitpid(pid_t pid, int *wait_stat, int options);
static inline _syscall3(int, execve, __const__ char *, file, char **, argv,
char **,envp)
static inline _syscall3(int, open, __const__ char *, file, int, flag, int, mode)
static inline _syscall1(int, close, int, fd)
static inline _syscall1(int, dup, int, fd)
static inline _syscall3(int, read, int, fd, char *, buf , off_t, count)
static inline _syscall3(int, write, int, fd, __const__ char *, buf, off_t,
count)
static inline _syscall0(pid_t, setsid)
static inline _syscall3(off_t, lseek, int, fd, off_t, offset, int, count)
static inline _syscall3(pid_t, waitpid, pid_t, pid, int *, wait_stat, int,
options)
#endif /* __KERNEL_SYSCALLS__ */
asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment