]> git.hungrycats.org Git - linux/commitdiff
[PATCH] add exception table support for m68knommu architecture
authorGreg Ungerer <gerg@snapgear.com>
Tue, 18 Feb 2003 13:45:34 +0000 (05:45 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 18 Feb 2003 13:45:34 +0000 (05:45 -0800)
This patch adds exception table support for the m68knommu architecture.

arch/m68knommu/mm/extable.c [new file with mode: 0644]

diff --git a/arch/m68knommu/mm/extable.c b/arch/m68knommu/mm/extable.c
new file mode 100644 (file)
index 0000000..888202c
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * linux/arch/m68knommu/mm/extable.c
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <asm/uaccess.h>
+
+/* Simple binary search */
+const struct exception_table_entry *
+search_extable(const struct exception_table_entry *first,
+              const struct exception_table_entry *last,
+              unsigned long value)
+{
+        while (first <= last) {
+               const struct exception_table_entry *mid;
+               long diff;
+
+               mid = (last - first) / 2 + first;
+               diff = mid->insn - value;
+                if (diff == 0)
+                        return mid;
+                else if (diff < 0)
+                        first = mid+1;
+                else
+                        last = mid-1;
+        }
+        return NULL;
+}