Skip to contentSkip to conversation

Patch to include/asm-mips/processor.h

PATCH Hartvig Ekner 3 participants 3 messages Apr 7, 2003 – Apr 9, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

I have no idea whether what I did was correct, but at least it is no less incorrect than the code currently in there, which coredumps now for some reason (I wonder why it never crashed before). The test-bit macro expects a bit-number, and not a mask which it is given in the current code.

So while fixing this, I also used the normal cpu_data macro for the cpu_has_watch() macro, instead of looking at CPU(0).

/Hartvig

Index: processor.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/processor.h,v retrieving revision 1.43.2.11

processor.h +2 -7
diff -u -r1.43.2.11 processor.h
@@ -66,14 +66,9 @@
 	struct cache_desc tcache;	/* Tertiary/split secondary cache */
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
-/*
- * Assumption: Options of CPU 0 are a superset of all processors.
- * This is true for all known MIPS systems.
- */
-#define cpu_has_watch	(test_bit(MIPS_CPU_WATCH, cpu_data[0].options))
-
 extern struct cpuinfo_mips cpu_data[];
-#define current_cpu_data cpu_data[smp_processor_id()]
+#define current_cpu_data	cpu_data[smp_processor_id()]
+#define cpu_has_watch		(current_cpu_data.options & MIPS_CPU_WATCH)
 
 /*
  * System setup and hardware flags..
#1 lore raw
Quoted 9 lines · Hartvig Ekner

I have no idea whether what I did was correct, but at least it is no less incorrect than the code currently in there, which coredumps now for some reason (I wonder why it never crashed before). The test-bit macro expects a bit-number, and not a mask which it is given in the current code.

So while fixing this, I also used the normal cpu_data macro for the cpu_has_watch() macro, instead of looking at CPU(0).

/Hartvig

The second argument to test_bit ought to have been an address, not a value. Why didn't this crash before? I just ran into it too...

Kip

#2 lore raw
In reply to Hartvig Ekner
Quoted 6 lines · Hartvig Ekner

I have no idea whether what I did was correct, but at least it is no less incorrect than the code currently in there, which coredumps now for some reason (I wonder why it never crashed before). The test-bit macro expects a bit-number, and not a mask which it is given in the current code.

So while fixing this, I also used the normal cpu_data macro for the cpu_has_watch() macro, instead of looking at CPU(0).

The plan was to make the options field a bitfield like on i386 but I changed my mind because we still have plenty of unused bits left. I've put a fix into CVS. The patch also replaces all the manual bit tests of the options field with feature test macros.

Ralf