In the linux kernel, the thread_struct data structure contains both the esp0 and esp fields, what is the difference?

This is my guess:

esp0 is initialized by the top addr. when the kernel stack is allocated, and it is used during the process switch to initialize tss-> esp0, so that when the context switches from user mode to kernel mode, the kernel stack can be located; while esp is used to save the top stack of the process kernel, which should be scheduled during the process switch.

Thus, esp0 in thread_struct does not change after initialization, but esp changes.

Did I understand correctly?

+3
source share
1 answer

thread_struct ESP, esp0 ESP. tss_segment_32, esp0, esp1, esp2 ESP.

TSS, Intel, Linus .

, TSS, , , x86. , ( ESP, 3 , , esp3).

, , , . Linux 0 ( ) 3 ( ), esp0 ESP , .


, , , - , , OS/2, 2 -. , , , 2, /, .

+1

Source: https://habr.com/ru/post/1785836/


All Articles