Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* 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 | |
| 14 | #include <linux/config.h> |
David Howells | 41be6ae | 2006-01-08 01:01:25 -0800 | [diff] [blame] | 15 | #include <linux/linkage.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 17 | #ifdef CONFIG_BUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | /* |
| 19 | * Tell the user there is some problem. |
| 20 | */ |
| 21 | extern asmlinkage void __debug_bug_trap(int signr); |
| 22 | |
| 23 | #ifdef CONFIG_NO_KERNEL_MSG |
| 24 | #define _debug_bug_printk() |
| 25 | #else |
| 26 | extern void __debug_bug_printk(const char *file, unsigned line); |
| 27 | #define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__) |
| 28 | #endif |
| 29 | |
| 30 | #define _debug_bug_trap(signr) \ |
| 31 | do { \ |
| 32 | __debug_bug_trap(signr); \ |
| 33 | asm volatile("nop"); \ |
| 34 | } while(0) |
| 35 | |
| 36 | #define HAVE_ARCH_BUG |
| 37 | #define BUG() \ |
| 38 | do { \ |
| 39 | _debug_bug_printk(); \ |
| 40 | _debug_bug_trap(6 /*SIGABRT*/); \ |
| 41 | } while (0) |
| 42 | |
| 43 | #ifdef CONFIG_GDBSTUB |
| 44 | #define HAVE_ARCH_KGDB_RAISE |
| 45 | #define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0) |
| 46 | |
| 47 | #define HAVE_ARCH_KGDB_BAD_PAGE |
| 48 | #define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0) |
| 49 | #endif |
Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 50 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | #include <asm-generic/bug.h> |
| 53 | |
| 54 | #endif |