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

4.11
Last change on this file since e525f66 was ba6f945a, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 22, 2010 at 7:59:35 PM

2010-06-22 Joel Sherrill <joel.sherrilL@…>

  • stackchk/blow.c, stackchk/stackchk.scn: Print a stack check report before blowing stack.
  • 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-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#include <rtems.h>
17#include <rtems/stackchk.h>
18
19void b(void) {}
20
21void blow_stack( void )
22{
23  volatile uint32_t   *low, *high;
24  unsigned char *area;
25
26b();
27  /*
28   *  Destroy the first and last 16 bytes of our stack... Hope it
29   *  does not cause problems :)
30   */
31
32  area = (unsigned char *)_Thread_Executing->Start.Initial_stack.area;
33
34  /* Look in the stack checker implementation for this magic offset */
35  low  = (volatile uint32_t *) \
36     (area + sizeof(Heap_Block) - HEAP_BLOCK_HEADER_SIZE);
37  high = (volatile uint32_t *)
38             (area + _Thread_Executing->Start.Initial_stack.size - 16);
39
40  low[0] = 0x11111111;
41  low[1] = 0x22222222;
42  low[2] = 0x33333333;
43  low[3] = 0x44444444;
44
45  high[0] = 0x55555555;
46  high[1] = 0x66666666;
47  high[2] = 0x77777777;
48  high[3] = 0x88888888;
49  rtems_stack_checker_report_usage();
50}
Note: See TracBrowser for help on using the repository browser.