• Dave P Martin's avatar
    arm64/BUG: Use BRK instruction for generic BUG traps · 9fb7410f
    Dave P Martin authored
    Currently, the minimal default BUG() implementation from asm-
    generic is used for arm64.
    
    This patch uses the BRK software breakpoint instruction to generate
    a trap instead, similarly to most other arches, with the generic
    BUG code generating the dmesg boilerplate.
    
    This allows bug metadata to be moved to a separate table and
    reduces the amount of inline code at BUG and WARN sites.  This also
    avoids clobbering any registers before they can be dumped.
    
    To mitigate the size of the bug table further, this patch makes
    use of the existing infrastructure for encoding addresses within
    the bug table as 32-bit offsets instead of absolute pointers.
    (Note that this limits the kernel size to 2GB.)
    
    Traps are registered at arch_initcall time for aarch64, but BUG
    has minimal real dependencies and it is desirable to be able to
    generate bug splats as early as possible.  This patch redirects
    all debug exceptions caused by BRK directly to bug_handler() until
    the full debug exception support has been initialised.
    Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    9fb7410f
fault.c 16 KB