mini-os: x86_64: make thread stacks 16-byte aligned

Otherwise, passing doubles to varargs functions causes a crash.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: don't include lib.h from mm.h

This breaks the include cycle hypervisor.h -> hypercall-x86_32.h -> mm.h
-> lib.h -> gntmap.h -> os.h -> hypervisor.h.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: added HYPERVISOR_xsm_op

Avoids using _hypercall1 in events.c.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: headers for ARM

Adds header files for future ARM support.
Based on work by Karim Allah Ahmed.

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

---

Since v5:

Define BUG to cause an undefined instruction fault. This will let
us dump the registers.

Renamed stack to _boot_stack for clarity.
mini-os: import libfdt

Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.git

The memmove implementation is from FreeBSD's
contrib/ldns/compat/memmove.c (r246827).

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split out FDT support into a separate patch]
[talex5@gmail.com: fixed "make clean" for FDT]
[talex5@gmail.com: replaced GPL memmove with BSD one]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: initial ARM support

Based on an initial patch by Karim Raslan.

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>

---

Changes since v5:

- Moved SVC stack to first 16KB of RAM (provides some protection against
  stack overlow corrupting memory).
- Put translation table in second 16KB (simplifies boot code).
- Define physical_address_offset in C, not asm.
- Moved shared_info_page and irqstack to .bss section (smaller image).

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.
- Get hypercall numbers from xen.h.
- Avoid duplicating the definition of _start's virtual address.
- Added paddr_t type to represent physical addresses.

- Require only minimum property lengths (requested by Ian Campbell).
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: include kernel.h from arm/os.h

This is for consistency with x86/os.h and is needed to compile with
lwIP.
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.