X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/323010d1c247d0097b2cdc79d1da143846461999..ee8d653e61f6bf76330b44acf9ded13fa9a89dcc:/src/kernel/context/context_private.hpp diff --git a/src/kernel/context/context_private.hpp b/src/kernel/context/context_private.hpp index b682232eb8..0bf2a78b0f 100644 --- a/src/kernel/context/context_private.hpp +++ b/src/kernel/context/context_private.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2019. 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. */ @@ -20,4 +20,14 @@ #define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)0 #endif +/* We are using the bottom of the stack to save some information, like the + * valgrind_stack_id. Define smx_context_usable_stack_size to give the remaining + * size for the stack. Round its value to a multiple of 16 (asan wants the stacks to be aligned this way). */ +#if HAVE_VALGRIND_H +#define smx_context_usable_stack_size \ + ((smx_context_stack_size - sizeof(unsigned int)) & ~0xf) /* for valgrind_stack_id */ +#else +#define smx_context_usable_stack_size (smx_context_stack_size & ~0xf) +#endif + #endif