XV6 swtch.S详解 swtch函数的执行过程: void swtch(struct context **old, struct context *new); 当任意进程调用swtch函数时,会将它的两个参数压栈,并且将swtch的下一条指令的地址压栈(即EIP),ESP寄存器保存栈顶地址,函数调用时,context *new 和context *old都作为已知参数传入。此时它的栈空间是这样的: movl 4(%esp), %eax movl 8(%es