Commit 6fc15485 authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

ppc64: Fix broken SYS V shared memory support

The initial support of the SYS V shared memory on ppc64 is broken. The call
to shmat done in the restore blob has no chance to work correctly.

This patch fixes the sys_shmat call.
Signed-off-by: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7197aff7
......@@ -131,6 +131,6 @@ static inline int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe,
/*
* Defined in arch/ppc64/syscall-common-ppc64.S
*/
int sys_shmat(int shmid, const void *shmaddr, int shmflg);
unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg);
#endif /*__CR_ASM_RESTORER_H__*/
......@@ -6,9 +6,26 @@
#include "syscall.h"
#include "log.h"
//#include "cpu.h"
int restore_nonsigframe_gpregs(UserPpc64RegsEntry *r)
{
return 0;
}
unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg)
{
unsigned long raddr;
int ret;
ret = sys_ipc(21 /*SHMAT */,
shmid, /* first */
shmflg, /* second */
(unsigned long)&raddr, /* third */
shmaddr, /* ptr */
0 /* fifth not used */);
if (ret)
raddr = (unsigned long) ret;
return raddr;
}
......@@ -22,11 +22,3 @@ ENTRY(__cr_restore_rt)
b __syscall_common
END(__cr_restore_rt)
# On Power, shmat is done through the ipc system call.
ENTRY(sys_shmat)
mr r7, r4 # shmaddr -> ptr
mr r4, r3 # shmid -> first
li r3, 21 # call = SHMAT
li r0, __NR_ipc
b __syscall_common
END(sys_shmat)
......@@ -98,3 +98,4 @@ __NR_kcmp 354 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1,
__NR_memfd_create 360 sys_memfd_create (const char *name, unsigned int flags)
__NR_io_setup 227 sys_io_setup (unsigned nr_events, aio_context_t *ctx_idp)
__NR_io_getevents 229 sys_io_getevents (aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout)
__NR_ipc 117 sys_ipc (unsigned int call, int first, unsigned long second, unsigned long third, const void *ptr, long fifth)
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