mini-os: Fixed shutdown thread

Before, it read "" and started a shutdown immediately. Now, it waits for
a non-empty value and then actually shuts down.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: Tidied up code

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: separated from big ARM commit]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: Initial commit to port minios to ARM

On ARM, Mini-OS will boot and display some output on the Xen emergency
console (only visible if Xen is compiled in debug mode). Tested with:

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

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: made x86_64 support work again]
[talex5@gmail.com: split out FDT support into a separate patch]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
mini-os: Added FDT support on ARM

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]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Removed commented-out code
Fixed initialisation code

- Configure write-back caching in page table. This is needed for
  reliable hypercalls to Xen (thanks to Julien Grall).

- Use "client mode" for access control (domains are deprecated,
  according to ARM Cortex-A Series Programmer’s Guide version 4.0,
  section 9.6.4).

- Enable more SCTLR features (icache, branch prediction).

- Added more comments.

This allows Mini-OS to boot on the Cubieboard 2.
Enable regular console

For some reason, this breaks xenbus test.
Display "Fault" if any exception vectors are called
Dump registers on fault
Fixed reading from console

Was crashing because it tried to get the console from start_info, which
we don't have on ARM.
Get RAM base and size from the FDT
Fixed MM printk output

Was printing:

MM: Initialise page allocator for 80032000(80032000) - 0(84000000)
Fixed memory corruption bug due to out-of-range alloc_bitmap indexes

map_alloc, etc, assumed that the first index in alloc_bitmap
corresponded to physical page 0. In fact, it corresponds to the first
page of RAM.
Preserve device tree when initialising MM

Move the device tree to a reserved area at the end of the RAM.
Get GIC addresses from FDT
Fixed hang when enabling interrupts

It seems we must call gic_enable_interrupts before enabling individual
interrupts, otherwise our IRQ handler gets called endlessly with
spurious interrupts (interrupt number 1023).
Cleaned up interrupt handlers

Abort on FIQ (we shouldn't get any, but clobbering the IRQ stack would
be the wrong thing to do if we did).
Fixed shutdown thread

Before, it read "" and started a shutdown immediately (though it didn't
actually do anything). Now, it waits for a non-empty value and then
actually shuts down.

This means you can now shut down the VM with "xl shutdown".
Whitespace
Use Virtual Count register to make monotonic time work