Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 May 2003 19:30:57 -0700 (PDT)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 32257 for review
Message-ID:  <200306010230.h512UvTq077993@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=32257

Change 32257 by jmallett@jmallett_dalek on 2003/05/31 19:30:13

	Abstract out vector installing code, and print information as
	they are getting installed.

Affected files ...

.. //depot/projects/mips/sys/mips/mips/machdep.c#29 edit

Differences ...

==== //depot/projects/mips/sys/mips/mips/machdep.c#29 (text+ko) ====

@@ -583,6 +583,22 @@
 };
 
 static void
+mips64_vector_install(vm_offset_t addr, char *begin, char *end)
+{
+	size_t len, max;
+
+	max = 0x80;
+	len = end - begin;
+
+	if (len > max)
+		panic("Exception code too big for vector %lx\n", addr);
+
+	printf("Installing exception code %p:%p at %lx, %zu bytes (%zu free)\n",
+	       begin, end, addr, len, max - len);
+	memcpy((void *)addr, begin, len);
+}
+
+static void
 mips64_vector_init(void)
 {
 	/* r4000 exception handler address and end */
@@ -599,29 +615,17 @@
 	 * Copy down exception vector code.
 	 */
 
-	if (TLBMissVectorEnd - TLBMissVector > 0x80)
-		panic("startup: UTLB vector code too large");
-	memcpy((void *)MIPS_UTLB_MISS_EXC_VEC, TLBMissVector,
-	      TLBMissVectorEnd - TLBMissVector);
-
-	if (XTLBMissVectorEnd - XTLBMissVector > 0x80)
-		panic("startup: XTLB vector code too large");
-	memcpy((void *)MIPS3_XTLB_MISS_EXC_VEC, XTLBMissVector,
-	      XTLBMissVectorEnd - XTLBMissVector);
-
-	if (CacheVectorEnd - CacheVector > 0x80)
-		panic("startup: Cache error vector code too large");
-	memcpy((void *)MIPS3_CACHE_ERR_EXC_VEC, CacheVector,
-	      CacheVectorEnd - CacheVector);
-
-	if (ExceptionVectorEnd - ExceptionVector > 0x80)
-		panic("startup: General exception vector code too large");
-	memcpy((void *)MIPS3_GEN_EXC_VEC, ExceptionVector,
-	      ExceptionVectorEnd - ExceptionVector);
-
+	mips64_vector_install(MIPS_UTLB_MISS_EXC_VEC,
+			      TLBMissVector, TLBMissVectorEnd);
+	mips64_vector_install(MIPS3_XTLB_MISS_EXC_VEC,
+			      XTLBMissVector, XTLBMissVectorEnd);
+	mips64_vector_install(MIPS3_CACHE_ERR_EXC_VEC,
+			      CacheVector, CacheVectorEnd);
+	mips64_vector_install(MIPS3_GEN_EXC_VEC,
+			      ExceptionVector, ExceptionVectorEnd);
 	/* XXX do a real interrupt vector for the mips32/64? */
-	memcpy((void *)MIPS3_INTR_EXC_VEC, ExceptionVector,
-	      ExceptionVectorEnd - ExceptionVector);
+	mips64_vector_install(MIPS3_INTR_EXC_VEC,
+			      ExceptionVector, ExceptionVectorEnd);
 
 	/*
 	 * Copy locore-function vector.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306010230.h512UvTq077993>