summaryrefslogtreecommitdiff
path: root/os/cerf405/compile.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
commit74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a (patch)
treec6e220ba61db3a6ea4052e6841296d829654e664 /os/cerf405/compile.c
parent46439007cf417cbd9ac8049bb4122c890097a0fa (diff)
20060303
Diffstat (limited to 'os/cerf405/compile.c')
-rw-r--r--os/cerf405/compile.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/os/cerf405/compile.c b/os/cerf405/compile.c
new file mode 100644
index 00000000..da9976f2
--- /dev/null
+++ b/os/cerf405/compile.c
@@ -0,0 +1,34 @@
+#include "u.h"
+#include "../port/lib.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "io.h"
+
+#define MAXDCR 0x220
+
+#define DCRF(n) ((((n)>>5)&0x1F)|(((n)&0x1F)<<5))
+#define MTDCR(s,n) ((31<<26)|((s)<<21)|(DCRF(n)<<11)|(451<<1))
+#define MFDCR(n,t) ((31<<26)|((t)<<21)|(DCRF(n)<<11)|(323<<1))
+#define RETURN 0x4e800020
+ulong _getdcr[MAXDCR][2];
+ulong _putdcr[MAXDCR][2];
+
+void
+compiledcr(void)
+{
+ ulong *p;
+ int i;
+
+ for(i=0; i<MAXDCR; i++){
+ p = _getdcr[i];
+ p[0] = MFDCR(i, 3);
+ p[1] = RETURN;
+ p = _putdcr[i];
+ p[0] = MTDCR(3, i);
+ p[1] = RETURN;
+ }
+ dcflush(_getdcr, sizeof(_getdcr));
+ dcflush(_putdcr, sizeof(_putdcr));
+ /* no need to flush icache since they won't be there */
+}