aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/mem.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2011-07-25 17:12:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 20:57:13 -0700
commit548f0a4e02f6fa33278e77a2a6477cdeb512317f (patch)
treec1e3830dd6ad0561745452134ec64fd1fa7656a2 /arch/um/sys-i386/mem.c
parentum: disable scan_elf_aux() on x86_64 (diff)
downloadlinux-dev-548f0a4e02f6fa33278e77a2a6477cdeb512317f.tar.xz
linux-dev-548f0a4e02f6fa33278e77a2a6477cdeb512317f.zip
um: Set __HAVE_ARCH_GATE_AREA for i386
When UML is unable to reuse the host's vDSO FIXADDR_USER_START is zero. To handle this special case correclty we have to implement custom gate area helper methods. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--arch/um/sys-i386/mem.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/um/sys-i386/mem.c b/arch/um/sys-i386/mem.c
new file mode 100644
index 000000000000..639900a6fde9
--- /dev/null
+++ b/arch/um/sys-i386/mem.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mm.h>
+#include <asm/page.h>
+#include <asm/mman.h>
+
+static struct vm_area_struct gate_vma;
+
+static int __init gate_vma_init(void)
+{
+ if (!FIXADDR_USER_START)
+ return 0;
+
+ gate_vma.vm_mm = NULL;
+ gate_vma.vm_start = FIXADDR_USER_START;
+ gate_vma.vm_end = FIXADDR_USER_END;
+ gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
+ gate_vma.vm_page_prot = __P101;
+
+ /*
+ * Make sure the vDSO gets into every core dump.
+ * Dumping its contents makes post-mortem fully interpretable later
+ * without matching up the same kernel and hardware config to see
+ * what PC values meant.
+ */
+ gate_vma.vm_flags |= VM_ALWAYSDUMP;
+
+ return 0;
+}
+__initcall(gate_vma_init);
+
+struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
+{
+ return FIXADDR_USER_START ? &gate_vma : NULL;
+}
+
+int in_gate_area_no_mm(unsigned long addr)
+{
+ if (!FIXADDR_USER_START)
+ return 0;
+
+ if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
+ return 1;
+
+ return 0;
+}
+
+int in_gate_area(struct mm_struct *mm, unsigned long addr)
+{
+ struct vm_area_struct *vma = get_gate_vma(mm);
+
+ if (!vma)
+ return 0;
+
+ return (addr >= vma->vm_start) && (addr < vma->vm_end);
+}