@@ -609,59 +609,22 @@ ret_from_fork:
609609.end ret_from_fork
610610
611611/*
612- * kernel_thread(fn, arg, clone_flags)
612+ * ... and new kernel threads - here
613613 */
614614 .align 4
615- .globl kernel_thread
616- .ent kernel_thread
617- kernel_thread:
618- /* We can be called from a module. */
619- ldgp $gp, 0 ($27 )
620- .prologue 1
621- subq $sp, SP_OFF+6*8 , $sp
622- br $1 , 2f /* load start address */
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 )
615+ .globl ret_from_kernel_thread
616+ .ent ret_from_kernel_thread
617+ ret_from_kernel_thread:
618+ mov $17 , $16
619+ jsr $26 , schedule_tail
620+ mov $9 , $27
621+ mov $10 , $16
622+ jsr $26 , ($9 )
632623 ldgp $gp, 0 ($26 )
633624 mov $0 , $16
634625 mov $31 , $26
635626 jmp $31 , sys_exit
636-
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
627+ .end ret_from_kernel_thread
665628
666629
667630/*
0 commit comments