x86: Bounds check for apic_reserved_bits[] array

apic_accessing_reserved_bits() function doesn't sanitize 'reg' argument.
Malicious cell can use this fact to perform out-of-bounds read in
apic_reserved_bits[] array in host mode, which should never happen.

With this patch, all APIC register bits not listed in apic_reserved_bits[]
are considered reserved.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Fix mask of reserved bits for error LVT

Only bit 16 (mask) is writable, not bits 17 and 18. Was copied & pasted
from timer LVT.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Handle Extended APIC Register Space better

Extended APIC Register Space is AMD feature which was initially supported
in Jailhouse with a quick hack. It's fixed with this patch: now, the presence
of Extended APIC Register Space is determined as per APMv2, Sect. 16.3.4, and
the number of Extended Local Vector Tables is also determined in runtime.

As all of these is now done inside apic.c, and there is no need to keep
apic_reserved_bits[] public anymore.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>