diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-14 03:24:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-15 00:53:52 -0400 |
commit | a5df0d1a2c0f7dbd135d978d02daf2d99e62ff7a (patch) | |
tree | 89824d59364a431d332ce68d548068db4616e68c /arch/um | |
parent | 8477b55ba11a49515b26573a90414b718179c908 (diff) |
[PATCH] uml: tidy longjmp macro
The UML_SETJMP macro was requiring its users to pass in a argument which it
could supply itself, since it wasn't used outside that invocation of the
macro.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/include/longjmp.h | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/process.c | 8 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 16 | ||||
-rw-r--r-- | arch/um/os-Linux/uaccess.c | 3 |
4 files changed, 13 insertions, 18 deletions
diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h index 8e7053013f7b..1b5c0131a12e 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/longjmp.h | |||
@@ -8,8 +8,8 @@ | |||
8 | longjmp(*buf, val); \ | 8 | longjmp(*buf, val); \ |
9 | } while(0) | 9 | } while(0) |
10 | 10 | ||
11 | #define UML_SETJMP(buf, enable) ({ \ | 11 | #define UML_SETJMP(buf) ({ \ |
12 | int n; \ | 12 | int n, enable; \ |
13 | enable = get_signals(); \ | 13 | enable = get_signals(); \ |
14 | n = setjmp(*buf); \ | 14 | n = setjmp(*buf); \ |
15 | if(n != 0) \ | 15 | if(n != 0) \ |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index b1cda818f5b5..b98d3ca2cd1b 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -273,12 +273,12 @@ void init_new_thread_signals(void) | |||
273 | int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) | 273 | int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) |
274 | { | 274 | { |
275 | jmp_buf buf; | 275 | jmp_buf buf; |
276 | int n, enable; | 276 | int n; |
277 | 277 | ||
278 | *jmp_ptr = &buf; | 278 | *jmp_ptr = &buf; |
279 | n = UML_SETJMP(&buf, enable); | 279 | n = UML_SETJMP(&buf); |
280 | if(n != 0) | 280 | if(n != 0) |
281 | return(n); | 281 | return n; |
282 | (*fn)(arg); | 282 | (*fn)(arg); |
283 | return(0); | 283 | return 0; |
284 | } | 284 | } |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index bf35572d9cfa..7baf90fda58b 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -435,7 +435,6 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
435 | { | 435 | { |
436 | unsigned long flags; | 436 | unsigned long flags; |
437 | jmp_buf switch_buf, fork_buf; | 437 | jmp_buf switch_buf, fork_buf; |
438 | int enable; | ||
439 | 438 | ||
440 | *switch_buf_ptr = &switch_buf; | 439 | *switch_buf_ptr = &switch_buf; |
441 | *fork_buf_ptr = &fork_buf; | 440 | *fork_buf_ptr = &fork_buf; |
@@ -450,7 +449,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
450 | */ | 449 | */ |
451 | flags = get_signals(); | 450 | flags = get_signals(); |
452 | block_signals(); | 451 | block_signals(); |
453 | if(UML_SETJMP(&fork_buf, enable) == 0) | 452 | if(UML_SETJMP(&fork_buf) == 0) |
454 | new_thread_proc(stack, handler); | 453 | new_thread_proc(stack, handler); |
455 | 454 | ||
456 | remove_sigstack(); | 455 | remove_sigstack(); |
@@ -467,21 +466,19 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
467 | void thread_wait(void *sw, void *fb) | 466 | void thread_wait(void *sw, void *fb) |
468 | { | 467 | { |
469 | jmp_buf buf, **switch_buf = sw, *fork_buf; | 468 | jmp_buf buf, **switch_buf = sw, *fork_buf; |
470 | int enable; | ||
471 | 469 | ||
472 | *switch_buf = &buf; | 470 | *switch_buf = &buf; |
473 | fork_buf = fb; | 471 | fork_buf = fb; |
474 | if(UML_SETJMP(&buf, enable) == 0) | 472 | if(UML_SETJMP(&buf) == 0) |
475 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); | 473 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); |
476 | } | 474 | } |
477 | 475 | ||
478 | void switch_threads(void *me, void *next) | 476 | void switch_threads(void *me, void *next) |
479 | { | 477 | { |
480 | jmp_buf my_buf, **me_ptr = me, *next_buf = next; | 478 | jmp_buf my_buf, **me_ptr = me, *next_buf = next; |
481 | int enable; | ||
482 | 479 | ||
483 | *me_ptr = &my_buf; | 480 | *me_ptr = &my_buf; |
484 | if(UML_SETJMP(&my_buf, enable) == 0) | 481 | if(UML_SETJMP(&my_buf) == 0) |
485 | UML_LONGJMP(next_buf, 1); | 482 | UML_LONGJMP(next_buf, 1); |
486 | } | 483 | } |
487 | 484 | ||
@@ -495,14 +492,14 @@ static jmp_buf *cb_back; | |||
495 | int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | 492 | int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) |
496 | { | 493 | { |
497 | jmp_buf **switch_buf = switch_buf_ptr; | 494 | jmp_buf **switch_buf = switch_buf_ptr; |
498 | int n, enable; | 495 | int n; |
499 | 496 | ||
500 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, | 497 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, |
501 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, | 498 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, |
502 | SIGVTALRM, -1); | 499 | SIGVTALRM, -1); |
503 | 500 | ||
504 | *fork_buf_ptr = &initial_jmpbuf; | 501 | *fork_buf_ptr = &initial_jmpbuf; |
505 | n = UML_SETJMP(&initial_jmpbuf, enable); | 502 | n = UML_SETJMP(&initial_jmpbuf); |
506 | switch(n){ | 503 | switch(n){ |
507 | case INIT_JMP_NEW_THREAD: | 504 | case INIT_JMP_NEW_THREAD: |
508 | new_thread_proc((void *) stack, new_thread_handler); | 505 | new_thread_proc((void *) stack, new_thread_handler); |
@@ -529,14 +526,13 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | |||
529 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) | 526 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) |
530 | { | 527 | { |
531 | jmp_buf here; | 528 | jmp_buf here; |
532 | int enable; | ||
533 | 529 | ||
534 | cb_proc = proc; | 530 | cb_proc = proc; |
535 | cb_arg = arg; | 531 | cb_arg = arg; |
536 | cb_back = &here; | 532 | cb_back = &here; |
537 | 533 | ||
538 | block_signals(); | 534 | block_signals(); |
539 | if(UML_SETJMP(&here, enable) == 0) | 535 | if(UML_SETJMP(&here) == 0) |
540 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); | 536 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); |
541 | unblock_signals(); | 537 | unblock_signals(); |
542 | 538 | ||
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c index e523719330b2..865f6a6a2590 100644 --- a/arch/um/os-Linux/uaccess.c +++ b/arch/um/os-Linux/uaccess.c | |||
@@ -14,11 +14,10 @@ unsigned long __do_user_copy(void *to, const void *from, int n, | |||
14 | int n), int *faulted_out) | 14 | int n), int *faulted_out) |
15 | { | 15 | { |
16 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; | 16 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; |
17 | int enable; | ||
18 | 17 | ||
19 | jmp_buf jbuf; | 18 | jmp_buf jbuf; |
20 | *fault_catcher = &jbuf; | 19 | *fault_catcher = &jbuf; |
21 | if(UML_SETJMP(&jbuf, enable) == 0){ | 20 | if(UML_SETJMP(&jbuf) == 0){ |
22 | (*op)(to, from, n); | 21 | (*op)(to, from, n); |
23 | ret = 0; | 22 | ret = 0; |
24 | *faulted_out = 0; | 23 | *faulted_out = 0; |