5
Last change
on this file since 1947449 was
5f31bbe,
checked in by Sebastian Huber <sebastian.huber@…>, on 06/25/15 at 12:22:31
|
libmisc: Simplify <rtems/stackchk.h>
Drop the <rtems/score/percpu.h> include since this file exposes a lot of
implementation details.
|
-
Property mode set to
100644
|
File size:
1.4 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.h> |
---|
19 | #include <rtems/stackchk.h> |
---|
20 | #include <rtems/score/percpu.h> |
---|
21 | |
---|
22 | /* forward declarations to avoid warnings */ |
---|
23 | void b(void); |
---|
24 | void blow_stack(void); |
---|
25 | |
---|
26 | void b(void) |
---|
27 | { |
---|
28 | } |
---|
29 | |
---|
30 | void blow_stack(void) |
---|
31 | { |
---|
32 | volatile uint32_t *low, *high; |
---|
33 | unsigned char *area; |
---|
34 | Thread_Control *executing; |
---|
35 | |
---|
36 | b(); |
---|
37 | |
---|
38 | /* |
---|
39 | * Destroy the first and last 16 bytes of our stack... Hope it |
---|
40 | * does not cause problems :) |
---|
41 | */ |
---|
42 | |
---|
43 | executing = _Thread_Get_executing(); |
---|
44 | area = (unsigned char *)executing->Start.Initial_stack.area; |
---|
45 | |
---|
46 | /* Look in the stack checker implementation for this magic offset */ |
---|
47 | low = (volatile uint32_t *) \ |
---|
48 | (area + sizeof(Heap_Block) - HEAP_BLOCK_HEADER_SIZE); |
---|
49 | high = (volatile uint32_t *) |
---|
50 | (area + executing->Start.Initial_stack.size - 16); |
---|
51 | |
---|
52 | low[0] = 0x11111111; |
---|
53 | low[1] = 0x22222222; |
---|
54 | low[2] = 0x33333333; |
---|
55 | low[3] = 0x44444444; |
---|
56 | |
---|
57 | high[0] = 0x55555555; |
---|
58 | high[1] = 0x66666666; |
---|
59 | high[2] = 0x77777777; |
---|
60 | high[3] = 0x88888888; |
---|
61 | rtems_stack_checker_report_usage(); |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.