diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-09 22:03:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-30 22:53:18 -0400 |
commit | cba1ec7e88a0257eb13e84d170a93cd52b702562 (patch) | |
tree | 8a79d3ac38463e3610c5f18481d07bda1e39d45b /arch/alpha/kernel/entry.S | |
parent | 756144f8ea2e4fccbbf1a5644f3e1e889a48f765 (diff) |
alpha: switch to generic kernel_thread()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/alpha/kernel/entry.S')
-rw-r--r-- | arch/alpha/kernel/entry.S | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 61ff145cab6e..421dccf273eb 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -609,59 +609,22 @@ ret_from_fork: | |||
609 | .end ret_from_fork | 609 | .end ret_from_fork |
610 | 610 | ||
611 | /* | 611 | /* |
612 | * kernel_thread(fn, arg, clone_flags) | 612 | * ... and new kernel threads - here |
613 | */ | 613 | */ |
614 | .align 4 | 614 | .align 4 |
615 | .globl kernel_thread | 615 | .globl ret_from_kernel_thread |
616 | .ent kernel_thread | 616 | .ent ret_from_kernel_thread |
617 | kernel_thread: | 617 | ret_from_kernel_thread: |
618 | /* We can be called from a module. */ | 618 | mov $17, $16 |
619 | ldgp $gp, 0($27) | 619 | jsr $26, schedule_tail |
620 | .prologue 1 | 620 | mov $9, $27 |
621 | subq $sp, SP_OFF+6*8, $sp | 621 | mov $10, $16 |
622 | br $1, 2f /* load start address */ | 622 | jsr $26, ($9) |
623 | |||
624 | /* We've now "returned" from a fake system call. */ | ||
625 | unop | ||
626 | blt $0, 1f /* error? */ | ||
627 | ldi $1, 0x3fff | ||
628 | beq $20, 1f /* parent or child? */ | ||
629 | |||
630 | bic $sp, $1, $8 /* in child. */ | ||
631 | jsr $26, ($27) | ||
632 | ldgp $gp, 0($26) | 623 | ldgp $gp, 0($26) |
633 | mov $0, $16 | 624 | mov $0, $16 |
634 | mov $31, $26 | 625 | mov $31, $26 |
635 | jmp $31, sys_exit | 626 | jmp $31, sys_exit |
636 | 627 | .end ret_from_kernel_thread | |
637 | 1: ret /* in parent. */ | ||
638 | |||
639 | .align 4 | ||
640 | 2: /* Fake a system call stack frame, as we can't do system calls | ||
641 | from kernel space. Note that we store FN and ARG as they | ||
642 | need to be set up in the child for the call. Also store $8 | ||
643 | and $26 for use in the parent. */ | ||
644 | stq $31, SP_OFF($sp) /* ps */ | ||
645 | stq $1, SP_OFF+8($sp) /* pc */ | ||
646 | stq $gp, SP_OFF+16($sp) /* gp */ | ||
647 | stq $16, 136($sp) /* $27; FN for child */ | ||
648 | stq $17, SP_OFF+24($sp) /* $16; ARG for child */ | ||
649 | stq $8, 64($sp) /* $8 */ | ||
650 | stq $26, 128($sp) /* $26 */ | ||
651 | /* Avoid the HAE being gratuitously wrong, to avoid restoring it. */ | ||
652 | ldq $2, alpha_mv+HAE_CACHE | ||
653 | stq $2, 152($sp) /* HAE */ | ||
654 | |||
655 | /* Shuffle FLAGS to the front; add CLONE_VM. */ | ||
656 | ldi $1, CLONE_VM|CLONE_UNTRACED | ||
657 | or $18, $1, $16 | ||
658 | bsr $26, sys_clone | ||
659 | |||
660 | /* We don't actually care for a3 success widgetry in the kernel. | ||
661 | Not for positive errno values. */ | ||
662 | stq $0, 0($sp) /* $0 */ | ||
663 | br ret_to_kernel | ||
664 | .end kernel_thread | ||
665 | 628 | ||
666 | 629 | ||
667 | /* | 630 | /* |