Xunop / kernel

Other
0 stars 0 forks source link

return with modified stack frame #4

Open Xunop opened 1 year ago

Xunop commented 1 year ago

Warning Content

Please describe the warning content here.

Warning File

File: kernel/fork.o

Warning Instruction

Line: line_number Instruction: problematic_instruction

Steps to Reproduce

  1. ...
  2. ...

Additional Information

Xunop commented 1 year ago

https://github.com/Xunop/kernel/commit/ff6e30b51adfd1101600458b8838d0f337a97103 这个 commit 中,新增了以下代码:

        if (!cfi->drap && op->dest.reg == cfa->base &&
                op->dest.reg == CFI_BP) {

                /* mov disp(%rsp), %rbp */
                cfa->base = CFI_SP;
                cfa->offset = cfi->stack_size;
            }

这段代码将正确处理 aarch64 中的 ldp x29, x30, [sp], #48 指令,确保恢复 x29, x30 寄存器。