summaryrefslogtreecommitdiffstats
path: root/sys/boot/powerpc
diff options
context:
space:
mode:
authorbenno <benno@FreeBSD.org>2001-10-07 13:22:25 +0000
committerbenno <benno@FreeBSD.org>2001-10-07 13:22:25 +0000
commit994f7977f13d1c6ac31ef785fbbc104972efe7b3 (patch)
treee41d72af3d7b410a29de1cb1506f5f96b1102823 /sys/boot/powerpc
parentc0f87bdb1611f3ab744711a34cfc945ccc336830 (diff)
downloadFreeBSD-src-994f7977f13d1c6ac31ef785fbbc104972efe7b3.zip
FreeBSD-src-994f7977f13d1c6ac31ef785fbbc104972efe7b3.tar.gz
Mega-patch for OpenFirmware loader support.
- Flesh out ofw_readin routine. - Add OpenFirmware load and exec routines. - Make sure memory allocation for the kernel is done correctly. - Change the way the heap is allocated so as to make it easier to deallocate when we hand over. - Add a command to print memory maps similar to the one for ia64. With this patch, I can now load and hand over to a kernel on my iMac. There are some problems with OpenFirmware routines failing after the hand over that still need to be addressed.
Diffstat (limited to 'sys/boot/powerpc')
-rw-r--r--sys/boot/powerpc/loader/Makefile6
-rw-r--r--sys/boot/powerpc/loader/conf.c10
-rw-r--r--sys/boot/powerpc/loader/start.c8
-rw-r--r--sys/boot/powerpc/ofw/Makefile6
-rw-r--r--sys/boot/powerpc/ofw/conf.c10
-rw-r--r--sys/boot/powerpc/ofw/start.c8
6 files changed, 36 insertions, 12 deletions
diff --git a/sys/boot/powerpc/loader/Makefile b/sys/boot/powerpc/loader/Makefile
index cd8ccaf..045f190 100644
--- a/sys/boot/powerpc/loader/Makefile
+++ b/sys/boot/powerpc/loader/Makefile
@@ -11,6 +11,10 @@ INSTALLFLAGS= -b
LOADER_DISK_SUPPORT?= yes
LOADER_NET_SUPPORT?= yes
+# load address
+RELOC?= 0x6c0000
+CFLAGS+= -DRELOC=${RELOC}
+
# architecture-specific loader code
SRCS= conf.c
@@ -45,7 +49,7 @@ CFLAGS+= -I${.CURDIR}/../../.. -I.
CLEANFILES+= vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
CFLAGS+= -Wall
-LDFLAGS= -nostdlib -static -Ttext 6c0000
+LDFLAGS= -nostdlib -static -Ttext ${RELOC}
# OpenFirmware standalone support library
LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a
diff --git a/sys/boot/powerpc/loader/conf.c b/sys/boot/powerpc/loader/conf.c
index 81ccbe7..273815a 100644
--- a/sys/boot/powerpc/loader/conf.c
+++ b/sys/boot/powerpc/loader/conf.c
@@ -27,7 +27,9 @@
*/
#include <stand.h>
+#include "bootstrap.h"
#include "libofw.h"
+#include "openfirm.h"
#if defined(LOADER_NET_SUPPORT)
#include "dev_net.h"
@@ -82,10 +84,9 @@ struct netif_driver *netif_drivers[] = {
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
-extern struct file_format powerpc_elf;
struct file_format *file_formats[] = {
-/* &powerpc_elf,*/
+ &ofw_elf,
NULL
};
@@ -101,3 +102,8 @@ struct console *consoles[] = {
&ofwconsole,
NULL
};
+
+/*
+ * reloc - our load address
+ */
+vm_offset_t reloc = RELOC;
diff --git a/sys/boot/powerpc/loader/start.c b/sys/boot/powerpc/loader/start.c
index a9aef2a..9f37ce0 100644
--- a/sys/boot/powerpc/loader/start.c
+++ b/sys/boot/powerpc/loader/start.c
@@ -37,8 +37,6 @@
void startup(void *, int, int (*)(void *), char *, int);
-static int stack[8192/4 + 4];
-
#ifdef XCOFF_GLUE
asm("
.text
@@ -48,7 +46,11 @@ _entry:
");
#endif
-asm("
+__asm("
+ .data
+stack:
+ .space 16388
+
.text
.globl _start
_start:
diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile
index cd8ccaf..045f190 100644
--- a/sys/boot/powerpc/ofw/Makefile
+++ b/sys/boot/powerpc/ofw/Makefile
@@ -11,6 +11,10 @@ INSTALLFLAGS= -b
LOADER_DISK_SUPPORT?= yes
LOADER_NET_SUPPORT?= yes
+# load address
+RELOC?= 0x6c0000
+CFLAGS+= -DRELOC=${RELOC}
+
# architecture-specific loader code
SRCS= conf.c
@@ -45,7 +49,7 @@ CFLAGS+= -I${.CURDIR}/../../.. -I.
CLEANFILES+= vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
CFLAGS+= -Wall
-LDFLAGS= -nostdlib -static -Ttext 6c0000
+LDFLAGS= -nostdlib -static -Ttext ${RELOC}
# OpenFirmware standalone support library
LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a
diff --git a/sys/boot/powerpc/ofw/conf.c b/sys/boot/powerpc/ofw/conf.c
index 81ccbe7..273815a 100644
--- a/sys/boot/powerpc/ofw/conf.c
+++ b/sys/boot/powerpc/ofw/conf.c
@@ -27,7 +27,9 @@
*/
#include <stand.h>
+#include "bootstrap.h"
#include "libofw.h"
+#include "openfirm.h"
#if defined(LOADER_NET_SUPPORT)
#include "dev_net.h"
@@ -82,10 +84,9 @@ struct netif_driver *netif_drivers[] = {
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
-extern struct file_format powerpc_elf;
struct file_format *file_formats[] = {
-/* &powerpc_elf,*/
+ &ofw_elf,
NULL
};
@@ -101,3 +102,8 @@ struct console *consoles[] = {
&ofwconsole,
NULL
};
+
+/*
+ * reloc - our load address
+ */
+vm_offset_t reloc = RELOC;
diff --git a/sys/boot/powerpc/ofw/start.c b/sys/boot/powerpc/ofw/start.c
index a9aef2a..9f37ce0 100644
--- a/sys/boot/powerpc/ofw/start.c
+++ b/sys/boot/powerpc/ofw/start.c
@@ -37,8 +37,6 @@
void startup(void *, int, int (*)(void *), char *, int);
-static int stack[8192/4 + 4];
-
#ifdef XCOFF_GLUE
asm("
.text
@@ -48,7 +46,11 @@ _entry:
");
#endif
-asm("
+__asm("
+ .data
+stack:
+ .space 16388
+
.text
.globl _start
_start:
OpenPOWER on IntegriCloud