source: rtems/testsuites/libtests/stackchk/blow.c @ feddcde

Last change on this file since feddcde was fe48400d, checked in by Sebastian Huber <sebastian.huber@…>, on Jan 9, 2019 at 9:04:01 AM

libtests/stackchk: Fix for 64-bit targets

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*  task1.c
2 *
3 *  This set of three tasks do some simple task switching for about
4 *  15 seconds and then call a routine to "blow the stack".
5 *
6 *  COPYRIGHT (c) 1989-2012.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/stackchk.h>
19
20#include "system.h"
21
22void blow_stack(void)
23{
24  Thread_Control *executing;
25  char *area;
26  volatile uintptr_t *low;
27  volatile uintptr_t *high;
28
29  executing = _Thread_Get_executing();
30
31  /*
32   *  Destroy the first and last 4 words of our stack area... Hope it
33   *  does not cause problems :)
34   */
35
36  area = (char *) executing->Start.Initial_stack.area;
37  low  = (uintptr_t *) area;
38  high = (uintptr_t *)
39    (area + executing->Start.Initial_stack.size - 4 * sizeof(*high));
40
41  low[0] = 0x11111111;
42  low[1] = 0x22222222;
43  low[2] = 0x33333333;
44  low[3] = 0x44444444;
45
46  high[0] = 0x55555555;
47  high[1] = 0x66666666;
48  high[2] = 0x77777777;
49  high[3] = 0x88888888;
50
51  rtems_stack_checker_report_usage();
52}
Note: See TracBrowser for help on using the repository browser.