2012-02-08 22:47:52 -06:00
|
|
|
#ifndef RUST_STACK_H
|
|
|
|
#define RUST_STACK_H
|
|
|
|
|
2012-02-27 17:42:22 -06:00
|
|
|
#include "memory_region.h"
|
|
|
|
|
2012-02-08 17:28:25 -06:00
|
|
|
struct stk_seg {
|
|
|
|
stk_seg *prev;
|
|
|
|
stk_seg *next;
|
|
|
|
uintptr_t end;
|
|
|
|
unsigned int valgrind_id;
|
|
|
|
#ifndef _LP64
|
|
|
|
uint32_t pad;
|
|
|
|
#endif
|
|
|
|
|
2012-02-15 17:41:59 -06:00
|
|
|
uintptr_t canary;
|
|
|
|
|
2012-02-08 17:28:25 -06:00
|
|
|
uint8_t data[];
|
|
|
|
};
|
|
|
|
|
2012-02-08 22:47:52 -06:00
|
|
|
stk_seg *
|
2012-02-27 17:42:22 -06:00
|
|
|
create_stack(memory_region *region, size_t sz);
|
|
|
|
|
2012-02-08 22:47:52 -06:00
|
|
|
void
|
2012-02-27 17:42:22 -06:00
|
|
|
destroy_stack(memory_region *region, stk_seg *stk);
|
2012-02-08 22:47:52 -06:00
|
|
|
|
2012-02-10 13:42:33 -06:00
|
|
|
// Must be called before each time a stack is reused to tell valgrind
|
|
|
|
// that the stack is accessible.
|
2012-02-10 13:37:24 -06:00
|
|
|
void
|
2012-03-03 19:15:51 -06:00
|
|
|
reuse_valgrind_stack(stk_seg *stk, uint8_t *sp);
|
2012-02-10 13:37:24 -06:00
|
|
|
|
2012-02-10 13:42:33 -06:00
|
|
|
// Run a sanity check
|
2012-02-08 17:28:25 -06:00
|
|
|
void
|
|
|
|
check_stack_canary(stk_seg *stk);
|
2012-02-08 22:47:52 -06:00
|
|
|
|
|
|
|
#endif /* RUST_STACK_H */
|