|
0
|
1 #ifndef CYGONCE_LIBC_SETJMP_INL |
|
|
2 #define CYGONCE_LIBC_SETJMP_INL |
|
|
3 //=========================================================================== |
|
|
4 // |
|
|
5 // setjmp.inl |
|
|
6 // |
|
|
7 // Inline functions for ANSI standard non-local jumps |
|
|
8 // |
|
|
9 //=========================================================================== |
|
|
10 //####COPYRIGHTBEGIN#### |
|
|
11 // |
|
|
12 // ------------------------------------------- |
|
|
13 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
14 // Version 1.0 (the "License"); you may not use this file except in |
|
|
15 // compliance with the License. You may obtain a copy of the License at |
|
|
16 // http://sourceware.cygnus.com/ecos |
|
|
17 // |
|
|
18 // Software distributed under the License is distributed on an "AS IS" |
|
|
19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
20 // License for the specific language governing rights and limitations under |
|
|
21 // the License. |
|
|
22 // |
|
|
23 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
24 // September 30, 1998. |
|
|
25 // |
|
|
26 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
27 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
28 // ------------------------------------------- |
|
|
29 // |
|
|
30 //####COPYRIGHTEND#### |
|
|
31 //=========================================================================== |
|
|
32 //#####DESCRIPTIONBEGIN#### |
|
|
33 // |
|
|
34 // Author(s): jlarmour@cygnus.co.uk |
|
|
35 // Contributors: jlarmour@cygnus.co.uk |
|
|
36 // Date: 1998-02-13 |
|
|
37 // Purpose: |
|
|
38 // Description: Inline functions to implement ANSI standard non-local jumps as |
|
|
39 // per ANSI para 7.6 |
|
|
40 // Usage: Do not include this file, #include <setjmp.h> instead |
|
|
41 // |
|
|
42 //####DESCRIPTIONEND#### |
|
|
43 // |
|
|
44 //=========================================================================== |
|
|
45 |
|
|
46 // CONFIGURATION |
|
|
47 |
|
|
48 #include <pkgconf/libc.h> // Configuration header |
|
|
49 |
|
|
50 // Include the C library? |
|
|
51 #ifdef CYGPKG_LIBC |
|
|
52 |
|
|
53 // INCLUDES |
|
|
54 |
|
|
55 #include <cyg/infra/cyg_type.h> // Common type definitions and support |
|
|
56 #include <cyg/infra/cyg_trac.h> // Common tracing code |
|
|
57 #include <cyg/infra/cyg_ass.h> // Common assertion code |
|
|
58 #include <setjmp.h> // Header for this file, just in case |
|
|
59 #include <cyg/hal/hal_arch.h> // HAL architecture specific implementation |
|
|
60 |
|
|
61 // INLINE FUNCTIONS |
|
|
62 |
|
|
63 CYGPRI_LIBC_INLINE void |
|
|
64 longjmp( jmp_buf cyg_buf, int cyg_val) |
|
|
65 { |
|
|
66 CYG_REPORT_FUNCNAME( "longjmp" ); |
|
|
67 CYG_REPORT_FUNCARG2( "&cyg_buf=%08x, cyg_val=%d", &cyg_buf, cyg_val ); |
|
|
68 |
|
|
69 // ANSI says that if we are passed cyg_val==0, then we change it to 1 |
|
|
70 if (cyg_val == 0) |
|
|
71 ++cyg_val; |
|
|
72 |
|
|
73 // we let the HAL do the work |
|
|
74 |
|
|
75 HAL_REORDER_BARRIER(); // prevent any chance of optimisation re-ordering |
|
|
76 hal_longjmp( cyg_buf, cyg_val ); |
|
|
77 HAL_REORDER_BARRIER(); // prevent any chance of optimisation re-ordering |
|
|
78 |
|
|
79 #ifdef CYGDBG_USE_ASSERTS |
|
|
80 CYG_ASSERT( 0, "longjmp should not have reached this point!" ); |
|
|
81 #else |
|
|
82 for (;;) |
|
|
83 CYG_EMPTY_STATEMENT; |
|
|
84 #endif |
|
|
85 } // longjmp() |
|
|
86 |
|
|
87 |
|
|
88 #endif // ifdef CYGPKG_LIBC |
|
|
89 |
|
|
90 #endif // CYGONCE_LIBC_SETJMP_INL multiple inclusion protection |
|
|
91 |
|
|
92 // EOF setjmp.inl |