mini-os: arm: boot code

Based on an initial patch by Karim Raslan.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>

---

Changes since v6:

Addressed Ian Campbell's comments:
- ARMv7 A8.8.247 says udf should not be used conditionally, so use
  a branch instead.
- Enable caching earlier (required setting the cacheability for the
  translation table walks).
- Added some extra dsb instructions to protect against reordering.

Addressed Julien Grall's comments:
- Note that TTBCR is zero (using short-descriptors, TTBR0 only).
- Note about relying on 0x8000 load offset.
mini-os: arm: memory management

Based on an initial patch by Karim Raslan.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>

---

Changes since v6:

- use unsigned long for paddr_t
mini-os: arm: scheduling

Based on an initial patch by Karim Raslan.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: arm: events

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: arm: time

Based on an initial patch by Karim Raslan.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: arm: interrupt controller

Based on an initial patch by Karim Raslan.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>

---

Changes since v5:

Addressed Julien Grall's comments:
- Added comments explaining the lengths when checking FDT properties.
- Fixed (commented) DEBUG macro.
- Drop check for arm,cortex-a9-gic.

- Require only minimum property lengths (requested by Ian Campbell).
mini-os: arm: build system

Based on an initial patch by Karim Raslan.

This activates the ARM code added in the previous patches. On ARM,
Mini-OS will boot and display some output on the console. Tested with:

make XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- \
	CONFIG_TEST=y CONFIG_START_NETWORK=n CONFIG_BLKFRONT=n \
	CONFIG_NETFRONT=n CONFIG_FBFRONT=n CONFIG_KBDFRONT=n \
	CONFIG_CONSFRONT=n CONFIG_XC=n -j4

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: arm: show registers, stack and exception vector on fault

Signed-off-by: Thomas Leonard <talex5@gmail.com>

---

Exit with SHUTDOWN_crash on BUG or fault (suggested by Ian Campbell).
mini-os: fixed compiling with debug=n

Without -fno-tree-loop-distribute-patterns, gcc -O3 recognises that our
"memset" is doing a memset operation and tries to make it call the
standard "memset", creating a loop.

gcc complains that nodedepth may be uninitialised, so set it to -1 by
default.

Don't include string.h; use lib.h instead.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: reorganised arch headers

Before, we had:

- include
- include/arm
- include/x86

Where either arm or x86 was added directly to the search path. So
<x86/arch_limits.h> was the same file as <arch_limits.h> on x86.

We now have:

- include
- arch/arm/include
- arch/x86/include

This means that only the second form is now legal. It also simplifies
installation of the headers, since we can now install everything in the
include directory without getting files for other archs.
mini-os: added make install target

This installs libminios.a, the linker script, the headers and a
pkg-config file to locate them.
mini-os: expose gnttab_table, NR_GRANT_FRAMES, etc

Needed by Mirage.
mini-os: make do_hypervisor_callback weak

This is for Mirage, which handles events synchronously by checking for
pending events before blocking.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: added stub for printing floats for sprintf, etc

Override the weak __printf_render_float to implement.
mini-os: make start_kernel weak

Possibly we should just move it to test.c. It should be up to
applications which features they want to initialise.
Hack: extend boot stack by 1 MB

At boot, we only have a 16 KB stack. Once we've found the rest of the
RAM, we map the top 1 MB just below the boot stack. The advantage of
putting it here is that we don't need to relocate the stack, and we
still get overflow protection.