* [uml-devel] Question about kernel_thread in UML TT mode
@ 2005-04-28 10:00 Alex LIU
2005-04-29 20:20 ` Blaisorblade
0 siblings, 1 reply; 4+ messages in thread
From: Alex LIU @ 2005-04-28 10:00 UTC (permalink / raw)
To: UML-dev
Hi,all:
I found UML only implement its own kernel_thread function but doesn't implement kernel_thread_helper function.
Then how does UML start a kernel thread in TT mode? Is there any other functions being called? 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [uml-devel] Question about kernel_thread in UML TT mode
2005-04-29 20:20 ` Blaisorblade
@ 2005-04-29 9:40 ` Alex LIU
2005-04-29 11:39 ` stian
0 siblings, 1 reply; 4+ messages in thread
From: Alex LIU @ 2005-04-29 9:40 UTC (permalink / raw)
To: 'Blaisorblade', user-mode-linux-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [uml-devel] Question about kernel_thread in UML TT mode
2005-04-29 9:40 ` Alex LIU
@ 2005-04-29 11:39 ` stian
0 siblings, 0 replies; 4+ messages in thread
From: stian @ 2005-04-29 11:39 UTC (permalink / raw)
To: Alex LIU; +Cc: 'Blaisorblade', user-mode-linux-devel
> 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");
kernel_thread helper is just a dummy wrapper to feed into kernel_thread
and can probably look at as a static local function only for use of x86
implementation of kernel_thread.
Stian
-------------------------------------------------------
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=105hix
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Question about kernel_thread in UML TT mode
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
0 siblings, 1 reply; 4+ messages in thread
From: Blaisorblade @ 2005-04-29 20:20 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Alex LIU
On Thursday 28 April 2005 12:00, Alex LIU wrote:
> Hi,all:
>
> I found UML only implement its own kernel_thread function but doesn't
> implement kernel_thread_helper function.
??? What's kernel_thread_helper? kernel_thread calls the arch-independent
do_fork(), which works like the rest. In particular, it will call the
arch-specific copy_thread; and copy_thread_tt will do the necessary work.
> Then how does UML start a kernel
> thread in TT mode? Is there any other functions being called? Thanks a lot!
> Alex
--
Paolo Giarrusso, aka Blaisorblade
Skype user "PaoloGiarrusso"
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
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=105hix
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-29 11:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2005-04-29 11:39 ` stian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox