提交 809ef596 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Ensure allocproc is amd64 ABI compliant.

上级 ef62aebd
......@@ -145,7 +145,12 @@ allocproc(void)
// Leave room for trap frame.
sp -= sizeof *p->tf;
p->tf = (struct trapframe*)sp;
// amd64 ABI mandates sp % 16 == 0 before a call instruction
// (or after executing a ret instruction)
if ((uptr) sp % 16)
panic("allocproc: misaligned sp");
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 8;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论