PERFORCE change 101108 for review

Wojciech A. Koszek wkoszek at FreeBSD.org
Sun Jul 9 15:24:22 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=101108

Change 101108 by wkoszek at wkoszek_laptop on 2006/07/09 15:24:18

	
	After taking a look through XXXMIPS markers, I managed to decrease
	suspicious places and fix problems which wouldn make kernel
	compilation impossible. The same, I introduce XXMIPS marker to let
	more knowledgable people know that this is a place for them to look
	at, since for my knowledge it should work ok.
	
	Those changes are:
	
	cpu.c:
	
	- comment __RMAN_RESOURCE_VISIBLE since it's no longer present. It was use
	  to access r_start member of struct resource, which is now accessible
	  throught public interface -- rman_get_start().
	
	- intr.h -> intr_machdep.h conversion was done earlier. Make it less
	  suspicious (XXX->XX), and remove old #include.
	
	- Bring proper formatting strings for mips_install_vector().
	
	- Add comments about VEC() and VECI() macros. Declare them as public, and
	  remove #undef's.
	
	- Use the rman_get_start() descibed above.
	
	db_disasm.c:
	
	- Bring proper formtatting strings.
	
	machdep.c:
	
	- XXXMIPS marker for informational comment is not needed.
	
	vm_machdep.c:
	
	- We have stubs here. There is no sense for XXXMIPS here.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/cpu.c#5 edit
.. //depot/projects/mips2/src/sys/mips/mips/db_disasm.c#3 edit
.. //depot/projects/mips2/src/sys/mips/mips/machdep.c#11 edit
.. //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#2 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/cpu.c#5 (text+ko) ====

@@ -25,13 +25,21 @@
  * $FreeBSD$
  */
 
+/*
+ * XXMIPS: __RMAN_RESOURCE_VISIBLE is no longer present in the tree, and for
+ * struct resource we have nice interface.
+ */
+#if 0
 #define	__RMAN_RESOURCE_VISIBLE
+#endif
 #include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/kernel.h>
 #include <sys/module.h>
+#include <sys/stdint.h>
+
 #include <sys/bus.h>
-#include <sys/kernel.h>
 #include <sys/rman.h>
+#include <sys/systm.h>
 
 #include <vm/vm.h>
 #include <vm/vm_page.h>
@@ -39,11 +47,8 @@
 #include <machine/cache.h>
 #include <machine/cpufunc.h>
 /*
- * XXXMIPS: This shoud me intr_machdep.h
+ * XXMIPS: I did intr.h -> intr_machdep.h conversion here.
  */
-#if 0
-#include <machine/intr.h>
-#endif
 #include <machine/intr_machdep.h>
 
 #include <machine/locore.h>
@@ -57,7 +62,7 @@
 int mips_num_tlb_entries, cpu_id, fpu_id;
 
 /*
- * XXXMIPS: CHange format strings.
+ * XXMIPS: Check format strings.
  * Uncomment this one once VECI macro defined below is uncommented.
  */
 #if 0
@@ -69,51 +74,64 @@
 	max = 0x80;
 	len = end - begin;
 	if (len > max)
-		panic("exception code too big for vector %lx", addr);
+		panic("exception code too big for vector %jx", (intmax_t) addr);
 	if (len == max)
-		printf("Exception vector at %lx out of space\n", addr);
+		printf("Exception vector at %jx out of space\n", (intmax_t) addr);
 	else if (len + 8 >= max)
-		printf("Exception vector at %lx almost out of space\n", addr);
+		printf("Exception vector at %jx almost out of space\n",
+		    (intmax_t) addr);
 	memcpy((void *)addr, begin, len);
 }
 #endif
 
+/*
+ * XXMIPS: Those declares external addresses of exception handlers to be used. Take a
+ * look at support.S to see *Vector code.
+ */
 #define	VEC(class)	extern char class ## Vector[], class ## VectorEnd[]
 
-/* General exception handler.  */
+/*
+ * XXMIPS: This makes cooperation with exception handler more handy. Less hand-typing
+ * is needed. Take a look at mips_vector_init() in this file to see a usage.
+ */
+#define	VECI(vec, class)	mips_vector_install(MIPS_ ## vec ## _EXC_VEC, \
+						    class ## Vector, \
+						    class ## VectorEnd)
+/*
+ * General exception handler.
+ */
 VEC(Exception);
 
-/* TLB miss, XTLB miss handler.  */
+/*
+ * TLB miss, XTLB miss handler.
+ */
 VEC(TLBMiss);
 VEC(XTLBMiss);
 
-/* Cache error handler.  */
+/* 
+ * Cache error handler.
+ */
 VEC(Cache);
 
-#undef	VEC
+/*
+ * Here you have for example: extern char CacheVector, CacheVestorEnd
+ */
 
 /*
- * XXXMIPS: error : large integer implicitly truncated to unsigned type
+ * XXMIPS: error : large integer implicitly truncated to unsigned type. This
+ * error will stay unless we define proper addresses of exception vectors in
+ * cpufunc.h. 
  */
 static void
 mips_vector_init(void)
 {
-	
-#define	VECI(vec, class)	mips_vector_install(MIPS_ ## vec ## _EXC_VEC, \
-						    class ## Vector, \
-						    class ## VectorEnd)
-/* XXXMIPS */
 #if 0
 	VECI(UTLB_MISS, TLBMiss);
 	VECI(XTLB_MISS, XTLBMiss);
 	VECI(CACHE_ERR, Cache);
 	VECI(GEN, Exception);
 #endif
-#undef	VECI
-/* XXXMIPS */
-#if 0
 	mips_wr_status(mips_rd_status() & ~MIPS_SR_BEV);
-#endif
 }
 
 /*
@@ -353,12 +371,13 @@
 		return (error);
 	}
 	/*
-	 * XXXMIPS: error: structure has no member named `r_start'
+	 * XMIPS: Right now accessing r_start is hiden and you can easily do
+	 * this with rman_get_start().
 	 */
 #if 0
 	intr = res->r_start;
 #endif
-	intr = 0;
+	intr = rman_get_start(res);
 
 #if 0
 	cpu_establish_hardintr(intr, handler, arg);

==== //depot/projects/mips2/src/sys/mips/mips/db_disasm.c#3 (text+ko) ====

@@ -507,16 +507,15 @@
 	db_symbol_values(sym, &symname, 0);
 
 	/*
-	 * XXXMIPS: Check if the format is right here.
-	 * Probably not.
+	 * XXMIPS: Check if the format is right here.
 	 */
 	if (symname) {
 		if (diff == 0)
 			db_printf("%s", symname);
 		else
-			db_printf("<%s+%lx>", symname, (unsigned long) diff);
-		db_printf("\t[addr:0x%lx]", (unsigned long) loc);
+			db_printf("<%s+%jx>", symname, (uintmax_t) diff);
+		db_printf("\t[addr:0x%jx]", (uintmax_t) loc);
 	} else {
-		db_printf("0x%lx", (unsigned long) loc);
+		db_printf("0x%jx", (uintmax_t) loc);
 	}
 }

==== //depot/projects/mips2/src/sys/mips/mips/machdep.c#11 (text+ko) ====

@@ -91,15 +91,15 @@
 mips_init(void)
 {
 	/*
-	 * XXXMIPS: This one is called from subr_param.c.
+	 * This one is called from subr_param.c.
 	 */
 	init_param2(physmem);
 	/*
-	 * XXXMIPS: This one lies in cpu.c.
+	 * This one lies in cpu.c.
 	 */
 	mips_cpu_init();
 	/*
-	 * XXXMIPS: This is from pmap.c.
+	 * This is from pmap.c.
 	 */
 	pmap_bootstrap();
 

==== //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#2 (text+ko) ====

@@ -54,11 +54,6 @@
 #include <vm/uma.h>
 #include <vm/uma_int.h>
 
-
-/*
- * XXXMIPS: Bring comments after eventual new-world order.
- */
-
 void
 cpu_fork(register struct thread *td1, register struct proc *p2,
     struct thread *td2, int flags)


More information about the p4-projects mailing list