source: rtems/testsuites/libtests/stackchk/blow.c @ 4c86e3d

4.115
Last change on this file since 4c86e3d was 4c86e3d, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/12 at 17:20:47

libtmtests - Eliminate missing prototype warnings

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