slow_work_pending 的 arm 架构的最新内核代码是否错误?

Is latest kernel code for arm architecture wrong at slow_work_pending?

目前我正在为 ARM 架构使用嵌入式 Linux 内核。作为 bootlin 提供的最新内核源代码,我在 arch/arm/kernel/entry-common.S:

中看到了这些代码
slow_work_pending:
    mov r0, sp    @'regs'
    mov r2, why    @'syscall'
    bl do_work_pending

do_work_pending()syscall 参数应该是 r1 吗?

我已经尝试通过在内核启动时打印该参数来调试它。当时why寄存器应该是0,但是printk说syscall是-173b500.

这些代码是错误的还是故意编码的?

我假设在内核启动时 why 应该是 0,因为它不是真正的系统调用,但是用 printk 打印它给我一个奇怪的负数。我对 why 的理解有误吗?

看到最近的上游源代码如何具有相同的代码(即使文件名已更改为用 - 替换 _)那么除非它是一个极其罕见的代码路径,这可能没有错。您可能误解了这里发生的事情。

不过还是看具体的吧

slow_work_pending:
    mov r0, sp    @'regs'
    mov r2, why    @'syscall'
    bl do_work_pending

Do syscall parameter of do_work_pending() suppose to be r1 ?

考虑在 signal.c

中找到的函数原型
asmlinkage int
do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)

看起来答案是 "no" - syscall 是第三个参数,因此应该在 r2 中,因为 r1 包含 thread_flags - 并且可能之前已经这样做了您检查过的 slow_work_pending 周围的代码。