makecontext.c (103406) | makecontext.c (131460) |
---|---|
1/* 2 * Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libc/i386/gen/makecontext.c 103406 2002-09-16 19:24:31Z mini $"); | 28__FBSDID("$FreeBSD: head/lib/libc/i386/gen/makecontext.c 131460 2004-07-02 14:19:44Z davidxu $"); |
29 30#include <sys/param.h> 31#include <sys/signal.h> 32#include <sys/ucontext.h> 33 34#include <errno.h> 35#include <stdarg.h> 36#include <stdlib.h> --- 108 unchanged lines hidden (view full) --- 145 *argp = (intptr_t)ucp; 146 147 /* 148 * Set the machine context to point to the top of the 149 * stack and the program counter to the context start 150 * wrapper. Note that setcontext() pushes the return 151 * address onto the top of the stack, so allow for this 152 * by adjusting the stack downward 1 slot. Also set | 29 30#include <sys/param.h> 31#include <sys/signal.h> 32#include <sys/ucontext.h> 33 34#include <errno.h> 35#include <stdarg.h> 36#include <stdlib.h> --- 108 unchanged lines hidden (view full) --- 145 *argp = (intptr_t)ucp; 146 147 /* 148 * Set the machine context to point to the top of the 149 * stack and the program counter to the context start 150 * wrapper. Note that setcontext() pushes the return 151 * address onto the top of the stack, so allow for this 152 * by adjusting the stack downward 1 slot. Also set |
153 * %ebp to point to the base of the stack where ucp | 153 * %esi to point to the base of the stack where ucp |
154 * is stored. 155 */ | 154 * is stored. 155 */ |
156 ucp->uc_mcontext.mc_ebp = (int)argp; | 156 ucp->uc_mcontext.mc_esi = (int)argp; 157 ucp->uc_mcontext.mc_ebp = 0; |
157 ucp->uc_mcontext.mc_esp = (int)stack_top + sizeof(caddr_t); 158 ucp->uc_mcontext.mc_eip = (int)_ctx_start; 159 } 160} | 158 ucp->uc_mcontext.mc_esp = (int)stack_top + sizeof(caddr_t); 159 ucp->uc_mcontext.mc_eip = (int)_ctx_start; 160 } 161} |