On Fri, Mar 16, 2007 at 03:38:27AM +0700, Mulyadi Santosa wrote: > Hi ... > >Hi list, > > > >Reading the kernel threads initialization code I see: > > > >int kernel_thread(...) { > > > > struct pt_regs regs; > > memset(®s, 0, sizeof(regs)); > > [...] > >** regs.xds = __USER_DS; > >** regs.xes = __USER_DS; > > > > I was checking those codes too and I think that is just for satisfying > the requirement of filling struct regs. I guess it is filled with > USER_DS just to pretend the way do_fork is usually called via clone/fork > syscall, that is to create normal user thread. > Commenting those two lines out don't even start init. While using __KERNEL_DS instead of __USER_DS starts init then causes a `Panic: Segment violation at 0x8049798 - Sleeping for 30 seconds'. It may then have an important role than just mimicing user processes, right ? What makes me wonder is that as said in Understanding Linux Kernel (v3): When CPL (Current Privelege level) is equal to 3, the ds register must contain the segment selector of the user data segment. When it's equal to zero, the ds register must contain the segment selector of the kernel data segment. So how come running a kernel thread with DS = __USER_DS ? Thanks, -- Ahmed S. Darwish http://darwish.07.googlepages.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ