mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-20 17:51:16 +00:00
2000-04-13 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/mips/clone.S: Fix functions.
This commit is contained in:
parent
985286e05b
commit
d152663e8a
@ -26,25 +26,18 @@
|
|||||||
#define _ERRNO_H 1
|
#define _ERRNO_H 1
|
||||||
#include <bits/errno.h>
|
#include <bits/errno.h>
|
||||||
|
|
||||||
/* int clone(int (*fn)(), void *child_stack, int flags, void *arg) */
|
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
|
||||||
|
|
||||||
#define FRAMESZ 8*SZREG
|
|
||||||
#if _MIPS_SIM == _MIPS_SIM_ABI32
|
|
||||||
#define MAX_REG_ARGS 4
|
|
||||||
#else
|
|
||||||
#define MAX_REG_ARGS 6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
NESTED(__clone,FRAMESZ,sp)
|
NESTED(__clone,4*SZREG,sp)
|
||||||
#ifdef __PIC__
|
#ifdef __PIC__
|
||||||
.set noreorder
|
.set noreorder
|
||||||
.cpload $25
|
.cpload $25
|
||||||
.set reorder
|
.set reorder
|
||||||
PTR_SUBIU sp,FRAMESZ
|
subu sp,32
|
||||||
.cprestore SZREG*4
|
.cprestore 16
|
||||||
#else
|
#else
|
||||||
PTR_SUBIU sp,FRAMESZ
|
subu sp,32
|
||||||
#endif
|
#endif
|
||||||
#ifdef PROF
|
#ifdef PROF
|
||||||
.set noat
|
.set noat
|
||||||
@ -53,17 +46,15 @@ NESTED(__clone,FRAMESZ,sp)
|
|||||||
.set at
|
.set at
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
REG_S s0,FRAMESZ-SZREG*2(sp)
|
|
||||||
REG_S s1,FRAMESZ-SZREG*3(sp)
|
|
||||||
/* Sanity check arguments. */
|
/* Sanity check arguments. */
|
||||||
li v0,EINVAL
|
li v0,EINVAL
|
||||||
beqz a0,error /* no NULL function pointers */
|
beqz a0,error /* No NULL function pointers. */
|
||||||
beqz a1,error /* no NULL stack pointers */
|
beqz a1,error /* No NULL stack pointers. */
|
||||||
|
|
||||||
/* Allocate space on the new stack and copy args over */
|
subu a1,32 /* Reserve argument save space. */
|
||||||
/* Save the arg for user's function */
|
sw a0,0(a1) /* Save function pointer. */
|
||||||
move s0,a3 /* Save arg __thread_start. */
|
sw a3,4(a1) /* Save argument pointer. */
|
||||||
move s1,a0 /* Save func. pointer. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Do the system call */
|
/* Do the system call */
|
||||||
@ -75,16 +66,12 @@ NESTED(__clone,FRAMESZ,sp)
|
|||||||
beqz v0,__thread_start
|
beqz v0,__thread_start
|
||||||
|
|
||||||
/* Successful return from the parent */
|
/* Successful return from the parent */
|
||||||
REG_L s0,FRAMESZ-SZREG*2(sp)
|
addiu sp,32
|
||||||
REG_L s1,FRAMESZ-SZREG*3(sp)
|
|
||||||
PTR_ADDIU sp,FRAMESZ
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/* Something bad happened -- no child created */
|
/* Something bad happened -- no child created */
|
||||||
error:
|
error:
|
||||||
REG_L s0,FRAMESZ-SZREG*2(sp)
|
addiu sp,32
|
||||||
REG_L s1,FRAMESZ-SZREG*3(sp)
|
|
||||||
PTR_ADDIU sp,FRAMESZ
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
la t9,__syscall_error
|
la t9,__syscall_error
|
||||||
jr t9
|
jr t9
|
||||||
@ -100,10 +87,11 @@ error:
|
|||||||
At this point we have s0=arg, s1=fn. */
|
At this point we have s0=arg, s1=fn. */
|
||||||
|
|
||||||
NESTED(__thread_start,FRAMESZ,sp)
|
NESTED(__thread_start,FRAMESZ,sp)
|
||||||
|
/* cp is already loaded. */
|
||||||
/* The stackframe has been created on entry of clone(). */
|
/* The stackframe has been created on entry of clone(). */
|
||||||
/* Resort the arg for user's function. */
|
/* Resort the arg for user's function. */
|
||||||
move a0,s0
|
move a0,0(sp) /* Function pointer. */
|
||||||
move t9,s1
|
move t9,4(sp) /* Argument pointer. */
|
||||||
|
|
||||||
/* Call the user's function. */
|
/* Call the user's function. */
|
||||||
jalr t9
|
jalr t9
|
||||||
|
Loading…
Reference in New Issue
Block a user