blob: 6b1b44d71028f9573d53372e23e5b361ff7ddfa9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* bug.h: FRV bug trapping
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_BUG_H
12#define _ASM_BUG_H
13
David Howells41be6ae2006-01-08 01:01:25 -080014#include <linux/linkage.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Matt Mackallc8538a72005-05-01 08:59:01 -070016#ifdef CONFIG_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070017/*
18 * Tell the user there is some problem.
19 */
20extern asmlinkage void __debug_bug_trap(int signr);
21
22#ifdef CONFIG_NO_KERNEL_MSG
23#define _debug_bug_printk()
24#else
25extern void __debug_bug_printk(const char *file, unsigned line);
26#define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__)
27#endif
28
29#define _debug_bug_trap(signr) \
30do { \
31 __debug_bug_trap(signr); \
32 asm volatile("nop"); \
33} while(0)
34
35#define HAVE_ARCH_BUG
36#define BUG() \
37do { \
38 _debug_bug_printk(); \
39 _debug_bug_trap(6 /*SIGABRT*/); \
40} while (0)
41
42#ifdef CONFIG_GDBSTUB
43#define HAVE_ARCH_KGDB_RAISE
44#define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0)
45
46#define HAVE_ARCH_KGDB_BAD_PAGE
47#define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
48#endif
Matt Mackallc8538a72005-05-01 08:59:01 -070049#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51#include <asm-generic/bug.h>
52
53#endif