Note that usually one doesn't explicitly switch to user mode, but do as
> 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?
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.