what the difference between esp and esp0?

David Matlack matlackdavid at gmail.com
Tue Jun 16 16:46:29 EDT 2015


On Tue, Jun 16, 2015 at 4:27 AM, hitmoon <zhaoxiaoqiang007 at gmail.com> wrote:
> Hi:
>     I recently read the book "understanding the linux kernel 3rd", in the
> task switch process, there are two esp in thread_struct. In macro
> 'switch_to' , The esp is loaded to switch to the next's kernel stack,  but
> in '__switch_to', esp0 is copied to tss's esp0 field, what the esp0 mean?
> What the difference between them?

esp0 is the stack pointer that is loaded into esp when the privileged level
changes to 0. For example, when a process running in user mode (level 3)
jumps into the kernel via a system call.

You can read more about it in the Intel SDM, Volume 3 Chapter 7.
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html



More information about the Kernelnewbies mailing list