From: Alex LIU <alex.liu@st.com>
To: 'Blaisorblade' <blaisorblade@yahoo.it>,
user-mode-linux-devel@lists.sourceforge.net
Subject: RE: [uml-devel] Question about kernel_thread in UML TT mode
Date: Fri, 29 Apr 2005 17:40:31 +0800 [thread overview]
Message-ID: <001f01c54c9f$7d9dc5d0$90b3c68a@SHZ.ST.COM> (raw)
In-Reply-To: <200504292220.48040.blaisorblade@yahoo.it>
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?id\x105hix
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2005-04-29 9:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-28 10:00 [uml-devel] Question about kernel_thread in UML TT mode Alex LIU
2005-04-29 20:20 ` Blaisorblade
2005-04-29 9:40 ` Alex LIU [this message]
2005-04-29 11:39 ` stian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001f01c54c9f$7d9dc5d0$90b3c68a@SHZ.ST.COM' \
--to=alex.liu@st.com \
--cc=blaisorblade@yahoo.it \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox