glibc/sysdeps/unix/sysv/linux/i386/clone.S
Ulrich Drepper 831372e7c1 update from main archive 970127
1997-01-28 04:23  Ulrich Drepper  <drepper@cygnus.com>
	* version.h (VERSION): Bump to 2.0.1.
	* posix/getopt.c: Handle another problem introduced by the
	nonoption_flags array.  We must be able to work with reordered
	argv arrays.  Reported by Andreas Schwab.
1997-01-28 02:38  Ulrich Drepper  <drepper@cygnus.com>
	* sysdeps/unix/sysv/linux/i386/clone.S: Correct handling of new
1997-01-27 17:34  Thorsten Kukuk <kukuk@weber.uni-paderborn.de>
	* nis/rpcsvc/yp_prot.h: Correct definitions and types in file so
	that it works with yp.h.
1997-01-27 13:28  Ulrich Drepper  <drepper@cygnus.com>
	* malloc/malloc.h (__malloc_initialized) [_LIBC]: Define as
	__libc_malloc_initialized so that this variable is not shared with
	other users of GNU malloc.
	Suggested by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
	* mcheck.h: Correct typo.  Use malloc/ instead of new-malloc/.
	* sysdeps/i386/Makefile (CFLAGS-dl-load.c, CFLAGS-dl-reloc.c): New
	variables to prevent warnings.
	* sysdeps/i386/dl-machine.h (fixup): Add prototype and declare
	using attribute regparm.
	(ELF_MACHINE_RUNTIME_TRAMPOLINE): Rewrite so that no register
	is changed by the resolver code.
1997-01-14 14:20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* malloc/malloc.c (weak_variable): Define.
	(__malloc_initialize_hook, __free_hook, __malloc_hook, __realloc_hook,
	__memalign_hook): Make them weak definitions.
1997-01-26 11:35  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* sysdeps/unix/sysv/linux/getdents.c: Don't write beyond buffer
	limits, correctly take structure padding into account, use correct
	offset when resetting the stream, change heuristic to assume an
	average name length of 14 characters.
1997-01-25 18:06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	* sysdeps/unix/sysv/linux/alpha/termbits.h: Protect against multiple
	inclusion.
See ChangeLog.6 for earlier changes.
1997-01-28 03:59:29 +00:00

72 lines
2.1 KiB
ArmAsm

/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@tamu.edu)
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* clone() is even more special than fork() as it mucks with stacks
and invokes a function in the right context after its all over. */
#include <sysdep.h>
#define _ERRNO_H 1
#include <errnos.h>
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
.text
ENTRY(__clone)
/* Sanity check arguments. */
movl $-EINVAL,%eax
movl 4(%esp),%ecx /* no NULL function pointers */
testl %ecx,%ecx
jz syscall_error
movl 8(%esp),%ecx /* no NULL stack pointers */
testl %ecx,%ecx
jz syscall_error
/* Insert the argument onto the new stack. */
subl $8,%ecx
movl 16(%esp),%eax /* no negative argument counts */
movl %eax,4(%ecx)
/* Save the function pointer as the zeroth argument.
It will be popped off in the child in the ebx frobbing below. */
movl 4(%esp),%eax
movl %eax,0(%ecx)
/* Do the system call */
pushl %ebx
movl 16(%esp),%ebx
movl $SYS_ify(clone),%eax
int $0x80
popl %ebx
test %eax,%eax
jl syscall_error
jz thread_start
ret
thread_start:
subl %ebp,%ebp /* terminate the stack frame */
call *%ebx
pushl %eax
call JUMPTARGET (_exit)
PSEUDO_END (__clone)
weak_alias (__clone, clone)