|
From: Dave A. <ai...@us...> - 2003-06-10 01:14:51
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/sparc/mm
In directory sc8-pr-cvs1:/tmp/cvs-serv7538/arch/sparc/mm
Modified Files:
extable.c fault.c init.c
Log Message:
DA: sync with Marcelo 2.4.17
Index: extable.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc/mm/extable.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- extable.c 10 Apr 2002 15:17:43 -0000 1.2
+++ extable.c 10 Jun 2003 01:13:17 -0000 1.3
@@ -11,35 +11,49 @@
static unsigned long
search_one_table(const struct exception_table_entry *start,
- const struct exception_table_entry *last,
+ const struct exception_table_entry *end,
unsigned long value, unsigned long *g2)
{
- const struct exception_table_entry *first = start;
- const struct exception_table_entry *mid;
- long diff = 0;
- while (first <= last) {
- mid = (last - first) / 2 + first;
- diff = mid->insn - value;
- if (diff == 0) {
- if (!mid->fixup) {
- *g2 = 0;
- return (mid + 1)->fixup;
- } else
- return mid->fixup;
- } else if (diff < 0)
- first = mid+1;
- else
- last = mid-1;
- }
- if (last->insn < value && !last->fixup && last[1].insn > value) {
- *g2 = (value - last->insn)/4;
- return last[1].fixup;
- }
- if (first > start && first[-1].insn < value
- && !first[-1].fixup && first->insn < value) {
- *g2 = (value - first[-1].insn)/4;
- return first->fixup;
- }
+ const struct exception_table_entry *walk;
+
+ /* Single insn entries are encoded as:
+ * word 1: insn address
+ * word 2: fixup code address
+ *
+ * Range entries are encoded as:
+ * word 1: first insn address
+ * word 2: 0
+ * word 3: last insn address + 4 bytes
+ * word 4: fixup code address
+ *
+ * See asm/uaccess.h for more details.
+ */
+
+ /* 1. Try to find an exact match. */
+ for (walk = start; walk <= end; walk++) {
+ if (walk->fixup == 0) {
+ /* A range entry, skip both parts. */
+ walk++;
+ continue;
+ }
+
+ if (walk->insn == value)
+ return walk->fixup;
+ }
+
+ /* 2. Try to find a range match. */
+ for (walk = start; walk <= (end - 1); walk++) {
+ if (walk->fixup)
+ continue;
+
+ if (walk[0].insn <= value &&
+ walk[1].insn > value) {
+ *g2 = (value - walk[0].insn) / 4;
+ return walk[1].fixup;
+ }
+ walk++;
+ }
+
return 0;
}
Index: fault.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc/mm/fault.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fault.c 10 Apr 2002 15:17:43 -0000 1.2
+++ fault.c 10 Jun 2003 01:13:17 -0000 1.3
@@ -155,34 +155,47 @@
asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
unsigned long address)
{
+ struct pt_regs regs;
unsigned long g2;
+ unsigned int insn;
int i;
- unsigned insn;
- struct pt_regs regs;
- i = search_exception_table (ret_pc, &g2);
+ i = search_exception_table(ret_pc, &g2);
switch (i) {
- /* load & store will be handled by fixup */
- case 3: return 3;
- /* store will be handled by fixup, load will bump out */
- /* for _to_ macros */
- case 1: insn = (unsigned)pc; if ((insn >> 21) & 1) return 1; break;
- /* load will be handled by fixup, store will bump out */
- /* for _from_ macros */
- case 2: insn = (unsigned)pc;
- if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15) return 2;
+ case 3:
+ /* load & store will be handled by fixup */
+ return 3;
+
+ case 1:
+ /* store will be handled by fixup, load will bump out */
+ /* for _to_ macros */
+ insn = *((unsigned int *) pc);
+ if ((insn >> 21) & 1)
+ return 1;
+ break;
+
+ case 2:
+ /* load will be handled by fixup, store will bump out */
+ /* for _from_ macros */
+ insn = *((unsigned int *) pc);
+ if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15)
+ return 2;
break;
- default: break;
- }
- memset (®s, 0, sizeof (regs));
+
+ default:
+ break;
+ };
+
+ memset(®s, 0, sizeof (regs));
regs.pc = pc;
regs.npc = pc + 4;
- __asm__ __volatile__ (
+ __asm__ __volatile__(
"rd %%psr, %0\n\t"
"nop\n\t"
"nop\n\t"
"nop\n" : "=r" (regs.psr));
- unhandled_fault (address, current, ®s);
+ unhandled_fault(address, current, ®s);
+
/* Not reached */
return 0;
}
Index: init.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc/mm/init.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- init.c 10 Apr 2002 15:17:43 -0000 1.2
+++ init.c 10 Jun 2003 01:13:17 -0000 1.3
@@ -410,9 +410,6 @@
int datapages = 0;
int initpages = 0;
int i;
-#ifdef CONFIG_BLK_DEV_INITRD
- unsigned long addr, last;
-#endif
highmem_start_page = mem_map + highstart_pfn;
|