Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 396253b0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "arm64: kernel: Add arch specific bug.h"

parents 5489ab89 526a7734
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ config TRACE_IRQFLAGS_SUPPORT
config RWSEM_GENERIC_SPINLOCK
	def_bool y

config GENERIC_BUG
	def_bool y
	depends on BUG

config GENERIC_HWEIGHT
	def_bool y

+0 −1
Original line number Diff line number Diff line


generic-y += bug.h
generic-y += bugs.h
generic-y += checksum.h
generic-y += clkdev.h
+50 −0
Original line number Diff line number Diff line
#ifndef _ASMARM_BUG_H
#define _ASMARM_BUG_H

#include <linux/linkage.h>

#ifdef CONFIG_BUG

#define BUG_INSTR_VALUE 0xe7f001f2
#define BUG_INSTR_TYPE ".word "

#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
#define _BUG(file, line, value) __BUG(file, line, value)

#ifdef CONFIG_DEBUG_BUGVERBOSE

/*
 * The extra indirection is to ensure that the __FILE__ string comes through
 * OK. Many version of gcc do not support the asm %c parameter which would be
 * preferable to this unpleasantness. We use mergeable string sections to
 * avoid multiple copies of the string appearing in the kernel image.
 */

#define __BUG(__file, __line, __value)				\
do {								\
	asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n"	\
		".pushsection .rodata.str, \"aMS\", 1\n"	\
		"2:\t.asciz " #__file "\n"			\
		".popsection\n"					\
		".pushsection __bug_table,\"a\"\n"		\
		"3:\t.quad 1b, 2b\n"				\
		"\t.word " #__line ", 0\n"			\
		".popsection");					\
	unreachable();						\
} while (0)

#else  /* not CONFIG_DEBUG_BUGVERBOSE */

#define __BUG(__file, __line, __value)				\
do {								\
	asm volatile(BUG_INSTR_TYPE #__value);			\
	unreachable();						\
} while (0)
#endif  /* CONFIG_DEBUG_BUGVERBOSE */

#define HAVE_ARCH_BUG
#endif  /* CONFIG_BUG */

#include <asm-generic/bug.h>

#endif
+19 −2
Original line number Diff line number Diff line
@@ -229,12 +229,17 @@ void die(const char *str, struct pt_regs *regs, int err)
{
	struct thread_info *thread = current_thread_info();
	int ret;
	enum bug_trap_type bug_type = BUG_TRAP_TYPE_NONE;

	oops_enter();

	raw_spin_lock_irq(&die_lock);
	console_verbose();
	bust_spinlocks(1);
	if (!user_mode(regs))
		bug_type = report_bug(regs->pc, regs);
	if (bug_type != BUG_TRAP_TYPE_NONE)
		str = "Oops - BUG";
	ret = __die(str, err, thread, regs);

	if (regs && kexec_should_crash(thread->task))
@@ -262,6 +267,18 @@ void arm64_notify_die(const char *str, struct pt_regs *regs,
		die(str, regs, err);
}

#ifdef CONFIG_GENERIC_BUG
int is_valid_bugaddr(unsigned long pc)
{
	u32 bkpt;

	if (probe_kernel_address((void *)pc, bkpt))
		return 0;

	return bkpt == BUG_INSTR_VALUE;
}
#endif

static LIST_HEAD(undef_hook);

void register_undef_hook(struct undef_hook *hook)
@@ -312,8 +329,8 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
	trace_undef_instr(regs, (void *)pc);

die_sig:
	if (show_unhandled_signals && unhandled_signal(current, SIGILL) &&
	    printk_ratelimit()) {
	if (user_mode(regs) && show_unhandled_signals &&
		unhandled_signal(current, SIGILL) && printk_ratelimit()) {
		pr_info("%s[%d]: undefined instruction: pc=%p\n",
			current->comm, task_pid_nr(current), pc);
		dump_instr(KERN_INFO, regs);
+5 −0
Original line number Diff line number Diff line
@@ -12,8 +12,13 @@
#include <asm/pgtable.h>
#endif

#if (!defined(CONFIG_DEBUG_SPINLOCK)) || defined(CONFIG_GENERIC_BUG)
#define ARM_EXIT_KEEP(x)	x
#define ARM_EXIT_DISCARD(x)
#else
#define ARM_EXIT_KEEP(x)
#define ARM_EXIT_DISCARD(x)	x
#endif

OUTPUT_ARCH(aarch64)
ENTRY(stext)