aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/kernel/skas/process.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 4dc13bc8cfd8..773cd2b525fc 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -201,6 +201,11 @@ void userspace(union uml_pt_regs *regs)
201 } 201 }
202 } 202 }
203} 203}
204#define INIT_JMP_NEW_THREAD 0
205#define INIT_JMP_REMOVE_SIGSTACK 1
206#define INIT_JMP_CALLBACK 2
207#define INIT_JMP_HALT 3
208#define INIT_JMP_REBOOT 4
204 209
205void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, 210void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
206 void (*handler)(int)) 211 void (*handler)(int))
@@ -236,7 +241,7 @@ void thread_wait(void *sw, void *fb)
236 *switch_buf = &buf; 241 *switch_buf = &buf;
237 fork_buf = fb; 242 fork_buf = fb;
238 if(sigsetjmp(buf, 1) == 0) 243 if(sigsetjmp(buf, 1) == 0)
239 siglongjmp(*fork_buf, 1); 244 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
240} 245}
241 246
242void switch_threads(void *me, void *next) 247void switch_threads(void *me, void *next)
@@ -266,21 +271,25 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
266 271
267 *fork_buf_ptr = &initial_jmpbuf; 272 *fork_buf_ptr = &initial_jmpbuf;
268 n = sigsetjmp(initial_jmpbuf, 1); 273 n = sigsetjmp(initial_jmpbuf, 1);
269 if(n == 0) 274 switch(n){
270 new_thread_proc((void *) stack, new_thread_handler); 275 case INIT_JMP_NEW_THREAD:
271 else if(n == 1) 276 new_thread_proc((void *) stack, new_thread_handler);
272 remove_sigstack(); 277 break;
273 else if(n == 2){ 278 case INIT_JMP_REMOVE_SIGSTACK:
279 remove_sigstack();
280 break;
281 case INIT_JMP_CALLBACK:
274 (*cb_proc)(cb_arg); 282 (*cb_proc)(cb_arg);
275 siglongjmp(*cb_back, 1); 283 siglongjmp(*cb_back, 1);
276 } 284 break;
277 else if(n == 3){ 285 case INIT_JMP_HALT:
278 kmalloc_ok = 0; 286 kmalloc_ok = 0;
279 return(0); 287 return(0);
280 } 288 case INIT_JMP_REBOOT:
281 else if(n == 4){
282 kmalloc_ok = 0; 289 kmalloc_ok = 0;
283 return(1); 290 return(1);
291 default:
292 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
284 } 293 }
285 siglongjmp(**switch_buf, 1); 294 siglongjmp(**switch_buf, 1);
286} 295}
@@ -305,7 +314,7 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
305 314
306 block_signals(); 315 block_signals();
307 if(sigsetjmp(here, 1) == 0) 316 if(sigsetjmp(here, 1) == 0)
308 siglongjmp(initial_jmpbuf, 2); 317 siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK);
309 unblock_signals(); 318 unblock_signals();
310 319
311 cb_proc = NULL; 320 cb_proc = NULL;
@@ -316,13 +325,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
316void halt_skas(void) 325void halt_skas(void)
317{ 326{
318 block_signals(); 327 block_signals();
319 siglongjmp(initial_jmpbuf, 3); 328 siglongjmp(initial_jmpbuf, INIT_JMP_HALT);
320} 329}
321 330
322void reboot_skas(void) 331void reboot_skas(void)
323{ 332{
324 block_signals(); 333 block_signals();
325 siglongjmp(initial_jmpbuf, 4); 334 siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT);
326} 335}
327 336
328void switch_mm_skas(int mm_fd) 337void switch_mm_skas(int mm_fd)