PERFORCE change 32257 for review
Juli Mallett
jmallett at FreeBSD.org
Sat May 31 19:30:59 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=32257
Change 32257 by jmallett at 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.
More information about the p4-projects
mailing list