android_kernel_xiaomi_sm8350/arch/um/os-Linux
Jeff Dike 3c91735099 [PATCH] uml: thread creation tidying
fork on UML has always somewhat subtle.  The underlying cause has been the
need to initialize a stack for the new process.  The only portable way to
initialize a new stack is to set it as the alternate signal stack and take a
signal.  The signal handler does whatever initialization is needed and jumps
back to the original stack, where the fork processing is finished.  The basic
context switching mechanism is a jmp_buf for each process.  You switch to a
new process by longjmping to its jmp_buf.

Now that UML has its own implementation of setjmp and longjmp, and I can poke
around inside a jmp_buf without fear that libc will change the structure, a
much simpler mechanism is possible.  The jmpbuf can simply be initialized by
hand.

This eliminates -
	the need to set up and remove the alternate signal stack
	sending and handling a signal
	the signal blocking needed around the stack switching, since
there is no stack switching
	setting up the jmp_buf needed to jump back to the original
stack after the new one is set up

In addition, since jmp_buf is now defined by UML, and not by libc, it can be
embedded in the thread struct.  This makes it unnecessary to have it exist on
the stack, where it used to be.  It also simplifies interfaces, since the
switch jmp_buf used to be a void * inside the thread struct, and functions
which took it as an argument needed to define a jmp_buf variable and assign it
from the void *.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
..
drivers [PATCH] uml: const more data 2006-09-27 08:26:15 -07:00
include
skas [PATCH] uml: thread creation tidying 2006-09-27 08:26:16 -07:00
sys-i386 [PATCH] uml: stack usage reduction 2006-09-26 08:49:09 -07:00
sys-x86_64 [PATCH] uml: stack usage reduction 2006-09-26 08:49:09 -07:00
aio.c
elf_aux.c
file.c [PATCH] uml: add some EINTR protection 2006-07-10 13:24:24 -07:00
helper.c [PATCH] uml: Fix handling of failed execs of helpers 2006-09-26 08:49:06 -07:00
irq.c [PATCH] uml: Move signal handlers to arch code 2006-09-26 08:49:07 -07:00
main.c [PATCH] uml: Move signal handlers to arch code 2006-09-26 08:49:07 -07:00
Makefile [PATCH] uml: mark some tt-mode code 2006-09-27 08:26:16 -07:00
mem.c [PATCH] uml: Use ARRAY_SIZE more assiduously 2006-09-26 08:49:05 -07:00
process.c [PATCH] uml: Move signal handlers to arch code 2006-09-26 08:49:07 -07:00
sigio.c [PATCH] uml: SIGIO cleanups 2006-09-26 08:49:07 -07:00
signal.c [PATCH] uml: Remove unused variable 2006-09-26 08:49:08 -07:00
start_up.c [PATCH] uml: stack usage reduction 2006-09-26 08:49:09 -07:00
time.c [PATCH] uml: timer cleanups 2006-09-26 08:49:08 -07:00
tls.c [PATCH] uml: check for differences in host support 2006-03-31 12:18:52 -08:00
trap.c [PATCH] uml: Use klibc setjmp/longjmp 2006-09-26 08:49:05 -07:00
tt.c
tty_log.c
tty.c
uaccess.c [PATCH] uml: Use klibc setjmp/longjmp 2006-09-26 08:49:05 -07:00
umid.c [PATCH] uml: rename and improve actually_do_remove() 2006-07-01 09:56:03 -07:00
user_syms.c [PATCH] uml: export symbols added by GCC hardened 2006-05-01 18:17:45 -07:00
util.c [PATCH] uml: Use klibc setjmp/longjmp 2006-09-26 08:49:05 -07:00