xref: /openbmc/linux/arch/x86/um/fault.c (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
15c48b108SAl Viro /*
25c48b108SAl Viro  * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
35c48b108SAl Viro  * Licensed under the GPL
45c48b108SAl Viro  */
55c48b108SAl Viro 
637185b33SAl Viro #include <sysdep/ptrace.h>
75c48b108SAl Viro 
85c48b108SAl Viro /* These two are from asm-um/uaccess.h and linux/module.h, check them. */
95c48b108SAl Viro struct exception_table_entry
105c48b108SAl Viro {
115c48b108SAl Viro 	unsigned long insn;
125c48b108SAl Viro 	unsigned long fixup;
135c48b108SAl Viro };
145c48b108SAl Viro 
155c48b108SAl Viro const struct exception_table_entry *search_exception_tables(unsigned long add);
165c48b108SAl Viro 
175c48b108SAl Viro /* Compare this to arch/i386/mm/extable.c:fixup_exception() */
arch_fixup(unsigned long address,struct uml_pt_regs * regs)185c48b108SAl Viro int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
195c48b108SAl Viro {
205c48b108SAl Viro 	const struct exception_table_entry *fixup;
215c48b108SAl Viro 
225c48b108SAl Viro 	fixup = search_exception_tables(address);
23*7be0b065SSasha Levin 	if (fixup) {
245c48b108SAl Viro 		UPT_IP(regs) = fixup->fixup;
255c48b108SAl Viro 		return 1;
265c48b108SAl Viro 	}
275c48b108SAl Viro 	return 0;
285c48b108SAl Viro }
29