<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>
<div id="contentDescription" style="line-height:1.5;text-align:justify;text-justify:inter-ideograph">
<div><br></div><div>Thanks for your reply!</div><div>I read the manual, it is said that the esp0 is a static field of tss, and it will not change for a particular task. So it is initialized with kernel stack top (empty kernel stack)of a process when it is executed for the first time, right? </div>
<div class="borderFixWidth iMailDoNotReScale" style="background-color:#f2f2f2;color:black;padding-top:6px;padding-bottom:6px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;margin-top:45px;margin-bottom:20px;"><div style="font-size:14px;line-height:1.5;word-break:break-all;margin-left:10px;margin-right:10px">在2015年06月17日 04:46,<a style="text-decoration:none;color:#2a97ff;" href="mailto:matlackdavid@gmail.com">David Matlack</a> 写道:</div></div><blockquote id="ntes-iosmail-quote" style="margin:0">On Tue, Jun 16, 2015 at 4:27 AM, hitmoon <zhaoxiaoqiang007@gmail.com> wrote:
<br>> Hi:
<br>> I recently read the book "understanding the linux kernel 3rd", in the
<br>> task switch process, there are two esp in thread_struct. In macro
<br>> 'switch_to' , The esp is loaded to switch to the next's kernel stack, but
<br>> in '__switch_to', esp0 is copied to tss's esp0 field, what the esp0 mean?
<br>> What the difference between them?
<br>
<br>esp0 is the stack pointer that is loaded into esp when the privileged level
<br>changes to 0. For example, when a process running in user mode (level 3)
<br>jumps into the kernel via a system call.
<br>
<br>You can read more about it in the Intel SDM, Volume 3 Chapter 7.
<br>http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
<br></blockquote>
</div>
</body></html>