854d244b76
for update_git.sh OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=62
67 lines
2.3 KiB
Diff
67 lines
2.3 KiB
Diff
From 1e34dbb17e1ce60d2c2afd7803dd6b9af8043140 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Graf <agraf@suse.de>
|
|
Date: Mon, 28 Nov 2011 17:05:24 +0100
|
|
Subject: [PATCH] XXX linux-user: fake /proc/self/maps even more
|
|
|
|
---
|
|
linux-user/syscall.c | 40 +++++++++++++++++++++++++++++++++++++++-
|
|
1 files changed, 39 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
|
index 5810e2a..4af0edb 100644
|
|
--- a/linux-user/syscall.c
|
|
+++ b/linux-user/syscall.c
|
|
@@ -4606,13 +4606,51 @@ int get_osversion(void)
|
|
|
|
static int open_self_maps(void *cpu_env, int fd)
|
|
{
|
|
+#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
|
|
TaskState *ts = ((CPUState *)cpu_env)->opaque;
|
|
+#endif
|
|
+ FILE *fp;
|
|
+ char *line = NULL;
|
|
+ size_t len = 0;
|
|
+ ssize_t read;
|
|
+
|
|
+ fp = fopen("/proc/self/maps", "r");
|
|
+ if (fp == NULL) {
|
|
+ return -EACCES;
|
|
+ }
|
|
|
|
+ while ((read = getline(&line, &len, fp)) != -1) {
|
|
+ int fields, dev_maj, dev_min, inode;
|
|
+ uint64_t min, max, offset;
|
|
+ char flag_r, flag_w, flag_x, flag_p;
|
|
+ char path[512] = "";
|
|
+ fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %d:%d %d"
|
|
+ " %512s", &min, &max, &flag_r, &flag_w, &flag_x,
|
|
+ &flag_p, &offset, &dev_maj, &dev_min, &inode, path);
|
|
+
|
|
+ if ((fields < 10) || (fields > 11)) {
|
|
+ continue;
|
|
+ }
|
|
+ if (!strncmp(path, "[stack]", 7)) {
|
|
+ continue;
|
|
+ }
|
|
+ if (h2g_valid(min) && h2g_valid(max)) {
|
|
+ dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
|
|
+ " %02d:%02d %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
|
|
+ flag_x, flag_p, offset, dev_maj, dev_min, inode,
|
|
+ path[0] ? " " : "", path);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ free(line);
|
|
+
|
|
+#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
|
|
dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n",
|
|
(unsigned long long)ts->info->stack_limit,
|
|
(unsigned long long)(ts->stack_base + (TARGET_PAGE_SIZE - 1))
|
|
& TARGET_PAGE_MASK,
|
|
- (unsigned long long)ts->stack_base);
|
|
+ (unsigned long long)0);
|
|
+#endif
|
|
|
|
return 0;
|
|
}
|