~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/include/asm/bug.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2012 Regents of the University of California
  4  */
  5 
  6 #ifndef _ASM_RISCV_BUG_H
  7 #define _ASM_RISCV_BUG_H
  8 
  9 #include <linux/compiler.h>
 10 #include <linux/const.h>
 11 #include <linux/types.h>
 12 
 13 #include <asm/asm.h>
 14 
 15 #define __INSN_LENGTH_MASK  _UL(0x3)
 16 #define __INSN_LENGTH_32    _UL(0x3)
 17 #define __COMPRESSED_INSN_MASK  _UL(0xffff)
 18 
 19 #define __BUG_INSN_32   _UL(0x00100073) /* ebreak */
 20 #define __BUG_INSN_16   _UL(0x9002) /* c.ebreak */
 21 
 22 #define GET_INSN_LENGTH(insn)                                           \
 23 ({                                                                      \
 24         unsigned long __len;                                            \
 25         __len = ((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ?     \
 26                 4UL : 2UL;                                              \
 27         __len;                                                          \
 28 })
 29 
 30 typedef u32 bug_insn_t;
 31 
 32 #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
 33 #define __BUG_ENTRY_ADDR        RISCV_INT " 1b - ."
 34 #define __BUG_ENTRY_FILE        RISCV_INT " %0 - ."
 35 #else
 36 #define __BUG_ENTRY_ADDR        RISCV_PTR " 1b"
 37 #define __BUG_ENTRY_FILE        RISCV_PTR " %0"
 38 #endif
 39 
 40 #ifdef CONFIG_DEBUG_BUGVERBOSE
 41 #define __BUG_ENTRY                     \
 42         __BUG_ENTRY_ADDR "\n\t"         \
 43         __BUG_ENTRY_FILE "\n\t"         \
 44         RISCV_SHORT " %1\n\t"           \
 45         RISCV_SHORT " %2"
 46 #else
 47 #define __BUG_ENTRY                     \
 48         __BUG_ENTRY_ADDR "\n\t"         \
 49         RISCV_SHORT " %2"
 50 #endif
 51 
 52 #ifdef CONFIG_GENERIC_BUG
 53 #define __BUG_FLAGS(flags)                                      \
 54 do {                                                            \
 55         __asm__ __volatile__ (                                  \
 56                 "1:\n\t"                                        \
 57                         "ebreak\n"                              \
 58                         ".pushsection __bug_table,\"aw\"\n\t"   \
 59                 "2:\n\t"                                        \
 60                         __BUG_ENTRY "\n\t"                      \
 61                         ".org 2b + %3\n\t"                      \
 62                         ".popsection"                           \
 63                 :                                               \
 64                 : "i" (__FILE__), "i" (__LINE__),               \
 65                   "i" (flags),                                  \
 66                   "i" (sizeof(struct bug_entry)));              \
 67 } while (0)
 68 #else /* CONFIG_GENERIC_BUG */
 69 #define __BUG_FLAGS(flags) do {                                 \
 70         __asm__ __volatile__ ("ebreak\n");                      \
 71 } while (0)
 72 #endif /* CONFIG_GENERIC_BUG */
 73 
 74 #define BUG() do {                                              \
 75         __BUG_FLAGS(0);                                         \
 76         unreachable();                                          \
 77 } while (0)
 78 
 79 #define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
 80 
 81 #define HAVE_ARCH_BUG
 82 
 83 #include <asm-generic/bug.h>
 84 
 85 struct pt_regs;
 86 struct task_struct;
 87 
 88 void __show_regs(struct pt_regs *regs);
 89 void die(struct pt_regs *regs, const char *str);
 90 void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr);
 91 
 92 #endif /* _ASM_RISCV_BUG_H */
 93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php