#define ELF_CLASS ELFCLASS64
#define ELF_ARCH EM_X86_64
-#if ULONG_MAX > UINT32_MAX
-#define INIT_GUEST_COMMPAGE
-static bool init_guest_commpage(void)
-{
- /*
- * The vsyscall page is at a high negative address aka kernel space,
- * which means that we cannot actually allocate it with target_mmap.
- * We still should be able to use page_set_flags, unless the user
- * has specified -R reserved_va, which would trigger an assert().
- */
- if (reserved_va != 0 &&
- TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE - 1 > reserved_va) {
- error_report("Cannot allocate vsyscall page");
- exit(EXIT_FAILURE);
- }
- page_set_flags(TARGET_VSYSCALL_PAGE,
- TARGET_VSYSCALL_PAGE | ~TARGET_PAGE_MASK,
- PAGE_EXEC | PAGE_VALID);
- return true;
-}
-#endif
#else
/*
#else
#define HI_COMMPAGE 0
#define LO_COMMPAGE -1
-#ifndef INIT_GUEST_COMMPAGE
+#ifndef HAVE_GUEST_COMMPAGE
#define init_guest_commpage() true
#endif
#endif
const char *elf_hwcap2_str(uint32_t bit);
const char *get_elf_platform(CPUState *cs);
const char *get_elf_base_platform(CPUState *cs);
+#if defined(TARGET_X86_64)
+bool init_guest_commpage(void);
+#endif
struct target_elf_gregset_t;
void elf_core_copy_regs(struct target_elf_gregset_t *, const CPUArchState *);
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu.h"
#include "loader.h"
#include "target_elf.h"
return "x86_64";
}
+bool init_guest_commpage(void)
+{
+ /*
+ * The vsyscall page is at a high negative address aka kernel space,
+ * which means that we cannot actually allocate it with target_mmap.
+ * We still should be able to use page_set_flags, unless the user
+ * has specified -R reserved_va, which would trigger an assert().
+ */
+ if (reserved_va != 0 &&
+ TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE - 1 > reserved_va) {
+ error_report("Cannot allocate vsyscall page");
+ exit(EXIT_FAILURE);
+ }
+ page_set_flags(TARGET_VSYSCALL_PAGE,
+ TARGET_VSYSCALL_PAGE | ~TARGET_PAGE_MASK,
+ PAGE_EXEC | PAGE_VALID);
+ return true;
+}
+
void elf_core_copy_regs(target_elf_gregset_t *r, const CPUX86State *env)
{
r->pt.r15 = tswapal(env->regs[15]);
#define HAVE_ELF_HWCAP 1
#define HAVE_ELF_PLATFORM 1
#define HAVE_ELF_CORE_DUMP 1
+#define HAVE_GUEST_COMMPAGE 1
/*
* See linux kernel: arch/x86/include/asm/elf.h, where