ohh, thanks. its a correct. i setted up in set_user_regs context on binary module, and then they started. but i still dont make other kernel threads. when context_switch from one kernel_thread to another (for example, when thread_sleep acquire, and first in list idle_thread), anytime will be called swap_function? and i made in boot_script_exec_cmd a kernel_thread for user_bootstrap instead of thread_create+thread_start (no doswapin), because i have a kernel_stack=0, and cant run user_bootstrap. i think its not corrent (my solution), should i do it on active_stack ?
thanks for answers. > > 1. when thread_call in bootstrap.c called, context switch acquire. and > > im looked on x86 sources, and dont see when CPU should switch in > > different mode for correct context switching. any help? > > Note that usually one doesn't explicitly switch to user mode, but do as > if one returns to user mode. In bootstrap.c, see the “Exit to user > thread” comment above thread_bootstrap_return, implemented in entry.S: > “Called as a function, makes the current thread return from the kernel > as if from an exception.”, i.e. build_args_and_stack()/set_user_regs() > have prepared the context of a stack looking just like the first thing > the processus has done was to take a trap. > >

