From fe48400d5beeab7dfaf768dfd1476ab6b9c0101b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Jan 2019 10:04:01 +0100 Subject: libtests/stackchk: Fix for 64-bit targets --- testsuites/libtests/stackchk/blow.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'testsuites/libtests/stackchk') diff --git a/testsuites/libtests/stackchk/blow.c b/testsuites/libtests/stackchk/blow.c index 15ce0abfa6..3b8bb7842f 100644 --- a/testsuites/libtests/stackchk/blow.c +++ b/testsuites/libtests/stackchk/blow.c @@ -15,40 +15,28 @@ #include "config.h" #endif -#include #include -#include -#include -/* forward declarations to avoid warnings */ -void b(void); -void blow_stack(void); - -void b(void) -{ -} +#include "system.h" void blow_stack(void) { - volatile uint32_t *low, *high; - unsigned char *area; Thread_Control *executing; + char *area; + volatile uintptr_t *low; + volatile uintptr_t *high; - b(); + executing = _Thread_Get_executing(); /* - * Destroy the first and last 16 bytes of our stack... Hope it + * Destroy the first and last 4 words of our stack area... Hope it * does not cause problems :) */ - executing = _Thread_Get_executing(); - area = (unsigned char *)executing->Start.Initial_stack.area; - - /* Look in the stack checker implementation for this magic offset */ - low = (volatile uint32_t *) \ - (area + sizeof(Heap_Block) - HEAP_BLOCK_HEADER_SIZE); - high = (volatile uint32_t *) - (area + executing->Start.Initial_stack.size - 16); + area = (char *) executing->Start.Initial_stack.area; + low = (uintptr_t *) area; + high = (uintptr_t *) + (area + executing->Start.Initial_stack.size - 4 * sizeof(*high)); low[0] = 0x11111111; low[1] = 0x22222222; @@ -59,5 +47,6 @@ void blow_stack(void) high[1] = 0x66666666; high[2] = 0x77777777; high[3] = 0x88888888; + rtems_stack_checker_report_usage(); } -- cgit v1.2.3