mirror of git://sourceware.org/git/glibc.git
tile: make the prolog of clone() more conformant
With this change we properly set up the frame first, and tear it down last, doing argument checking only when the frame is set up.
This commit is contained in:
parent
d9cd52e64d
commit
83d641efd1
|
@ -1,5 +1,8 @@
|
||||||
2014-10-02 Chris Metcalf <cmetcalf@tilera.com>
|
2014-10-02 Chris Metcalf <cmetcalf@tilera.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/tile/clone.S (__clone): Fix code
|
||||||
|
to set up frame more cleanly.
|
||||||
|
|
||||||
* sysdeps/tile/memcmp.c: New file.
|
* sysdeps/tile/memcmp.c: New file.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/tile/sysconf.c: New file.
|
* sysdeps/unix/sysv/linux/tile/sysconf.c: New file.
|
||||||
|
|
|
@ -41,10 +41,6 @@
|
||||||
|
|
||||||
.text
|
.text
|
||||||
ENTRY (__clone)
|
ENTRY (__clone)
|
||||||
/* sanity check arguments */
|
|
||||||
BEQZ r0, .Linvalid
|
|
||||||
BEQZ r1, .Linvalid
|
|
||||||
|
|
||||||
/* Create a stack frame so we can pass callee-saves to new task. */
|
/* Create a stack frame so we can pass callee-saves to new task. */
|
||||||
{
|
{
|
||||||
move r10, sp
|
move r10, sp
|
||||||
|
@ -71,6 +67,10 @@ ENTRY (__clone)
|
||||||
ST r11, r32
|
ST r11, r32
|
||||||
cfi_offset (r32, FRAME_R32 - FRAME_SIZE)
|
cfi_offset (r32, FRAME_R32 - FRAME_SIZE)
|
||||||
|
|
||||||
|
/* sanity check arguments */
|
||||||
|
BEQZ r0, .Linvalid
|
||||||
|
BEQZ r1, .Linvalid
|
||||||
|
|
||||||
/* Make sure child stack is properly aligned, and set up the
|
/* Make sure child stack is properly aligned, and set up the
|
||||||
top frame so that we can call out of it immediately in the
|
top frame so that we can call out of it immediately in the
|
||||||
child. Setting it up here means we fault in the parent if
|
child. Setting it up here means we fault in the parent if
|
||||||
|
@ -120,6 +120,7 @@ ENTRY (__clone)
|
||||||
swint1
|
swint1
|
||||||
BEQZ r0, .Lthread_start /* If in child task. */
|
BEQZ r0, .Lthread_start /* If in child task. */
|
||||||
|
|
||||||
|
.Ldone:
|
||||||
/* Restore the callee-saved registers and return. */
|
/* Restore the callee-saved registers and return. */
|
||||||
ADDLI_PTR lr, sp, FRAME_SIZE
|
ADDLI_PTR lr, sp, FRAME_SIZE
|
||||||
{
|
{
|
||||||
|
@ -149,7 +150,7 @@ ENTRY (__clone)
|
||||||
.Linvalid:
|
.Linvalid:
|
||||||
{
|
{
|
||||||
movei r1, EINVAL
|
movei r1, EINVAL
|
||||||
j SYSCALL_ERROR_NAME
|
j .Ldone
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function expects to receive:
|
/* This function expects to receive:
|
||||||
|
|
Loading…
Reference in New Issue