“非法指令(核心转储)”究竟是什么意思?

Eva*_*oll 5 cpu error-handling x86 linux-kernel intel

我看到了很多解决问题的解决方案,例如

非法指令(核心转储)

但是,我想知道这到底是什么意思?是什么导致了该错误,其根本原因是什么?CPU 是否得到了它认为是指令但无法解码的人?引擎盖下会发生什么来产生该错误?

dmesg,我看到

[429572.598803] traps: test[4054] trap invalid opcode ip:400066 sp:ffac8cc0 error:0 in test[400000+1000]
[429758.598292] traps: test[4401] trap invalid opcode ip:400066 sp:ffa3f990 error:0 in test[400000+1000]
[430066.170626] traps: test[4854] trap invalid opcode ip:400066 sp:ff8ab000 error:0 in test[400000+1000]
[430439.855002] traps: test[5212] trap invalid opcode ip:8048071 sp:ffce2fa0 error:0 in test[8048000+1000]
Run Code Online (Sandbox Code Playgroud)

Eva*_*oll 3

对于 x86。SIGILL这个屏幕上的错误似乎是由内核发送的结果,这是在kernel/traps.ccatch中定义的“CPU 陷阱” X86_TRAP_UD。它是直接从 CPU 引发的其他一些类别中的一个,其中包括:

X86_TRAP_DE,        divide_error
X86_TRAP_NMI,       nmi
X86_TRAP_BR,        bounds
X86_TRAP_UD,        invalid_op
X86_TRAP_NM,        device_not_available
X86_TRAP_OLD_MF,    coprocessor_segment_overrun
X86_TRAP_TS,        invalid_TSS
X86_TRAP_NP,        segment_not_present
X86_TRAP_SS,        stack_segment
X86_TRAP_GP,        general_protection
X86_TRAP_SPURIOUS,  spurious_interrupt_bug
X86_TRAP_MF,        coprocessor_error
X86_TRAP_AC,        alignment_check
X86_TRAP_XF,        simd_coprocessor_error
Run Code Online (Sandbox Code Playgroud)

为了娱乐,您可以在此处查看通过高尔夫演示这一点的程序列表