Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't even try to have ucontextes on windows.
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 4 Mar 2016 23:29:14 +0000 (00:29 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 4 Mar 2016 23:29:17 +0000 (00:29 +0100)
we don't care of the speed on that platform. Getting it working would
already be something.

Plus, the portability layer that this commit removes was segfaulting.

CMakeLists.txt
COPYING
src/include/mc/datatypes.h
src/include/mc/mc.h
src/include/xbt/win32_ucontext.h [deleted file]
src/simix/UContext.cpp
src/xbt/win32_ucontext.c [deleted file]
tools/cmake/DefinePackages.cmake
tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
tools/cmake/test_prog/prog_stacksetup.c

index dc7e76e..a052be4 100644 (file)
@@ -157,10 +157,6 @@ set(INCLUDES
   ${CMAKE_BINARY_DIR}/include
   )
 
-if(WIN32)
-  set(INCLUDES ${INCLUDES} ${CMAKE_HOME_DIRECTORY}/include/xbt ${CMAKE_HOME_DIRECTORY}/src/xbt) #for win32_ucontext.[ch]
-endif()
-
 if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
   set(INCLUDES ${INCLUDES} /usr/include/)
 endif()
diff --git a/COPYING b/COPYING
index 80daaf1..eae8979 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -90,36 +90,6 @@ include/xbt/mmalloc.h
 
 =========================================================================
 
-In order to use ucontext with windows platform we had those files :
-        src/xbt/win32_ucontext.c
-        src/include/xbt/win32_ucontext.h
-
-Their copyright is the following:
-
-/*
- *      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 SimGrid in the file LICENSE-LGPL-2.1;
- *      if not, write to the Free Software Foundation, Inc.,
- *      51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-=========================================================================
-
 Some examples for SMPI were borowed from an IBM test suite.
 Their copyright is the following:
 /**
index 401969f..2ae5063 100644 (file)
@@ -9,12 +9,7 @@
 
 #include <simgrid_config.h>
 #include <xbt/base.h>
-
-#ifdef _XBT_WIN32
-#  include <xbt/win32_ucontext.h>     /* context relative declarations */
-#else
-#  include <ucontext.h>           /* context relative declarations */
-#endif
+#include <ucontext.h>           /* context relative declarations */
 
 #if HAVE_MC
 #include <dwarf.h>
index e0eb414..02e23c8 100644 (file)
 #include <xbt/misc.h>
 #include <simgrid/simix.h>
 #include <simgrid/modelchecker.h> /* our public interface (and definition of HAVE_MC) */
-
-#ifdef _XBT_WIN32
-#  include <xbt/win32_ucontext.h>     /* context relative declarations */
-#else
-#  include <ucontext.h>           /* context relative declarations */
-#endif
+#include <ucontext.h>           /* context relative declarations */
 
 /* Maximum size of the application heap.
  *
diff --git a/src/include/xbt/win32_ucontext.h b/src/include/xbt/win32_ucontext.h
deleted file mode 100644 (file)
index 76360db..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) 2010, 2014. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/*
- *      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 SimGrid in the file LICENSE-LGPL-2.1;
- *      if not, write to the Free Software Foundation, Inc.,
- *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */  
-    
-#ifndef UCONTEXT_H
-#define UCONTEXT_H
-    
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <windows.h>
-    typedef struct __stack {
-  void *ss_sp;
-  size_t ss_size;
-  int ss_flags;
-} stack_t;
-typedef CONTEXT mcontext_t;
-typedef unsigned long __sigset_t;
-typedef struct __ucontext {
-  unsigned long int uc_flags;
-  struct __ucontext *uc_link;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  __sigset_t uc_sigmask;
-} ucontext_t;
-int getcontext(ucontext_t * ucp);
-int setcontext(const ucontext_t * ucp);
-int makecontext(ucontext_t *, void (*)(), int, ...);
-int swapcontext(ucontext_t *, const ucontext_t *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* UCONTEXT_H */
index 6d58316..7cb720a 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdarg.h>
 
 #include <functional>
+#include <ucontext.h>           /* context relative declarations */
 
 #include "xbt/parmap.h"
 #include "src/simix/smx_private.h"
 #include "src/context_sysv_config.h"        /* loads context system definitions */
 #include "mc/mc.h"
 
-#ifdef _XBT_WIN32
-#  include <xbt/win32_ucontext.h>     /* context relative declarations */
-#else
-#  include <ucontext.h>           /* context relative declarations */
-#endif
-
 /** Many integers are needed to store a pointer
  *
  * This is a bit paranoid about sizeof(smx_ctx_sysv_t) not being a multiple
diff --git a/src/xbt/win32_ucontext.c b/src/xbt/win32_ucontext.c
deleted file mode 100644 (file)
index 80dd2e5..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/*
- *      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 SimGrid in the file LICENSE-LGPL-2.1;
- *      if not, write to the Free Software Foundation, Inc.,
- *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */  
-    
-#include "xbt/win32_ucontext.h"
-
-int getcontext(ucontext_t * ucp) 
-{
-  int ret;
-  
-      /* Retrieve the full machine context */ 
-      ucp->uc_mcontext.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
-  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 * sizeof(void*);
-  if (sp < (char *) ucp->uc_stack.ss_sp) {
-    
-        /* errno = ENOMEM; */ 
-        return -1;
-  }
-  
-      /* Set the instruction and the stack pointer */
-  #if defined(_I_X86_) || defined(__i386) || defined(__i386__) || defined(_M_IX86)
-  ucp->uc_mcontext.Eip = (DWORD) func;
-  ucp->uc_mcontext.Esp = (DWORD) sp - sizeof(void*);
-  #elif defined(_IA64_) || defined(__ia64) || defined(__ia64__)
-  #  error "_IA64_"
-  #elif defined _AMD64_ || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
-  ucp->uc_mcontext.Rip = (DWORD64) func;
-  ucp->uc_mcontext.Rsp = (DWORD64) sp - sizeof(void*);
-  #else
-  #error "No architecture defined for Windows build."
-  #endif
-
-      /* Save/Restore the full machine context */ 
-      ucp->uc_mcontext.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
-  
-      /* Copy the arguments */ 
-      va_start(ap, argc);
-  for (i = 0; i < argc; i++) {
-    memcpy(sp, ap, sizeof(void*));
-    ap += sizeof(void*);
-    sp += sizeof(void*);
-  }
-  va_end(ap);
-  return 0;
-}
-
-int swapcontext(ucontext_t * oucp, const ucontext_t * ucp) 
-{
-  int ret;
-  if ((oucp == NULL) || (ucp == NULL)) {
-    
-        /*errno = EINVAL; */ 
-        return -1;
-  }
-  ret = getcontext(oucp);
-  if (ret == 0) {
-    ret = setcontext(ucp);
-  }
-  return ret;
-}
index bea0c44..626d21d 100644 (file)
@@ -13,7 +13,6 @@ set(EXTRA_DIST
   src/include/surf/datatypes.h
   src/include/surf/maxmin.h
   src/include/surf/surf.h
-  src/include/xbt/win32_ucontext.h
   src/include/xbt/wine_dbghelp.h
   src/msg/msg_private.h
   src/portable.h
@@ -107,7 +106,6 @@ set(EXTRA_DIST
   src/xbt/mmalloc/mmorecore.c
   src/xbt/mmalloc/mmprivate.h
   src/xbt/mmalloc/mrealloc.c
-  src/xbt/win32_ucontext.c
   tools/tesh/generate_tesh
   tools/lualib.patch
   teshsuite/lua/lua_platforms.tesh
@@ -801,7 +799,6 @@ if(WIN32)
     ${simgrid_sources}
     src/simix/ThreadContext.cpp
     src/simix/ThreadContext.hpp
-    src/xbt/win32_ucontext.c
     src/xbt/xbt_os_thread.c
     )
 endif()
index 1c39b5c..ef9e426 100644 (file)
@@ -6,22 +6,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-
-#ifdef _XBT_WIN32
-#include "xbt/win32_ucontext.h"
-#include "win32_ucontext.c"
-#else
 #include <ucontext.h>
-#endif
-
-void child(void);
 
 ucontext_t uc_child;
 ucontext_t uc_main;
 
-
-
-void child(void)
+static void child(void)
 {
   if (swapcontext(&uc_child, &uc_main) != 0)
     exit(2);
index f2a4461..0ae3568 100644 (file)
@@ -8,11 +8,6 @@
 #define _XOPEN_SOURCE 700
 #endif
 
-#ifdef _XBT_WIN32
-#include "xbt/win32_ucontext.h"
-#include "win32_ucontext.c"
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #endif
 
 #if defined(TEST_makecontext)
-#ifdef _XBT_WIN32
-#include "xbt/win32_ucontext.h"
-#else
 #include <ucontext.h>
 #endif
 
-#endif
 union alltypes {
   long l;
   double d;