1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
114
115
116
117
118
119
120
121
122
128
134
135
136
137
138
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
174
175
176
177
178
179
180
181
182
183
...
...
...
#define TX_SOURCE_CODE
#include "tx_api.h"
#include "tx_thread.h"
...
...
VOID _tx_thread_stack_analyze(TX_THREAD *thread_ptr)
{
TX_INTERRUPT_SAVE_AREA
ULONG *stack_ptr;
ULONG *stack_lowest;
ULONG *stack_highest;
ULONG size;
TX_DISABLE
if (thread_ptr != TX_NULL)
{
if (thread_ptr -> tx_thread_id == TX_THREAD_ID)
{
stack_lowest = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_start);
if (stack_lowest != TX_NULL)
{
stack_highest = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr);
if (stack_highest != TX_NULL)
{
TX_RESTORE
/* ... */
do
{
size = (ULONG) (TX_ULONG_POINTER_DIF(stack_highest, stack_lowest))/((ULONG) 2);
stack_ptr = TX_ULONG_POINTER_ADD(stack_lowest, size);
if (*stack_ptr != TX_STACK_FILL)
{
stack_highest = stack_ptr;
}if (*stack_ptr != TX_STACK_FILL) { ... }
else
{
stack_lowest = stack_ptr;
}else { ... }
...} while(size > ((ULONG) 1));
while (*stack_ptr == TX_STACK_FILL)
{
stack_ptr = TX_ULONG_POINTER_ADD(stack_ptr, 1);
}while (*stack_ptr == TX_STACK_FILL) { ... }
TX_THREAD_STACK_ANALYZE_EXTENSION
TX_DISABLE
if (thread_ptr -> tx_thread_id == TX_THREAD_ID)
{
if (stack_ptr > (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_start)))
{
if (stack_ptr < (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr)))
{
if (*stack_ptr != TX_STACK_FILL)
{
thread_ptr -> tx_thread_stack_highest_ptr = stack_ptr;
}if (*stack_ptr != TX_STACK_FILL) { ... }
}if (stack_ptr < (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr))) { ... }
}if (stack_ptr > (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_start))) { ... }
}if (thread_ptr -> tx_thread_id == TX_THREAD_ID) { ... }
}if (stack_highest != TX_NULL) { ... }
}if (stack_lowest != TX_NULL) { ... }
}if (thread_ptr -> tx_thread_id == TX_THREAD_ID) { ... }
}if (thread_ptr != TX_NULL) { ... }
TX_RESTORE
}{ ... }