blob: d670f68532f4d159582095eb0f48c73cab0e63f1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Jeff Dikeba180fd2007-10-16 01:27:00 -07002 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Licensed under the GPL
4 */
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include "sysdep/ptrace.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8/* These two are from asm-um/uaccess.h and linux/module.h, check them. */
9struct exception_table_entry
10{
11 unsigned long insn;
12 unsigned long fixup;
13};
14
15const struct exception_table_entry *search_exception_tables(unsigned long add);
16
17/* Compare this to arch/i386/mm/extable.c:fixup_exception() */
Jeff Dike77bf4402007-10-16 01:26:58 -070018int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019{
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 const struct exception_table_entry *fixup;
21
22 fixup = search_exception_tables(address);
Jeff Dikeba180fd2007-10-16 01:27:00 -070023 if (fixup != 0) {
Jeff Dike5d864562007-05-06 14:51:24 -070024 UPT_IP(regs) = fixup->fixup;
Jeff Dikeba180fd2007-10-16 01:27:00 -070025 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 }
Jeff Dikeba180fd2007-10-16 01:27:00 -070027 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028}