source: rtems/testsuites/libtests/stackchk/blow.c @ 63f871f

4.115
Last change on this file since 63f871f was 7d3f9c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 07:37:03

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 1.3 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-1999.
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.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <rtems.h>
21#include <rtems/stackchk.h>
22
23void b(void) {}
24
25void blow_stack( void )
26{
27  volatile uint32_t   *low, *high;
28  unsigned char *area;
29
30b();
31  /*
32   *  Destroy the first and last 16 bytes of our stack... Hope it
33   *  does not cause problems :)
34   */
35
36  area = (unsigned char *)_Thread_Executing->Start.Initial_stack.area;
37
38  /* Look in the stack checker implementation for this magic offset */
39  low  = (volatile uint32_t *) \
40     (area + sizeof(Heap_Block) - HEAP_BLOCK_HEADER_SIZE);
41  high = (volatile uint32_t *)
42             (area + _Thread_Executing->Start.Initial_stack.size - 16);
43
44  low[0] = 0x11111111;
45  low[1] = 0x22222222;
46  low[2] = 0x33333333;
47  low[3] = 0x44444444;
48
49  high[0] = 0x55555555;
50  high[1] = 0x66666666;
51  high[2] = 0x77777777;
52  high[3] = 0x88888888;
53  rtems_stack_checker_report_usage();
54}
Note: See TracBrowser for help on using the repository browser.