01.04.2023 14:45, Joao Martins пишет:
On 01/04/2023 09:40, Michael Tokarev wrote:
After bringing in xen guest support, qemu fails to build on x32:
Adding the folks who added the feature too
target/i386/kvm/xen-emu.c:876:5: note: in expansion of macro ‘qemu_build_assert’
876 | qemu_build_assert(sizeof(struct vcpu_info) == 64);
| ^~~~~~~~~~~~~~~~~
This one should be easy to fix, but I wonder if there are other issues
with x32 exists..
Not sure.
struct vcpu_info is supposed to be 64bytes on both 32-bit and 64-bit builds.
If anything maybe arch_vcpu_info struct is different on 32-bit and 64-bit...
David, Paul, any ideas?
Yes, it is arch_vcpu_info. I assumed it is a trivial thing, but let me explain
if it's not the case.
include/hw/xen/interface/arch-x86/xen.h :
#if defined(__i386__)
#include "xen-x86_32.h"
#elif defined(__x86_64__)
#include "xen-x86_64.h"
#endif
(I wonder if it ever possible to have none of the two defined).
Now, xen-x86_32.h has:
struct arch_vcpu_info {
unsigned long cr2;
unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
};
Assuming sizeof(long)==32bits. But actually it is 64bits on x32.
While xen-x86_64.h has:
struct arch_vcpu_info {
unsigned long cr2;
unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
};
It looks like for x32, the test in arch-x86/xen.h should be:
#if defined(__x86_64__)
#include "xen-x86_64.h"
#else
#include "xen-x86_32.h"
#endif
since x32 is almost like x86_64. The only difference from x86_64
is sizeof(pointer), which is 32bits.
Well. Maybe xen support should be disabled entirely on x32.
Or maybe x32 should be declared as unsupported entirely.
I dunno.
/mjt