annotate packages/kernel/current/include/thread.inl @ 2729:74dbf4c3f2e1 after-copyright-change-20090129

Update all copyright banners to reflect FSF ownership; fix and improve licence text.
author jlarmour
date Thu, 29 Jan 2009 17:47:46 +0000
parents e19a7a6154d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
1 #ifndef CYGONCE_KERNEL_THREAD_INL
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
2 #define CYGONCE_KERNEL_THREAD_INL
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
3
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
4 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
5 //
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
6 // thread.inl
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
7 //
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
8 // Thread class inlines
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
9 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
10 //==========================================================================
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
11 // ####ECOSGPLCOPYRIGHTBEGIN####
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
12 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
13 // This file is part of eCos, the Embedded Configurable Operating System.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
14 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 183
diff changeset
15 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
16 // eCos is free software; you can redistribute it and/or modify it under
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
17 // the terms of the GNU General Public License as published by the Free
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
18 // Software Foundation; either version 2 or (at your option) any later
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
19 // version.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 183
diff changeset
20 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
21 // eCos is distributed in the hope that it will be useful, but WITHOUT
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
22 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
23 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
24 // for more details.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 183
diff changeset
25 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
26 // You should have received a copy of the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
27 // along with eCos; if not, write to the Free Software Foundation, Inc.,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
28 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 183
diff changeset
29 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
30 // As a special exception, if other files instantiate templates or use
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
31 // macros or inline functions from this file, or you compile this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
32 // and link it with other works to produce a work based on this file,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
33 // this file does not by itself cause the resulting work to be covered by
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
34 // the GNU General Public License. However the source code for this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
35 // must still be made available in accordance with section (3) of the GNU
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
36 // General Public License v2.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 183
diff changeset
37 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
38 // This exception does not invalidate any other reasons why a work based
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
39 // on this file might be covered by the GNU General Public License.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
40 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2613
diff changeset
41 // ####ECOSGPLCOPYRIGHTEND####
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
42 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
43 //#####DESCRIPTIONBEGIN####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
44 //
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
45 // Author(s): nickg
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
46 // Contributors: nickg
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
47 // Date: 1997-09-09
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
48 // Purpose: Define inlines for thread classes
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
49 // Description: Inline implementations of various member functions defined
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
50 // in various Thread classes.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
51 // Usage:
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
52 // #include <cyg/kernel/thread.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
53 // ...
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
54 // #include <cyg/kernel/thread.inl>
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
55 // ...
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
56
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
57 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
58 //####DESCRIPTIONEND####
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
59 //
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
60 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
61
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
62 #include <cyg/kernel/thread.hxx>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
63 #include <cyg/hal/hal_arch.h>
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
64
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
65 #include <cyg/kernel/clock.inl>
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
66 #include <cyg/infra/diag.h>
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
67
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
68 #ifndef CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
69 #define CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE (0)
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
70 #endif
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
71
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
72 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
73 // Inlines for Cyg_HardwareThread
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
74
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
75 // -------------------------------------------------------------------------
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
76 // get the size/base of this thread's stack
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
77
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
78 inline CYG_ADDRESS
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
79 Cyg_HardwareThread::get_stack_base()
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
80 {
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
81 return stack_base - CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
82 }
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
83
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
84 inline cyg_uint32
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
85 Cyg_HardwareThread::get_stack_size()
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
86 {
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
87 return stack_size + 2 * CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
88 }
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
89
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
90 // -------------------------------------------------------------------------
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
91 // Check the stack bounds of this thread:
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
92 #ifdef CYGFUN_KERNEL_THREADS_STACK_CHECKING
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
93 inline void Cyg_HardwareThread::check_stack(void)
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
94 {
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
95 cyg_uint32 sig = (cyg_uint32)this;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
96 cyg_uint32 *base = (cyg_uint32 *)get_stack_base();
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
97 cyg_uint32 *top = (cyg_uint32 *)(stack_base + stack_size);
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
98 cyg_ucount32 i;
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
99
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 160
diff changeset
100 CYG_INSTRUMENT_THREAD(CHECK_STACK, base, top );
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 160
diff changeset
101
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
102 CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)base), "stack base not word aligned" );
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
103 CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)top), "stack top not word aligned" );
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
104
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
105 CYG_ASSERT( (cyg_uint32)stack_ptr > (cyg_uint32)stack_base,
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
106 "Stack_ptr below base" );
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
107 CYG_ASSERT( (cyg_uint32)stack_ptr <= ((cyg_uint32)stack_base + stack_size),
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
108 "Stack_ptr above top" );
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
109
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
110 for ( i = 0;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
111 i < CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE/sizeof(cyg_uint32);
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
112 i++ ) {
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
113 if ((sig ^ (i * 0x01010101)) != base[i]) {
2613
e19a7a6154d0 * include/thread.inl: Silence some warnings by assigning
jlarmour
parents: 1539
diff changeset
114 const char *reason = "Stack base corrupt";
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
115 diag_printf("%s - i: %d\n", reason, i);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
116 diag_dump_buf(base, CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
117 CYG_FAIL(reason);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
118 }
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
119 if ((sig ^ (i * 0x10101010)) != top[i]) {
2613
e19a7a6154d0 * include/thread.inl: Silence some warnings by assigning
jlarmour
parents: 1539
diff changeset
120 const char *reason = "Stack top corrupt";
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
121 diag_printf("%s - i: %d\n", reason, i);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
122 diag_dump_buf(top, CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
123 CYG_FAIL(reason);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
124 }
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
125 }
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
126
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
127 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
128 // we won't have added check data above the stack limit if it hasn't
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
129 // been incremented
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
130 if (stack_limit != stack_base) {
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
131 CYG_ADDRESS limit = stack_limit;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
132 // the limit will be off by the check data size, so lets correct it
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
133 limit -= CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
134
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
135 // determine base of check data by rounding up to nearest word aligned
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
136 // address if not already aligned
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
137 cyg_uint32 *p = (cyg_uint32 *)((limit + 3) & ~3);
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
138 // i.e. + sizeof(cyg_uint32)-1) & ~(sizeof(cyg_uint32)-1);
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
139
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
140 for ( i = 0;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
141 i < CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE/sizeof(cyg_uint32);
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
142 i++ ) {
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
143 if ((sig ^ (i * 0x01010101)) != p[i]) {
2613
e19a7a6154d0 * include/thread.inl: Silence some warnings by assigning
jlarmour
parents: 1539
diff changeset
144 const char *reason = "Gap between stack limit and base corrupt";
585
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
145 diag_printf("%s - i: %d\n", reason, i);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
146 diag_dump_buf(p, CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
147 CYG_FAIL(reason);
52f0600c2119 Add debug prints to thread stack checking.
gthomas
parents: 210
diff changeset
148 }
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
149 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
150 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
151 #endif
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
152 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
153 #endif
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
154
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
155 // -------------------------------------------------------------------------
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
156 // Measure the stack usage of the thread
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
157 #ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
158 inline cyg_uint32 Cyg_HardwareThread::measure_stack_usage(void)
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
159 {
183
9160a8005d76 Merge from eCos master repository on 2001-09-12-03:52:30-BST
jlarmour
parents: 182
diff changeset
160 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
9160a8005d76 Merge from eCos master repository on 2001-09-12-03:52:30-BST
jlarmour
parents: 182
diff changeset
161 CYG_WORD *base = (CYG_WORD *)stack_limit;
9160a8005d76 Merge from eCos master repository on 2001-09-12-03:52:30-BST
jlarmour
parents: 182
diff changeset
162 cyg_uint32 size = (stack_size - (stack_limit-stack_base))/sizeof(CYG_WORD);
9160a8005d76 Merge from eCos master repository on 2001-09-12-03:52:30-BST
jlarmour
parents: 182
diff changeset
163 #else
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
164 CYG_WORD *base = (CYG_WORD *)stack_base;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
165 cyg_uint32 size = stack_size/sizeof(CYG_WORD);
183
9160a8005d76 Merge from eCos master repository on 2001-09-12-03:52:30-BST
jlarmour
parents: 182
diff changeset
166 #endif
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
167 cyg_ucount32 i;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
168
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
169 // Work up the stack comparing with the preset value
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
170 // We assume the stack grows downwards, hmm...
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
171 for (i=0; i<size; i++) {
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
172 if (base[i] != 0xDEADBEEF)
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
173 break;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
174 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
175 return (size - i)*sizeof(CYG_WORD);
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
176 }
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
177 #endif
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
178
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
179 // -------------------------------------------------------------------------
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
180 // Attach a stack to this thread. If there is a HAL defined macro to
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
181 // do this, then we use that, otherwise assume a falling stack.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
182 inline void Cyg_HardwareThread::attach_stack(CYG_ADDRESS s_base, cyg_uint32 s_size)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
183 {
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
184 #ifdef CYGNUM_HAL_STACK_SIZE_MINIMUM
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
185 CYG_ASSERT( s_size >= CYGNUM_HAL_STACK_SIZE_MINIMUM,
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
186 "Stack size too small");
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
187 #endif
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
188
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
189 #ifdef CYGFUN_KERNEL_THREADS_STACK_CHECKING
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
190 {
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
191 cyg_uint32 sig = (cyg_uint32)this;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
192 cyg_uint32 *base = (cyg_uint32 *)s_base;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
193 cyg_uint32 *top = (cyg_uint32 *)(s_base + s_size -
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
194 CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE);
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
195
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
196 unsigned int i;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
197
177
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 160
diff changeset
198 CYG_INSTRUMENT_THREAD(ATTACH_STACK, base, top );
4c750ce71ae3 Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents: 160
diff changeset
199
154
e2d866e32dac Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents: 147
diff changeset
200 CYG_ASSERT( NULL != base, "stack base non-NULL" );
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
201 CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)base), "stack base alignment" );
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
202 CYG_ASSERT( 0 == ((sizeof(CYG_WORD)-1) & (cyg_uint32)top), "stack top alignment" );
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
203
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
204 for ( i = 0;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
205 i < CYGNUM_KERNEL_THREADS_STACK_CHECK_DATA_SIZE/sizeof(cyg_uint32);
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
206 i++ ) {
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
207 base[i] = (sig ^ (i * 0x01010101));
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
208 top[i] = (sig ^ (i * 0x10101010));
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
209 }
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
210 // This check for overlap of the two signature areas also detects
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
211 // wrap round zero of the size in the unsigned subtraction below.
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
212 CYG_ASSERT( &base[i] < &top[0], "Stack is so small size wrapped" );
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
213 // Use this 'i' expression to round correctly to whole words.
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
214 s_base += i * sizeof(cyg_uint32);
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
215 s_size -= i * sizeof(cyg_uint32) * 2;
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
216 // This is a complete guess, the 256; the point is to assert early that
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
217 // this might go badly wrong. It would not detect wrap of unsigned size.
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
218 CYG_ASSERT( s_size >= 256,
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
219 "Stack size too small after allocating checking buffer");
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
220 }
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
221 #endif
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
222 #ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
223 {
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
224 CYG_WORD *base = (CYG_WORD *)s_base;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
225 cyg_uint32 size = s_size/sizeof(CYG_WORD);
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
226 cyg_ucount32 i;
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
227
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
228 // initialize all of stack with known value - don't choose 0
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
229 // could do with pseudo value as above, but this way, checking
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
230 // is faster
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
231 for (i=0; i<size; i++) {
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
232 base[i] = 0xDEADBEEF;
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
233 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
234 // Don't bother about the case when the stack isn't a multiple of
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
235 // CYG_WORD in size. Since it's at the top of the stack, it will
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
236 // almost certainly be overwritten the instant the thread starts
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
237 // anyway.
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
238 }
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
239 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
240 stack_base = s_base;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
241 stack_size = s_size;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
242 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
243 stack_limit = s_base;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
244 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
245
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
246 #ifdef HAL_THREAD_ATTACH_STACK
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
247
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
248 HAL_THREAD_ATTACH_STACK(stack_ptr, stack_base, stack_size);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
249
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
250 #else
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
251
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
252 stack_ptr = stack_base + stack_size;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
253
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
254 #endif
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
255
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
256 #ifdef CYGFUN_KERNEL_THREADS_STACK_CHECKING
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
257 check_stack();
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 115
diff changeset
258 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
259 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
260
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
261 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
262
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
263 inline Cyg_HardwareThread::Cyg_HardwareThread(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
264 cyg_thread_entry *e_point, // entry point function
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
265 CYG_ADDRWORD e_data, // entry data
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
266 cyg_ucount32 s_size, // stack size, 0 = use default
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
267 CYG_ADDRESS s_base // stack base, NULL = allocate
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
268 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
269 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
270 entry_point = e_point;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
271 entry_data = e_data;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
272 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
273 saved_context = 0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
274 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
275
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
276 attach_stack( s_base, s_size );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
277 };
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
278
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
279 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
280
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
281 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
282
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
283 // Return the current saved state for this thread.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
284 inline HAL_SavedRegisters *Cyg_HardwareThread::get_saved_context()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
285 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
286 HAL_SavedRegisters *regs;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
287 if( saved_context != 0 ) regs = saved_context;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
288 else HAL_THREAD_GET_SAVED_REGISTERS( stack_ptr, regs );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
289 return regs;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
290 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
291
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
292 inline void Cyg_HardwareThread::set_saved_context(HAL_SavedRegisters *ctx)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
293 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
294 saved_context = ctx;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
295 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
296
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
297 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
298
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
299 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
300 // (declare this inline before its first use)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
301
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
302 inline cyg_uint16 Cyg_Thread::get_unique_id()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
303 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
304 return unique_id;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
305 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
306
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
307 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
308 // Initialize the context of this thread.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
309
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
310 inline void Cyg_HardwareThread::init_context(Cyg_Thread *thread)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
311 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
312 #ifdef CYGPKG_INFRA_DEBUG
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
313 cyg_uint32 threadid = thread->get_unique_id()*0x01010000;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
314 #else
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
315 cyg_uint32 threadid = 0x11110000;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
316 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
317 HAL_THREAD_INIT_CONTEXT( stack_ptr, thread, thread_entry, threadid );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
318 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
319
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
320
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
321
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
322 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
323 // Save current thread's context and load that of the given next thread.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
324 // This function is only really here for completeness, the
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
325 // kernel generally calls the HAL macros directly.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
326
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
327 inline void Cyg_HardwareThread::switch_context(Cyg_HardwareThread *next)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
328 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
329 HAL_THREAD_SWITCH_CONTEXT( &stack_ptr, &next->stack_ptr );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
330 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
331
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
332 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
333 // Get and set entry_data.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
334
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
335 inline void Cyg_HardwareThread::set_entry_data( CYG_ADDRWORD data )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
336 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
337 entry_data = data;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
338 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
339
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
340 inline CYG_ADDRWORD Cyg_HardwareThread::get_entry_data()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
341 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
342 return entry_data;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
343 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
344
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
345 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
346 // Allocate some memory at the lower end of the stack
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
347 // by moving the stack limit pointer.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
348
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
349 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
350
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
351 #ifndef CYGFUN_KERNEL_THREADS_STACK_CHECKING
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
352 // if stack checking, implementation is in thread.cxx
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
353 inline void *Cyg_HardwareThread::increment_stack_limit( cyg_ucount32 size )
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
354 {
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
355 void *ret = (void *)stack_limit;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
356 stack_limit += size;
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
357 return ret;
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
358 }
147
d397fc472bcf Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents: 143
diff changeset
359 #endif
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
360
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
361 inline CYG_ADDRESS
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
362 Cyg_HardwareThread::get_stack_limit()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
363 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
364 return stack_limit;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
365 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
366
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
367 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
368
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
369 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
370 // Inlines for Cyg_Thread class
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
371
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
372 inline Cyg_Thread *Cyg_Thread::self()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
373 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
374 return Cyg_Scheduler::get_current_thread();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
375 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
376
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
377 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
378
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
379 inline void Cyg_Thread::yield()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
380 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
381 self()->Cyg_SchedThread::yield();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
382 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
383
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
384 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
385
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
386 inline void
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
387 Cyg_Thread::rotate_queue( cyg_priority pri )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
388 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
389 self()->Cyg_SchedThread::rotate_queue( pri );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
390 }
2
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
391
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
392 // -------------------------------------------------------------------------
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
393
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
394 inline void
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
395 Cyg_Thread::to_queue_head( void )
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
396 {
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
397 this->Cyg_SchedThread::to_queue_head();
443894e2e912 Block commit of eCos version 1.2.1
jlarmour
parents: 0
diff changeset
398 }
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
399
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
400 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
401
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
402 #ifdef CYGIMP_THREAD_PRIORITY
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
403
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
404 inline cyg_priority Cyg_Thread::get_priority()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
405 {
115
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents: 66
diff changeset
406 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
407
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
408 // If we have an inherited priority, return our original
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
409 // priority rather than the current one.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
410
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
411 if( priority_inherited ) return original_priority;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
412
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
413 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
414
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
415 return priority;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
416 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
417
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
418 // Return the actual dispatching priority of the thread
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
419 // regardless of inheritance or scheduling concerns.
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
420 inline cyg_priority Cyg_Thread::get_current_priority()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
421 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
422 return priority;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
423 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
424
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
425 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
426
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
427 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
428
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
429 inline void Cyg_Thread::set_sleep_reason( cyg_reason reason)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
430 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
431 self()->sleep_reason = reason;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
432 self()->wake_reason = NONE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
433 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
434
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
435 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
436
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
437 inline Cyg_Thread::cyg_reason Cyg_Thread::get_sleep_reason()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
438 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
439 return sleep_reason;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
440 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
441
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
442 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
443
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
444 inline void Cyg_Thread::set_wake_reason( cyg_reason reason )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
445 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
446 sleep_reason = NONE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
447 wake_reason = reason;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
448 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
449
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
450 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
451
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
452 inline Cyg_Thread::cyg_reason Cyg_Thread::get_wake_reason()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
453 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
454 return wake_reason;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
455 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
456
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
457 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
458
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
459 inline void Cyg_Thread::set_timer(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
460 cyg_tick_count trigger,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
461 cyg_reason reason
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
462 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
463 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
464 #ifdef CYGFUN_KERNEL_THREADS_TIMER
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
465 self()->sleep_reason = reason;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
466 self()->wake_reason = NONE;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
467 self()->timer.initialize( trigger);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
468 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
469 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
470
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
471 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
472
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
473 inline void Cyg_Thread::clear_timer()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
474 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
475 #ifdef CYGFUN_KERNEL_THREADS_TIMER
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
476 self()->timer.disable();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
477 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
478 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
479
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
480 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
481
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
482 #ifdef CYGVAR_KERNEL_THREADS_DATA
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
483
182
f62680ef1804 Merge from eCos master repository on 2001-09-07-06:43:02-BST
jlarmour
parents: 177
diff changeset
484 inline CYG_ADDRWORD Cyg_Thread::get_data( Cyg_Thread::cyg_data_index index )
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
485 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
486 CYG_ASSERT( index < CYGNUM_KERNEL_THREADS_DATA_MAX,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
487 "Per thread data index out of bounds");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
488 CYG_ASSERT( (thread_data_map & (1<<index)) == 0,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
489 "Unallocated index used");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
490
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
491 return self()->thread_data[index];
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
492 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
493
182
f62680ef1804 Merge from eCos master repository on 2001-09-07-06:43:02-BST
jlarmour
parents: 177
diff changeset
494 inline CYG_ADDRWORD *Cyg_Thread::get_data_ptr( Cyg_Thread::cyg_data_index index )
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
495 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
496 CYG_ASSERT( index < CYGNUM_KERNEL_THREADS_DATA_MAX,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
497 "Per thread data index out of bounds");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
498 CYG_ASSERT( (thread_data_map & (1<<index)) == 0,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
499 "Unallocated index used");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
500
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
501 return &(self()->thread_data[index]);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
502 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
503
182
f62680ef1804 Merge from eCos master repository on 2001-09-07-06:43:02-BST
jlarmour
parents: 177
diff changeset
504 inline void Cyg_Thread::set_data( Cyg_Thread::cyg_data_index index,
f62680ef1804 Merge from eCos master repository on 2001-09-07-06:43:02-BST
jlarmour
parents: 177
diff changeset
505 CYG_ADDRWORD data )
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
506 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
507 CYG_ASSERT( index < CYGNUM_KERNEL_THREADS_DATA_MAX,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
508 "Per thread data index out of bounds");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
509 CYG_ASSERT( (thread_data_map & (1<<index)) == 0,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
510 "Unallocated index used");
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
511
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
512 thread_data[index] = data;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
513 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
514
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
515 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
516
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
517 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
518
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
519 #ifdef CYGVAR_KERNEL_THREADS_NAME
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
520
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
521 inline char *Cyg_Thread::get_name()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
522 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
523 return name;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
524 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
525
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
526 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
527
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
528 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
529
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
530 #ifdef CYGVAR_KERNEL_THREADS_LIST
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
531
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
532 inline Cyg_Thread *Cyg_Thread::get_list_head()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
533 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
534 return thread_list?thread_list->list_next:0;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
535 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
536
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
537 inline Cyg_Thread *Cyg_Thread::get_list_next()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
538 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
539 return (this==thread_list)?0:list_next;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
540 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
541
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
542 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
543
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
544
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
545 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
546
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
547 #ifdef CYGPKG_KERNEL_EXCEPTIONS
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
548
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
549 inline void Cyg_Thread::register_exception(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
550 cyg_code exception_number, // exception number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
551 cyg_exception_handler handler, // handler function
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
552 CYG_ADDRWORD data, // data argument
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
553 cyg_exception_handler **old_handler, // handler function
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
554 CYG_ADDRWORD *old_data // data argument
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
555 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
556 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
557 self()->exception_control.register_exception(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
558 exception_number,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
559 handler,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
560 data,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
561 old_handler,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
562 old_data
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
563 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
564 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
565
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
566 inline void Cyg_Thread::deregister_exception(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
567 cyg_code exception_number // exception number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
568 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
569 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
570 self()->exception_control.deregister_exception(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
571 exception_number
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
572 );
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
573 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
574
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
575 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
576
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
577 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
578 // Inlines for Cyg_ThreadTimer class
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
579
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
580 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
581 #if defined(CYGFUN_KERNEL_THREADS_TIMER) && defined(CYGVAR_KERNEL_COUNTERS_CLOCK)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
582
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
583 inline Cyg_ThreadTimer::Cyg_ThreadTimer(
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
584 Cyg_Thread *th
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
585 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
586 : Cyg_Alarm(Cyg_Clock::real_time_clock,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
587 &alarm,
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
588 CYG_ADDRWORD(this)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
589 )
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
590 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
591 thread = th;
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
592 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
593
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
594 #endif
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
595
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
596 //==========================================================================
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
597 // Inlines for Cyg_ThreadQueue class
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
598
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
599
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
600 inline void Cyg_ThreadQueue::enqueue(Cyg_Thread *thread)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
601 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
602 Cyg_ThreadQueue_Implementation::enqueue(thread);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
603 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
604
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
605 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
606
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
607 inline Cyg_Thread *Cyg_ThreadQueue::highpri()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
608 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
609 return Cyg_ThreadQueue_Implementation::highpri();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
610 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
611
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
612 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
613
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
614 inline Cyg_Thread *Cyg_ThreadQueue::dequeue()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
615 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
616 return Cyg_ThreadQueue_Implementation::dequeue();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
617 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
618
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
619 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
620
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
621 inline void Cyg_ThreadQueue::remove(Cyg_Thread *thread)
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
622 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
623 Cyg_ThreadQueue_Implementation::remove(thread);
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
624 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
625
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
626 // -------------------------------------------------------------------------
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
627
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
628 inline cyg_bool Cyg_ThreadQueue::empty()
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
629 {
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
630 return Cyg_ThreadQueue_Implementation::empty();
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
631 }
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
632
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
633 // -------------------------------------------------------------------------
1539
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
634
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
635 #ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
636
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
637 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
638 # include <cyg/kernel/sched.inl>
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
639 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
640
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
641 // Add and remove destructors. Returns true on success, false on failure.
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
642 inline cyg_bool
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
643 Cyg_Thread::add_destructor( destructor_fn fn, CYG_ADDRWORD data )
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
644 {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
645 cyg_ucount16 i;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
646 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
647 Cyg_Scheduler::lock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
648 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
649 for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
650 if (NULL == destructors[i].fn) {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
651 destructors[i].data = data;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
652 destructors[i].fn = fn;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
653 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
654 Cyg_Scheduler::unlock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
655 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
656 return true;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
657 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
658 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
659 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
660 Cyg_Scheduler::unlock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
661 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
662 return false;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
663 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
664
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
665 inline cyg_bool
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
666 Cyg_Thread::rem_destructor( destructor_fn fn, CYG_ADDRWORD data )
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
667 {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
668 cyg_ucount16 i;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
669 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
670 Cyg_Scheduler::lock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
671 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
672 for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
673 if (destructors[i].fn == fn && destructors[i].data == data) {
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
674 destructors[i].fn = NULL;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
675 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
676 Cyg_Scheduler::unlock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
677 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
678 return true;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
679 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
680 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
681 #ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
682 Cyg_Scheduler::unlock();
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
683 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
684 return false;
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
685 }
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
686 #endif
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
687
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
688 // -------------------------------------------------------------------------
57cebf53b527 * include/kapi.h: Add throw specifications throughout.
jlarmour
parents: 585
diff changeset
689
0
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
690 #endif // ifndef CYGONCE_KERNEL_THREAD_INL
3111d98ba7b3 Initial commit of eCos version 1.1
jlarmour
parents:
diff changeset
691 // EOF thread.inl