内核用于ARM的Oops页面错误代码

时间:2012-11-09 04:17:23

标签: linux linux-kernel arm fault

Oops之后的错误代码提供了有关恐慌的信息。 Oops: 17 [#1] PREEMPT SMP 在这种情况下,17提供了哪些信息。 在x86中它代表 -

  • bit 0 == 0: no page found 1: protection fault

  • bit 1 == 0: read access 1: write access

  • bit 2 == 0: kernel-mode access 1: user-mode access

  • bit 3 == 1: use of reserved bit detected

  • bit 4 == 1: fault was an instruction fetch

但我无法找到任何信息。

由于 Shunty

2 个答案:

答案 0 :(得分:1)

您在上面打印的位数描述是页面错误描述,而不是Oops错误。

有关查找Linux崩溃分析的更多信息,请参阅Linux的oops-tracing

以下是Oops: 17 [#1] PREEMPT SMP arch/arm/kernel/traps.c

的方式
    #define S_PREEMPT " PREEMPT"
    ...
    #define S_SMP " SMP"
    ...
    printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP S_ISA "\n", str, err, ++die_counter);

页面错误不需要崩溃内核,也不是所有内核崩溃都是页面错误。因此Oops: 17很可能与页面错误无关。 (作为奖励,我疯狂的猜测是关于安排/只是我熟悉的声音。)

答案 1 :(得分:1)

您似乎在询问 ARM故障状态寄存器(FSR)位。我查找了内核代码(arch / arm / mm / fault.c),发现这实际上是作为Oops代码的参数传递的:

    static void
    __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
              struct pt_regs *regs)
    {
    [...]
        pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
             (addr < PAGE_SIZE) ? "NULL pointer dereference" :
             "paging request", addr);

        show_pte(mm, addr);
        die("Oops", regs, **fsr**);
   [...]
   }

所以,无论如何,我追溯到ARM上的FSR寄存器(v4及更高版本?)MMU:

来源:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438d/BABFFDFD.html

...
    [3:0]   FS[3:0] 
    Fault Status bits. This field indicates the type of exception generated. Any encoding not listed is reserved:
    b00001
       Alignment fault.
    b00100
       Instruction cache maintenance fault[a].
    b01100
       Synchronous external abort on translation table walk, 1st level.
    b01110
       Synchronous external abort on translation table walk, 2nd level.
    b11100
       Synchronous parity error on translation table walk, 1st level.
    b11110
       Synchronous parity error on translation table walk, 2nd level.
    b00101
       Translation fault, 1st level.
    b00111
       Translation fault, 2nd level.
    b00011
       Access flag fault, 1st level.
    b00110
       Access flag fault, 2nd level.
    b01001
       Domain fault, 1st level.
    b01011
       Domain fault, 2nd level.
    b01101
       Permission fault, 1st level.
    b01111
       Permission fault, 2nd level.
    b00010
       Debug event.
    b01000
       Synchronous external abort, non-translation.
    b11001
       Synchronous parity error on memory access.
    b10110
       Asynchronous external abort.
    b11000
       Asynchronous parity error on memory access.

...

免责声明:我不知道此信息是否仍然相关;该文件声称它是针对ARM Cortex A15的,并且该页面被标记为Superseded。

还可以看到此页面: ARM926EJ-S Fault address and fault status registers