mini-os: whitespace

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

Moves some x86-specific code into arch/x86.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split into multiple patches]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: don't require XEN_HAVE_PV_UPCALL_MASK

This isn't available on ARM.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: add missing casts to MM printk

The code previously assumed that a long was 64-bits.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
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: added arch_unbind_ports

This allows closing any ports opened by the arch-specific code.
ARM will use it for the debug port.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: moved __pte to x86

We don't need to define this on ARM. Suggested by Julien Grall.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: moved unlikely/likely macros to new compiler.h

Requested by Julien Grall.

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

The old code said "Xenbus tests disabled, because of a Xend bug".
Since xend doesn't exist any longer, we can enable these again.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
mini-os: use irqs_disabled() helper in schedule

Testing whether the result of local_irq_save is zero doesn't work on
ARM.

Suggested by Julien Grall.
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.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split into multiple patches]
[talex5@gmail.com: include hypervisor.h from os.h, as on x86]
[talex5@gmail.com: implemented bitops for ARM]
[talex5@gmail.com: added arch_endian.h for ARM]
[talex5@gmail.com: removed unused hypercalls and inlines]
[talex5@gmail.com: renamed hypercall-arm32 to just hypercall-arm]
[talex5@gmail.com: moved GIC driver to arm directory]
[talex5@gmail.com: added HYPERVISOR_xsm_op]
[talex5@gmail.com: fixes suggested by Julien Grall:
- Removed old x86 comment from arm/arch_spinlock.h.
- Removed unimplemented _raw_spin_lock_flags.
- Renamed __cli/__sti to local_irq_disable/local_irq_enable.
- Cleaned up interrupt macros.
- Avoid disabling the Asynchronous Abort exception.
- Added memory clobber to barriers.
- Enable barriers on __aarch64__ too.
- Use compiler.h for likely/unlikely macros.
- Replaced dmb with slower but safer dsb for now.]
[talex5@gmail.com: made image relocatable]
[talex5@gmail.com: added mfn_to_pfn and pfn_to_mfn]

Signed-off-by: Thomas Leonard <talex5@gmail.com>
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

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

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>
[talex5@gmail.com: made x86_64 support work again]
[talex5@gmail.com: split into multiple patches]
[talex5@gmail.com: re-enabled force_evtchn_callback]
[talex5@gmail.com: enable regular console]
[talex5@gmail.com: 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)]
[talex5@gmail.com: use Virtual Count register for monotonic time]
[talex5@gmail.com: fixed HYPERVISOR_shutdown]
[talex5@gmail.com: get xenstore details from hypervisor]
[talex5@gmail.com: use GCC implementation of division]
[talex5@gmail.com: cleaned up interrupt handlers and threading]
[talex5@gmail.com: call exit_thread when a thread returns]
[talex5@gmail.com: implemented block_domain for ARM]
[talex5@gmail.com: fixed hang when enabling interrupts]
[talex5@gmail.com: added -march=armv7-a to flags]
[talex5@gmail.com: CLREX after handling IRQs]
[talex5@gmail.com: unbind debug port at shutdown]
[talex5@gmail.com: allow unaligned accesses]
[talex5@gmail.com: fix zImage header for XSA-95]
[talex5@gmail.com: get RAM base and size from the FDT]
[talex5@gmail.com: get GIC addresses from FDT]
[talex5@gmail.com: added ARM grant table initialisation]
[talex5@gmail.com: added missing copyright header to hypercalls32.S]
[talex5@gmail.com: moved GIC driver to arm directory]
[talex5@gmail.com: fixes suggested by Julien Grall:
- Removed unnecessary isb.
- Renamed GICD_PRIORITY to GICD_IPRIORITYR.
- Change IRQ number type from unsigned char to int.
- Added volatile to {set,clear}_bit_non_atomic.
- Fixed some comments.
- Check compatible properties in DTB.]
[talex5@gmail.com: made image relocatable]
[talex5@gmail.com: added mfn_to_pfn and pfn_to_mfn]
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>