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