aboutsummaryrefslogtreecommitdiff
path: root/common/print_loadaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/print_loadaddr.c')
-rw-r--r--common/print_loadaddr.c30
1 files changed, 30 insertions, 0 deletions
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;
+}