On Thursday 29 April 2005, Blaisorblade wrote: > What's kernel_thread_helper?
kernel_thread_helper and kernel_thread are defined in i386 as following: ----------------------------------------------- /* * This gets run with %ebx containing the * function to call, and %edx containing * the "args". */ extern void kernel_thread_helper(void); __asm__(".section .text\n" ".align 4\n" "kernel_thread_helper:\n\t" "movl %edx,%eax\n\t" "pushl %edx\n\t" "call *%ebx\n\t" "pushl %eax\n\t" "call do_exit\n" ".previous"); /* * Create a kernel thread */ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { struct pt_regs regs; /* BProc: (SLAVE) kernel forks are not subject to BProc's * remote process management stuff. */ bproc_kcall(); memset(®s, 0, sizeof(regs)); regs.ebx = (unsigned long) fn; regs.edx = (unsigned long) arg; regs.xds = __USER_DS; regs.xes = __USER_DS; regs.orig_eax = -1; regs.eip = (unsigned long) kernel_thread_helper; regs.xcs = __KERNEL_CS; regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; /* Ok, create the new process.. */ return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); } ----------------------------------------------- I think kernel_thread_helper make the new generated kernel thread to call the function and then exit. But in UML there is no kernel_thread_helper. Then how does UML make its kernel thread call the function and then exit? Thanks a lot! Alex ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel