X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9d85ead7a4eb80631f931e45d894a446c7e73bb6..1c10206dfec917be0f5b3f4964f82b0c959436e2:/src/win32/win32_ucontext_src/ucontext.c diff --git a/src/win32/win32_ucontext_src/ucontext.c b/src/win32/win32_ucontext_src/ucontext.c deleted file mode 100644 index f95aadab02..0000000000 --- a/src/win32/win32_ucontext_src/ucontext.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * win32-ucontext: Unix ucontext_t operations on Windows platforms - * Copyright(C) 2007 Panagiotis E. Hadjidoukas - * - * Contact Email: phadjido@cs.uoi.gr, xdoukas@ceid.upatras.gr - * - * win32-ucontext is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * win32-ucontext 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with QueueUserAPCEx in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "ucontext.h" - -int getcontext(ucontext_t *ucp) -{ - int ret; - - /* Retrieve the full machine context */ - ucp->uc_mcontext.ContextFlags = CONTEXT_FULL; - ret = GetThreadContext(GetCurrentThread(), &ucp->uc_mcontext); - - return (ret == 0) ? -1: 0; -} - -int setcontext(const ucontext_t *ucp) -{ - int ret; - - /* Restore the full machine context (already set) */ - ret = SetThreadContext(GetCurrentThread(), &ucp->uc_mcontext); - - return (ret == 0) ? -1: 0; -} - -int makecontext(ucontext_t *ucp, void (*func)(), int argc, ...) -{ - int i; - va_list ap; - char *sp; - - /* Stack grows down */ - sp = (char *) (size_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size; - - /* Reserve stack space for the arguments (maximum possible: argc*(8 bytes per argument)) */ - sp -= argc*8; - - if ( sp < (char *)ucp->uc_stack.ss_sp) { - /* errno = ENOMEM;*/ - return -1; - } - - /* Set the instruction and the stack pointer */ - ucp->uc_mcontext.Eip = (unsigned long) func; - ucp->uc_mcontext.Esp = (unsigned long) sp - 4; - - /* Save/Restore the full machine context */ - ucp->uc_mcontext.ContextFlags = CONTEXT_FULL; - - /* Copy the arguments */ - va_start (ap, argc); - for (i=0; i