summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/ppc/init/Config.lb2
-rw-r--r--src/arch/ppc/init/ppc_main.c39
2 files changed, 40 insertions, 1 deletions
diff --git a/src/arch/ppc/init/Config.lb b/src/arch/ppc/init/Config.lb
index fcda384bb6..5fcae5f3c2 100644
--- a/src/arch/ppc/init/Config.lb
+++ b/src/arch/ppc/init/Config.lb
@@ -1,2 +1,2 @@
init crt0.S.lb
-#initobject stuff.o
+initobject ppc_main.o
diff --git a/src/arch/ppc/init/ppc_main.c b/src/arch/ppc/init/ppc_main.c
new file mode 100644
index 0000000000..06fc33c89b
--- /dev/null
+++ b/src/arch/ppc/init/ppc_main.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2003 by Greg Watson, Los Alamos National Laboratory
+ * gwatson@lanl.gov
+ */
+
+extern unsigned _iseg[];
+extern unsigned _liseg[];
+extern unsigned _eliseg[];
+
+void (*hardwaremain)(int) = _iseg;
+
+/*
+ * At this point we're running out of flash with our
+ * stack in cache ram. We need to do the following:
+ *
+ * - turn on real memory
+ * - relocate our payload into real memory
+ * - start executing payload
+ */
+
+void ppc_main(void)
+{
+ unsigned *from;
+ unsigned *to;
+
+ sdram_init();
+
+ /*
+ * Relocate payload (text & data) if necessary
+ */
+ if (_liseg != _iseg) {
+ from = _liseg;
+ to = _iseg;
+ while (from < _eliseg)
+ *to++ = *from++;
+ }
+
+ hardwaremain(0);
+}