Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 570e3e23 authored by Michal Simek's avatar Michal Simek
Browse files

microblaze: Fix sys_clone syscall



sys_clone syscall ignored args which this patch mapped to args
which are passing from glibc.

Here is the origin problem description.

"I ran the static libgcc tests (very few of them are there, they are
mostly dynamically linked) and some of  them fail with an assertion in
fork() system call (tid != pid), I looked at the microblaze/entry.S
file and it looks suspicious (ignores arguments 3-5)"

Arg mapping should be:
glibc ARCH_FORK(...) -> do_fork(...)
r5 -> r5   (clone_flags)
r6  -> r6 (stack_start, use parent->stack if NULL)
pt_regs -> r7 (pt_regs)
r7 -> r8 (stack_size)
r8 -> r9 (parent_tidptr)
r9 -> r10 (child_tidptr)

Signed-off-by: default avatarJohn Williams <john.williams@petalogix.com>
Signed-off-by: default avatarMichal Simek <monstr@monstr.eu>
parent 79aac889
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -477,12 +477,12 @@ C_ENTRY(sys_vfork):
C_ENTRY(sys_clone):
C_ENTRY(sys_clone):
	bnei	r6, 1f;			/* See if child SP arg (arg 1) is 0. */
	bnei	r6, 1f;			/* See if child SP arg (arg 1) is 0. */
	lwi	r6, r1, PTO + PT_R1;	/* If so, use paret's stack ptr */
	lwi	r6, r1, PTO + PT_R1;	/* If so, use paret's stack ptr */
1:	la	r7, r1, PTO;			/* Arg 2: parent context */
1:	add	r10, r0, r9;		/* Arg 6: (child_tidptr) */
	add	r8, r0, r0;			/* Arg 3: (unused) */
	add	r9, r0, r8;		/* Arg 5: (parent_tidptr) */
	add	r9, r0, r0;			/* Arg 4: (unused) */
	add	r8, r0, r7;		/* Arg 4: (stack_size) */
	add	r10, r0, r0;			/* Arg 5: (unused) */
	la	r7, r1, PTO;		/* Arg 3: pt_regs  */
	brid	do_fork			/* Do real work (tail-call) */
	brid	do_fork			/* Do real work (tail-call) */
	nop;
	nop


C_ENTRY(sys_execve):
C_ENTRY(sys_execve):
	la	r8, r1, PTO;		/* add user context as 4th arg */
	la	r8, r1, PTO;		/* add user context as 4th arg */