Skip to contentSkip to conversation

when does "init" become usermode process

DISCUSSION [email protected] 2 participants 2 messages Feb 14, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,
I was reading the kernel boot code toward the end where kernel's init thread execve("/sbin/init",x,x). Execve() calls sys_execve() and do_execve(). All the manpage and kernel document told us the init is the first usermode process running in the system. However, when the execve("/sbin/init",x,x) runs in the kernel (init/main.c), I believe we are still in the kernel mode, aren't we? Unless execve() does the trick to turn init into usermode by setting the KU bit in the STATUS register. I checked the execve() code and its not obvious whether it does this or not. I then check the init source code and it does not mess around the KU bit either.

My question is when and how does init turn itself into usermode.

Thanks

sms

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

#1 lore raw
Quoted 2 lines · [email protected] wrote:

My question is when and how does init turn itself into usermode.

Look at 'start_thread' in arch/mips/kernel/process.c, which is called from load_elf_binary in fs/binfmt_elf.c (as a result of the execve syscall).

Kip