160ffc30dSCatalin Marinas /* 260ffc30dSCatalin Marinas * Based on arch/arm/include/asm/traps.h 360ffc30dSCatalin Marinas * 460ffc30dSCatalin Marinas * Copyright (C) 2012 ARM Ltd. 560ffc30dSCatalin Marinas * 660ffc30dSCatalin Marinas * This program is free software; you can redistribute it and/or modify 760ffc30dSCatalin Marinas * it under the terms of the GNU General Public License version 2 as 860ffc30dSCatalin Marinas * published by the Free Software Foundation. 960ffc30dSCatalin Marinas * 1060ffc30dSCatalin Marinas * This program is distributed in the hope that it will be useful, 1160ffc30dSCatalin Marinas * but WITHOUT ANY WARRANTY; without even the implied warranty of 1260ffc30dSCatalin Marinas * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1360ffc30dSCatalin Marinas * GNU General Public License for more details. 1460ffc30dSCatalin Marinas * 1560ffc30dSCatalin Marinas * You should have received a copy of the GNU General Public License 1660ffc30dSCatalin Marinas * along with this program. If not, see <http://www.gnu.org/licenses/>. 1760ffc30dSCatalin Marinas */ 1860ffc30dSCatalin Marinas #ifndef __ASM_TRAP_H 1960ffc30dSCatalin Marinas #define __ASM_TRAP_H 2060ffc30dSCatalin Marinas 219b79f52dSPunit Agrawal #include <linux/list.h> 229b79f52dSPunit Agrawal 239b79f52dSPunit Agrawal struct pt_regs; 249b79f52dSPunit Agrawal 259b79f52dSPunit Agrawal struct undef_hook { 269b79f52dSPunit Agrawal struct list_head node; 279b79f52dSPunit Agrawal u32 instr_mask; 289b79f52dSPunit Agrawal u32 instr_val; 299b79f52dSPunit Agrawal u64 pstate_mask; 309b79f52dSPunit Agrawal u64 pstate_val; 319b79f52dSPunit Agrawal int (*fn)(struct pt_regs *regs, u32 instr); 329b79f52dSPunit Agrawal }; 339b79f52dSPunit Agrawal 349b79f52dSPunit Agrawal void register_undef_hook(struct undef_hook *hook); 359b79f52dSPunit Agrawal void unregister_undef_hook(struct undef_hook *hook); 369b79f52dSPunit Agrawal 3760ffc30dSCatalin Marinas static inline int in_exception_text(unsigned long ptr) 3860ffc30dSCatalin Marinas { 3960ffc30dSCatalin Marinas extern char __exception_text_start[]; 4060ffc30dSCatalin Marinas extern char __exception_text_end[]; 4160ffc30dSCatalin Marinas 4260ffc30dSCatalin Marinas return ptr >= (unsigned long)&__exception_text_start && 4360ffc30dSCatalin Marinas ptr < (unsigned long)&__exception_text_end; 4460ffc30dSCatalin Marinas } 4560ffc30dSCatalin Marinas 4660ffc30dSCatalin Marinas #endif 47