File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: cf3e7f2f0bc560f761c4663b11abe41f844e09a2
2
+ refs/heads/master: 8d8b48a90196fdb52e4832b38a90340c4ea27048
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ CFG_GCCISH_LINK_FLAGS :=
7
7
# embedded into the executable, so use a no-op command.
8
8
CFG_DSYMUTIL := true
9
9
10
+ ifneq ($(CFG_VALGRIND ) ,)
11
+ CFG_GCCISH_CFLAGS += -DHAVE_VALGRIND
12
+ endif
13
+
10
14
ifneq ($(findstring freebsd,$(CFG_OSTYPE ) ) ,)
11
15
CFG_LIB_NAME =lib$(1 ) .so
12
16
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -I/usr/local/include
Original file line number Diff line number Diff line change 7
7
#include < inttypes.h>
8
8
#include < stdint.h>
9
9
10
+ #ifdef HAVE_VALGRIND
11
+ #include < valgrind/memcheck.h>
12
+ #endif
13
+
10
14
template <typename T>
11
15
T align_down (T sp)
12
16
{
@@ -44,7 +48,14 @@ class context {
44
48
// function being called causes the task to fail, then we have to avoid
45
49
// leaking space on the C stack.
46
50
inline void *alloc_stack (size_t nbytes) {
47
- return (void *)(align_down (regs.esp - nbytes));
51
+ uint32_t bot = regs.esp ;
52
+ uint32_t top = align_down (bot - nbytes);
53
+
54
+ #ifdef HAVE_VALGRIND
55
+ (void )VALGRIND_MAKE_MEM_UNDEFINED (top - 4 , bot - top + 4 );
56
+ #endif
57
+
58
+ return reinterpret_cast <void *>(top);
48
59
}
49
60
};
50
61
You can’t perform that action at this time.
0 commit comments