You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a thread needs to access the struct task_struct of its process, it first needs to locate its struct thread_info in the kernel stack and then follow its task field pointer which leads us in turn to the struct task_struct of the proces
structthread_info {
structpcb_structpcb; /* palcode state */structtask_struct*task; /* main task structure */unsigned intflags; /* low level flags */unsigned intieee_state; /* see fpu.h */mm_segment_taddr_limit; /* thread address space */unsignedcpu; /* current CPU */intpreempt_count; /* 0 => preemptable, <0 => BUG */unsigned intstatus; /* thread-synchronous flags */intbpt_nsaved;
unsigned longbpt_addr[2]; /* breakpoint handling */unsigned intbpt_insn[2];
};
#definecurrent (current_thread_info()->task) //获取当前线程所在的进程task_struct
When this function executes, it executes on behalf of a thread that is trying to use the current global macro. As with any system call or trap to the kernel, the thread's kernel stack is used to hold the activation records for the function calls made while executing kernel code. This means that the local variable ti' is located on the kernel stack of the thread and its address is therefore within the kernel stack.
The text was updated successfully, but these errors were encountered:
katsusan
changed the title
linux process management
linux process kernel stack
Jun 26, 2020
https://kernelnewbies.org/FAQ/current
When a thread needs to access the struct task_struct of its process, it first needs to locate its struct thread_info in the kernel stack and then follow its task field pointer which leads us in turn to the struct task_struct of the proces
When this function executes, it executes on behalf of a thread that is trying to use the current global macro. As with any system call or trap to the kernel, the thread's kernel stack is used to hold the activation records for the function calls made while executing kernel code. This means that the local variable ti' is located on the kernel stack of the thread and its address is therefore within the kernel stack.
The text was updated successfully, but these errors were encountered: