summaryrefslogtreecommitdiff
path: root/common/print_loadaddr.c
blob: 17d648d1a0f69de3c34b0ebf5336d0ce7206b78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}