rt: Rename config_valgrind_stack to register_valgrind_stack, etc

This commit is contained in:
Brian Anderson
2012-02-10 11:31:17 -08:00
parent dd0ae80e63
commit c42492e6aa
4 changed files with 10 additions and 16 deletions

View File

@@ -3,14 +3,8 @@
#include "vg/valgrind.h" #include "vg/valgrind.h"
#include "vg/memcheck.h" #include "vg/memcheck.h"
// A value that goes at the end of the stack and must not be touched
const uint8_t stack_canary[] = {0xAB, 0xCD, 0xAB, 0xCD,
0xAB, 0xCD, 0xAB, 0xCD,
0xAB, 0xCD, 0xAB, 0xCD,
0xAB, 0xCD, 0xAB, 0xCD};
void void
config_valgrind_stack(stk_seg *stk) { register_valgrind_stack(stk_seg *stk) {
stk->valgrind_id = stk->valgrind_id =
VALGRIND_STACK_REGISTER(&stk->data[0], VALGRIND_STACK_REGISTER(&stk->data[0],
stk->end); stk->end);
@@ -25,7 +19,7 @@ config_valgrind_stack(stk_seg *stk) {
} }
void void
unconfig_valgrind_stack(stk_seg *stk) { deregister_valgrind_stack(stk_seg *stk) {
VALGRIND_STACK_DEREGISTER(stk->valgrind_id); VALGRIND_STACK_DEREGISTER(stk->valgrind_id);
} }

View File

@@ -40,10 +40,10 @@ destroy_stack(T allocer, stk_seg *stk) {
} }
void void
config_valgrind_stack(stk_seg *stk); register_valgrind_stack(stk_seg *stk);
void void
unconfig_valgrind_stack(stk_seg *stk); deregister_valgrind_stack(stk_seg *stk);
void void
check_stack_canary(stk_seg *stk); check_stack_canary(stk_seg *stk);

View File

@@ -567,7 +567,7 @@ rust_task::new_stack(size_t requested_sz) {
LOG(this, mem, "reusing existing stack"); LOG(this, mem, "reusing existing stack");
stk = stk->prev; stk = stk->prev;
A(thread, stk->prev == NULL, "Bogus stack ptr"); A(thread, stk->prev == NULL, "Bogus stack ptr");
config_valgrind_stack(stk); register_valgrind_stack(stk);
return; return;
} else { } else {
LOG(this, mem, "existing stack is not big enough"); LOG(this, mem, "existing stack is not big enough");
@@ -598,7 +598,7 @@ rust_task::new_stack(size_t requested_sz) {
LOGPTR(thread, "stk end", new_stk->end); LOGPTR(thread, "stk end", new_stk->end);
stk = new_stk; stk = new_stk;
config_valgrind_stack(stk); register_valgrind_stack(stk);
total_stack_sz += user_stack_size(new_stk); total_stack_sz += user_stack_size(new_stk);
} }
@@ -626,7 +626,7 @@ rust_task::del_stack() {
old_stk->prev = NULL; old_stk->prev = NULL;
} }
unconfig_valgrind_stack(old_stk); deregister_valgrind_stack(old_stk);
if (delete_stack) { if (delete_stack) {
free_stack(old_stk); free_stack(old_stk);
A(thread, total_stack_sz == 0, "Stack size should be 0"); A(thread, total_stack_sz == 0, "Stack size should be 0");

View File

@@ -290,7 +290,7 @@ rust_task_thread::start_main_loop() {
I(this, !extra_c_stack); I(this, !extra_c_stack);
if (cached_c_stack) { if (cached_c_stack) {
unconfig_valgrind_stack(cached_c_stack); deregister_valgrind_stack(cached_c_stack);
destroy_stack(kernel, cached_c_stack); destroy_stack(kernel, cached_c_stack);
cached_c_stack = NULL; cached_c_stack = NULL;
} }
@@ -372,14 +372,14 @@ rust_task_thread::prepare_c_stack() {
I(this, !extra_c_stack); I(this, !extra_c_stack);
if (!cached_c_stack) { if (!cached_c_stack) {
cached_c_stack = create_stack(kernel, C_STACK_SIZE); cached_c_stack = create_stack(kernel, C_STACK_SIZE);
config_valgrind_stack(cached_c_stack); register_valgrind_stack(cached_c_stack);
} }
} }
void void
rust_task_thread::unprepare_c_stack() { rust_task_thread::unprepare_c_stack() {
if (extra_c_stack) { if (extra_c_stack) {
unconfig_valgrind_stack(extra_c_stack); deregister_valgrind_stack(extra_c_stack);
destroy_stack(kernel, extra_c_stack); destroy_stack(kernel, extra_c_stack);
extra_c_stack = NULL; extra_c_stack = NULL;
} }