1/* 2 * linux/arch/x86_64/mm/extable.c 3 */ 4 5#include <linux/module.h> 6#include <linux/spinlock.h> 7#include <linux/init.h> 8#include <asm/uaccess.h> 9 10/* Simple binary search */ 11const struct exception_table_entry * 12search_extable(const struct exception_table_entry *first, 13 const struct exception_table_entry *last, 14 unsigned long value) 15{ 16 if ((value >> 32) == 0) 17 value |= 0xffffffffUL << 32; 18 19 while (first <= last) { 20 const struct exception_table_entry *mid; 21 long diff; 22 23 mid = (last - first) / 2 + first; 24 diff = mid->insn - value; 25 if (diff == 0) 26 return mid; 27 else if (diff < 0) 28 first = mid+1; 29 else 30 last = mid-1; 31 } 32 return NULL; 33} 34