@@ -464,114 +464,6 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)
464464 }
465465}
466466
467- static unsigned long thread_regs [MAX_REG_NR ];
468- static unsigned long thread_fp_regs [FP_SIZE ];
469-
470- static int __init init_thread_regs (void )
471- {
472- get_safe_registers (thread_regs , thread_fp_regs );
473- /* Set parent's instruction pointer to start of clone-stub */
474- thread_regs [REGS_IP_INDEX ] = STUB_CODE +
475- (unsigned long ) stub_clone_handler -
476- (unsigned long ) __syscall_stub_start ;
477-
478- /* syscall data as a temporary stack area (top half). */
479- thread_regs [REGS_SP_INDEX ] = STUB_DATA +
480- offsetof(struct stub_data , syscall_data ) +
481- sizeof (((struct stub_data * ) 0 )-> syscall_data ) -
482- sizeof (void * );
483- return 0 ;
484- }
485-
486- __initcall (init_thread_regs );
487-
488- int copy_context_skas0 (unsigned long new_stack , int pid )
489- {
490- int err ;
491- unsigned long current_stack = current_stub_stack ();
492- struct stub_data * data = (struct stub_data * ) current_stack ;
493- struct stub_data * child_data = (struct stub_data * ) new_stack ;
494- unsigned long long new_offset ;
495- int new_fd = phys_mapping (uml_to_phys ((void * )new_stack ), & new_offset );
496-
497- /*
498- * prepare offset and fd of child's stack as argument for parent's
499- * and child's mmap2 calls
500- */
501- * data = ((struct stub_data ) {
502- .offset = MMAP_OFFSET (new_offset ),
503- .fd = new_fd ,
504- .err = - ESRCH ,
505- .child_err = 0 ,
506- });
507-
508- * child_data = ((struct stub_data ) {
509- .child_err = - ESRCH ,
510- });
511-
512- err = ptrace_setregs (pid , thread_regs );
513- if (err < 0 ) {
514- err = - errno ;
515- printk (UM_KERN_ERR "%s : PTRACE_SETREGS failed, pid = %d, errno = %d\n" ,
516- __func__ , pid , - err );
517- return err ;
518- }
519-
520- err = put_fp_registers (pid , thread_fp_regs );
521- if (err < 0 ) {
522- printk (UM_KERN_ERR "%s : put_fp_registers failed, pid = %d, err = %d\n" ,
523- __func__ , pid , err );
524- return err ;
525- }
526-
527- /*
528- * Wait, until parent has finished its work: read child's pid from
529- * parent's stack, and check, if bad result.
530- */
531- err = ptrace (PTRACE_CONT , pid , 0 , 0 );
532- if (err ) {
533- err = - errno ;
534- printk (UM_KERN_ERR "Failed to continue new process, pid = %d, errno = %d\n" ,
535- pid , errno );
536- return err ;
537- }
538-
539- wait_stub_done (pid );
540-
541- pid = data -> err ;
542- if (pid < 0 ) {
543- printk (UM_KERN_ERR "%s - stub-parent reports error %d\n" ,
544- __func__ , - pid );
545- return pid ;
546- }
547-
548- /*
549- * Wait, until child has finished too: read child's result from
550- * child's stack and check it.
551- */
552- wait_stub_done (pid );
553- if (child_data -> child_err != STUB_DATA ) {
554- printk (UM_KERN_ERR "%s - stub-child %d reports error %ld\n" ,
555- __func__ , pid , data -> child_err );
556- err = data -> child_err ;
557- goto out_kill ;
558- }
559-
560- if (ptrace (PTRACE_SETOPTIONS , pid , NULL ,
561- (void * )PTRACE_O_TRACESYSGOOD ) < 0 ) {
562- err = - errno ;
563- printk (UM_KERN_ERR "%s : PTRACE_SETOPTIONS failed, errno = %d\n" ,
564- __func__ , errno );
565- goto out_kill ;
566- }
567-
568- return pid ;
569-
570- out_kill :
571- os_kill_ptraced_process (pid , 1 );
572- return err ;
573- }
574-
575467void new_thread (void * stack , jmp_buf * buf , void (* handler )(void ))
576468{
577469 (* buf )[0 ].JB_IP = (unsigned long ) handler ;
0 commit comments