<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>Actually, in 3.4 kernel, esp0 is initialized in copy_thread function called by copy_process when a new process is forked. <br><br><div id="imail_signature"><br></div></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日 11:30,<a style="text-decoration:none;color:#2a97ff;" href="mailto:xerofoify@gmail.com">nick</a> 写道:</div></div><blockquote id="ntes-iosmail-quote" style="margin:0">
<br>
<br>On 2015-06-16 11:11 PM, hitmoon wrote:
<br>>
<br>> Thanks for your reply!
<br>> I read the manual, it is said that the esp0 is a static field of tss, and it
<br>> will not change for a particular task. So it is initialized with kernel stack
<br>> top (empty kernel stack)of a process when it is executed for the first time, right?
<br>> 在2015年06月17日 04:46,David Matlack <mailto:matlackdavid@gmail.com> 写道:
<br>>
<br>> 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>>
<br>>
<br>>
<br>>
<br>> _______________________________________________
<br>> Kernelnewbies mailing list
<br>> Kernelnewbies@kernelnewbies.org
<br>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
<br>>
<br>I haven't read the manual for Intel Programmers in a few months and don't remember it all but
<br>that seems 100% percent correct from my memory :).
<br>Nick
<br></blockquote>
</div>
</body></html>