aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2006-11-18 23:48:07 +0100
committerGuido Guenther <agx@bogon.sigxcpu.org>2006-11-18 23:48:07 +0100
commitd1e063beb43e595680c65e3804d1f8ddff53373b (patch)
treef7256dfe1b807920270ec5113df6f6e4abf1ed0f /common
Imported Debian version 0.3.8.80.3.8.8
Diffstat (limited to 'common')
-rw-r--r--common/.cvsignore1
-rw-r--r--common/Makefile16
-rw-r--r--common/print_loadaddr.c30
-rwxr-xr-xcommon/print_outputformat9
-rw-r--r--common/subarch.h51
-rw-r--r--common/version.h1
6 files changed, 108 insertions, 0 deletions
diff --git a/common/.cvsignore b/common/.cvsignore
new file mode 100644
index 0000000..d2b1118
--- /dev/null
+++ b/common/.cvsignore
@@ -0,0 +1 @@
+print_loadaddr
diff --git a/common/Makefile b/common/Makefile
new file mode 100644
index 0000000..2f160e3
--- /dev/null
+++ b/common/Makefile
@@ -0,0 +1,16 @@
+SUBARCH ?= IP22
+
+CFLAGS += -Wall -O2 -I. -I../arclib -DSUBARCH=${SUBARCH}
+
+HOSTCC = $(CC)
+HOSTCFLAGS += -Wall -O2 -DSUBARCH=$(SUBARCH)
+
+all: print_loadaddr
+
+print_loadaddr: print_loadaddr.c subarch.h version.h
+ $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+
+install: print_loadaddr
+
+clean:
+ rm -f print_loadaddr *~ tags
diff --git a/common/print_loadaddr.c b/common/print_loadaddr.c
new file mode 100644
index 0000000..17d648d
--- /dev/null
+++ b/common/print_loadaddr.c
@@ -0,0 +1,30 @@
+/* small helper to get the current subarch's loaddr */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <strings.h>
+
+#include "subarch.h"
+
+int main(int argc, char *argv[])
+{
+ int subarch = SUBARCH;
+
+ if (argc == 2) {
+ if (!strcasecmp(argv[1], "ip22"))
+ subarch = IP22;
+ else if (!strcasecmp(argv[1], "ip32"))
+ subarch = IP32;
+ else {
+ fprintf(stderr,
+ "Unknown subarchitecture %s requested\n",
+ argv[1]);
+ return 1;
+ }
+ }
+
+ printf("%#08x\n", kernel_load[subarch].base
+ + kernel_load[subarch].reserved);
+
+ return 0;
+}
diff --git a/common/print_outputformat b/common/print_outputformat
new file mode 100755
index 0000000..5593a3c
--- /dev/null
+++ b/common/print_outputformat
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# default to ecoff
+
+case $1 in
+ ip32 | IP32) echo "elf32-tradbigmips" ;;
+ ip22 | IP22) echo "ecoff-bigmips" ;;
+ *) echo "ecoff-bigmips" ;;
+esac
diff --git a/common/subarch.h b/common/subarch.h
new file mode 100644
index 0000000..eba5ef0
--- /dev/null
+++ b/common/subarch.h
@@ -0,0 +1,51 @@
+/*
+ * subarch specific definitions
+ */
+
+#ifndef SUBARCH_H
+#define SUBARCH_H
+
+#include <stdint.h>
+
+#define PAGE_SIZE 4096
+#define STACK_PAGES 16
+
+/* supported subarches */
+#define IP22 0
+#define IP32 1
+
+/*
+ * Reserve this memory for loading kernel
+ * Don't put loader structures there because they would be overwritten
+ *
+ * We put the loader right after the kernel so you won't have the
+ * full reserved space since the prom puts the stack right below
+ * the loader.
+ */
+struct kernel_load_block {
+ uint32_t base;
+ uint32_t reserved;
+};
+
+struct kernel_load_block kernel_load[] = {
+ { /* IP22 */
+ .base = 0x88002000,
+ .reserved = 0x800000,
+ },
+ { /* IP32 */
+ .base = 0x80004000,
+ .reserved = 0x1400000,
+ },
+};
+
+/* we filter these out of the command line */
+char* env_vars[] = { "ConsoleIn=",
+ "ConsoleOut=",
+ "OSLoader=",
+ "OSLoadPartition=",
+ "OSLoadFilename=",
+ "OSLoadOptions=",
+ };
+#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+
+#endif
diff --git a/common/version.h b/common/version.h
new file mode 100644
index 0000000..c144648
--- /dev/null
+++ b/common/version.h
@@ -0,0 +1 @@
+#define __ARCSBOOT_VERSION__ "0.3.8.8"