Re: [PATCH] sort exception tables
From: "Kirill Korotaev"
Date: Mon Jan 19 2004 - 06:42:18 EST
> +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;
> +}
Please, then if you patch this place add these changes:
while (first <= last) {
const struct exception_table_entry *mid;
- long diff;
mid = (last - first) / 2 + first;
- diff = mid->insn - value;
- if (diff == 0)
+ if (mid->insn == value)
return mid->fixup;
- else if (diff < 0)
+ else if (mid->insn < value)
first = mid+1;
else
last = mid-1;
since using long diff is incorrect here when distance between addresses is greater than 2GB on i386. (e.g. 4gb split).
Kirill
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/