[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] more auxv entries for x86
From: |
Gwenole Beauchesne |
Subject: |
[Qemu-devel] [PATCH] more auxv entries for x86 |
Date: |
Mon, 14 Nov 2005 15:07:04 +0100 (CET) |
Hi,
The inlined patch hereunder adds more auxv entries, namely AT_PLATFORM and
AT_HWCAP. This e.g. makes it possible to use Mandriva Linux provided glibc
libraries.
Plain patch available at:
<http://cvs.mandriva.com/cgi-bin/cvsweb.cgi/contrib-SPECS/qemu/qemu-0.7.2-auxv.patch>
2005-10-23 Gwenole Beauchesne <address@hidden>
* linux-user/elfload.c (create_elf_tables): Add AT_PLATFORM and
AT_HWCAP entries to auxiliary vector.
* linux-user/main.c (main): setup global_env earlier for elf_exec.
--- qemu/linux-user/elfload.c.auxv 2005-09-05 10:26:06.000000000 +0200
+++ qemu/linux-user/elfload.c 2005-10-24 14:39:20.000000000 +0200
@@ -25,6 +25,26 @@
#ifdef TARGET_I386
+#define ELF_PLATFORM get_elf_platform()
+
+static const char *get_elf_platform(void)
+{
+ static char elf_platform[] = "i386";
+ int family = (global_env->cpuid_version >> 8) & 0xff;
+ if (family > 6)
+ family = 6;
+ if (family >= 3)
+ elf_platform[1] = '0' + family;
+ return elf_platform;
+}
+
+#define ELF_HWCAP get_elf_hwcap()
+
+static uint32_t get_elf_hwcap(void)
+{
+ return global_env->cpuid_features;
+}
+
#define ELF_START_MMAP 0x80000000
/*
@@ -211,6 +231,14 @@ static inline void init_thread(struct ta
#endif
+#ifndef ELF_PLATFORM
+#define ELF_PLATFORM (NULL)
+#endif
+
+#ifndef ELF_HWCAP
+#define ELF_HWCAP 0
+#endif
+
#include "elf.h"
/*
@@ -292,7 +320,7 @@ struct exec
#define INTERPRETER_AOUT 1
#define INTERPRETER_ELF 2
-#define DLINFO_ITEMS 11
+#define DLINFO_ITEMS 12
static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
{
@@ -624,14 +652,26 @@ static unsigned int * create_elf_tables(
{
target_ulong *argv, *envp;
target_ulong *sp, *csp;
+ target_ulong *u_platform;
+ const char *k_platform;
int v;
/*
* Force 16 byte _final_ alignment here for generality.
*/
sp = (unsigned int *) (~15UL & (unsigned long) p);
+ u_platform = NULL;
+ k_platform = ELF_PLATFORM;
+ if (k_platform) {
+ size_t len = strlen(k_platform) + 1;
+ sp -= len;
+ u_platform = (target_ulong *)sp;
+ __copy_to_user(u_platform, k_platform, len);
+ }
csp = sp;
csp -= (DLINFO_ITEMS + 1) * 2;
+ if (k_platform)
+ csp -= 2;
#ifdef DLINFO_ARCH_ITEMS
csp -= DLINFO_ARCH_ITEMS*2;
#endif
@@ -659,6 +699,9 @@ static unsigned int * create_elf_tables(
NEW_AUX_ENT(AT_EUID, (target_ulong) geteuid());
NEW_AUX_ENT(AT_GID, (target_ulong) getgid());
NEW_AUX_ENT(AT_EGID, (target_ulong) getegid());
+ NEW_AUX_ENT(AT_HWCAP, (target_ulong) ELF_HWCAP);
+ if (k_platform)
+ NEW_AUX_ENT(AT_PLATFORM, (target_ulong) u_platform);
#ifdef ARCH_DLINFO
/*
* ARCH_DLINFO must come last so platform specific code can enforce
--- qemu/linux-user/main.c.auxv 2005-08-07 08:39:17.000000000 +0200
+++ qemu/linux-user/main.c 2005-10-24 14:38:44.000000000 +0200
@@ -1095,6 +1095,7 @@ int main(int argc, char **argv)
/* NOTE: we need to init the CPU at this stage to get
qemu_host_page_size */
env = cpu_init();
+ global_env = env;
if (elf_exec(filename, argv+optind, environ, regs, info) != 0) {
printf("Error loading %s\n", filename);
@@ -1117,8 +1118,6 @@ int main(int argc, char **argv)
syscall_init();
signal_init();
- global_env = env;
-
/* build Task State */
memset(ts, 0, sizeof(TaskState));
env->opaque = ts;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] more auxv entries for x86,
Gwenole Beauchesne <=