x86: hypercall: test hypercall that lands outside canonical address space

It works! :)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
x86: Test push word on 64-bit mode

KVM previously considered all stack operations as 64-bit and ignored opsize
override prefix.  Adding a test to check this case, by saving RSP, pushing data
from MMIO memory, poping to register and comparing the original RSP with the
updated one.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
x86: Test jump to non-canonical address

KVM previously did not check whether jumps are to non-canonical addresses and
therefore should cause a #GP. In such case, vm-entry failed. This test checks
whether jumps with non-canonical addresses cause #GP.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
vmx_tests: do not set unsupported PAT controls in the VMCS

Otherwise, vmlaunch fails.  Also, skip PAT tests altogether if save/load
PAT is completely unsupported.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arm: fix crash on cubietruck

Cubietruck seems to be more sensitive than my Midway when
attempting to use [ldr|str]ex instructions without caches
enabled (mmu disabled). Fix this by making the spinlock
implementation (currently the only user of *ex instructions)
conditional on the mmu being enabled.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
lib: add ALIGN() macro

Add a type-considerate ALIGN[_UP] macro to libcflat, and apply
it to /lib code that can make use of it. This will be used to
fix PAGE_ALIGN on arm, which can be used on phys_addr_t
addresses, which may exceed 32 bits.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
lib: steal const.h from kernel

And apply it to /lib files. This prepares for the import of
kernel headers that make use of the const.h macros.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arm: apply ALIGN() and const.h to arm files

This fixes PAGE_ALIGN for greater than 32-bit addresses.
Also fix up some whitespace in lib/arm/asm/page.h

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arm: import some Linux page table API

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arm: turn on the MMU

We should probably always run with the mmu on, so let's
enable it from setup with an identity map.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>