comparison packages/compat/posix/current/tests/signal2.c @ 130:eb9fd8c04db3 ecos-sw-2000-10-23

Merge from eCos master repository on 2000-10-23-17:01:37-BST
author jlarmour
date Mon, 23 Oct 2000 17:10:57 +0000
parents 6ed91473a1cd
children 0ae0bc38e387
comparison
equal deleted inserted replaced
129:605a0fc6f385 130:eb9fd8c04db3
69 69
70 static jmp_buf jbuf; 70 static jmp_buf jbuf;
71 71
72 //-------------------------------------------------------------------------- 72 //--------------------------------------------------------------------------
73 73
74 #ifdef CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS
75
74 static void 76 static void
75 cause_unaligned_access(void) 77 cause_unaligned_access(void)
76 { 78 {
77 volatile int x; 79 volatile int x;
78 volatile CYG_ADDRESS p=(CYG_ADDRESS) &jbuf; 80 volatile CYG_ADDRESS p=(CYG_ADDRESS) &jbuf;
79 81
80 x = *(volatile int *)(p+1); 82 x = *(volatile int *)(p+1);
81 83
82 } // cause_unaligned_access() 84 } // cause_unaligned_access()
83 85
84 //-------------------------------------------------------------------------- 86 #endif
87
88 //--------------------------------------------------------------------------
89
90 #ifdef CYGNUM_HAL_EXCEPTION_DATA_ACCESS
85 91
86 static void 92 static void
87 cause_illegal_access(void) 93 cause_illegal_access(void)
88 { 94 {
89 volatile int x; 95 volatile int x;
95 p += (CYG_ADDRESS)0x100000; 101 p += (CYG_ADDRESS)0x100000;
96 } while( p != 0 ); 102 } while( p != 0 );
97 103
98 } // cause_unaligned_access() 104 } // cause_unaligned_access()
99 105
100 //-------------------------------------------------------------------------- 106 #endif
107
108 //--------------------------------------------------------------------------
109
110 #ifdef CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO
101 111
102 // num must always be 0 - do it this way in case the optimizer tries to 112 // num must always be 0 - do it this way in case the optimizer tries to
103 // get smart 113 // get smart
104 114
105 static int 115 static int
114 124
115 return ((int)a)/num; // This may cause an exception if 125 return ((int)a)/num; // This may cause an exception if
116 // the architecture supports it. 126 // the architecture supports it.
117 // (integer division by zero). 127 // (integer division by zero).
118 } // cause_fpe() 128 } // cause_fpe()
129
130 #endif
119 131
120 //-------------------------------------------------------------------------- 132 //--------------------------------------------------------------------------
121 // Signal handler functions 133 // Signal handler functions
122 134
123 static void sigsegv( int signo ) 135 static void sigsegv( int signo )
212 CYG_TEST_FAIL("Didn't cause exception"); 224 CYG_TEST_FAIL("Didn't cause exception");
213 } 225 }
214 226
215 #else 227 #else
216 228
217 CYG_TEST_NA("Test 1 - provoke unaligned access - not supported"); 229 CYG_TEST_INFO("Test 1 - provoke unaligned access - not supported");
218 230
219 #endif 231 #endif
220 232
221 #ifdef CYGNUM_HAL_EXCEPTION_DATA_ACCESS 233 #ifdef CYGNUM_HAL_EXCEPTION_DATA_ACCESS
222 234
229 CYG_TEST_FAIL("Didn't cause exception"); 241 CYG_TEST_FAIL("Didn't cause exception");
230 } 242 }
231 243
232 #else 244 #else
233 245
234 CYG_TEST_NA("Test 1 - provoke illegal access - not supported"); 246 CYG_TEST_INFO("Test 1 - provoke illegal access - not supported");
235 247
236 #endif 248 #endif
237 249
238 #ifdef CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO 250 #ifdef CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO
239 251
246 CYG_TEST_FAIL("Didn't cause exception"); 258 CYG_TEST_FAIL("Didn't cause exception");
247 } 259 }
248 260
249 #else 261 #else
250 262
251 CYG_TEST_NA("Test 3 - provoke FP error - not supported"); 263 CYG_TEST_INFO("Test 3 - provoke FP error - not supported");
252 264
253 #endif 265 #endif
254 266
255 CYG_TEST_FINISH( "signal2" ); 267 CYG_TEST_PASS_FINISH( "signal2" );
256 } 268 }
257 269
258 #endif // ifndef NA_MSG 270 #endif // ifndef NA_MSG
259 271
260 //-------------------------------------------------------------------------- 272 //--------------------------------------------------------------------------