diff options
author | Nathan Lynch <nathan_lynch@mentor.com> | 2015-03-25 14:13:16 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-03-27 18:20:45 -0400 |
commit | 1713ce7c43755fe8b0f31ea317513129bf784909 (patch) | |
tree | f082086f181ac7ce03324da1d9e2b629c08f6518 /arch/arm/include | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) |
ARM: 8329/1: miscellaneous vdso infrastructure, preparation
Define the layout of the data structure shared between kernel and
userspace.
Track the vdso address in the mm_context; needed for communicating
AT_SYSINFO_EHDR to the ELF loader.
Add declarations for arm_install_vdso; implementation is in a
following patch.
Define AT_SYSINFO_EHDR, and, if CONFIG_VDSO=y, report the vdso shared
object address via the ELF auxiliary vector.
Note - this adds the AT_SYSINFO_EHDR in a new user-visible header
asm/auxvec.h; this is consistent with other architectures.
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/auxvec.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/elf.h | 9 | ||||
-rw-r--r-- | arch/arm/include/asm/mmu.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/vdso.h | 32 | ||||
-rw-r--r-- | arch/arm/include/asm/vdso_datapage.h | 60 | ||||
-rw-r--r-- | arch/arm/include/uapi/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/arm/include/uapi/asm/auxvec.h | 7 |
8 files changed, 113 insertions, 1 deletions
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index fe74c0d1e485..eb0f43f3e3f1 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | generic-y += auxvec.h | ||
4 | generic-y += bitsperlong.h | 3 | generic-y += bitsperlong.h |
5 | generic-y += cputime.h | 4 | generic-y += cputime.h |
6 | generic-y += current.h | 5 | generic-y += current.h |
diff --git a/arch/arm/include/asm/auxvec.h b/arch/arm/include/asm/auxvec.h new file mode 100644 index 000000000000..fbd388c46299 --- /dev/null +++ b/arch/arm/include/asm/auxvec.h | |||
@@ -0,0 +1 @@ | |||
#include <uapi/asm/auxvec.h> | |||
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index afb9cafd3786..ac3f17fb4c8d 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -1,7 +1,9 @@ | |||
1 | #ifndef __ASMARM_ELF_H | 1 | #ifndef __ASMARM_ELF_H |
2 | #define __ASMARM_ELF_H | 2 | #define __ASMARM_ELF_H |
3 | 3 | ||
4 | #include <asm/auxvec.h> | ||
4 | #include <asm/hwcap.h> | 5 | #include <asm/hwcap.h> |
6 | #include <asm/vdso_datapage.h> | ||
5 | 7 | ||
6 | /* | 8 | /* |
7 | * ELF register definitions.. | 9 | * ELF register definitions.. |
@@ -130,6 +132,13 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm); | |||
130 | #define arch_randomize_brk arch_randomize_brk | 132 | #define arch_randomize_brk arch_randomize_brk |
131 | 133 | ||
132 | #ifdef CONFIG_MMU | 134 | #ifdef CONFIG_MMU |
135 | #ifdef CONFIG_VDSO | ||
136 | #define ARCH_DLINFO \ | ||
137 | do { \ | ||
138 | NEW_AUX_ENT(AT_SYSINFO_EHDR, \ | ||
139 | (elf_addr_t)current->mm->context.vdso); \ | ||
140 | } while (0) | ||
141 | #endif | ||
133 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | 142 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 |
134 | struct linux_binprm; | 143 | struct linux_binprm; |
135 | int arch_setup_additional_pages(struct linux_binprm *, int); | 144 | int arch_setup_additional_pages(struct linux_binprm *, int); |
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index 64fd15159b7d..a5b47421059d 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h | |||
@@ -11,6 +11,9 @@ typedef struct { | |||
11 | #endif | 11 | #endif |
12 | unsigned int vmalloc_seq; | 12 | unsigned int vmalloc_seq; |
13 | unsigned long sigpage; | 13 | unsigned long sigpage; |
14 | #ifdef CONFIG_VDSO | ||
15 | unsigned long vdso; | ||
16 | #endif | ||
14 | } mm_context_t; | 17 | } mm_context_t; |
15 | 18 | ||
16 | #ifdef CONFIG_CPU_HAS_ASID | 19 | #ifdef CONFIG_CPU_HAS_ASID |
diff --git a/arch/arm/include/asm/vdso.h b/arch/arm/include/asm/vdso.h new file mode 100644 index 000000000000..d0295f1dd1a3 --- /dev/null +++ b/arch/arm/include/asm/vdso.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __ASM_VDSO_H | ||
2 | #define __ASM_VDSO_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | |||
8 | struct mm_struct; | ||
9 | |||
10 | #ifdef CONFIG_VDSO | ||
11 | |||
12 | void arm_install_vdso(struct mm_struct *mm, unsigned long addr); | ||
13 | |||
14 | extern char vdso_start, vdso_end; | ||
15 | |||
16 | extern unsigned int vdso_total_pages; | ||
17 | |||
18 | #else /* CONFIG_VDSO */ | ||
19 | |||
20 | static inline void arm_install_vdso(struct mm_struct *mm, unsigned long addr) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | #define vdso_total_pages 0 | ||
25 | |||
26 | #endif /* CONFIG_VDSO */ | ||
27 | |||
28 | #endif /* __ASSEMBLY__ */ | ||
29 | |||
30 | #endif /* __KERNEL__ */ | ||
31 | |||
32 | #endif /* __ASM_VDSO_H */ | ||
diff --git a/arch/arm/include/asm/vdso_datapage.h b/arch/arm/include/asm/vdso_datapage.h new file mode 100644 index 000000000000..9be259442fca --- /dev/null +++ b/arch/arm/include/asm/vdso_datapage.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Adapted from arm64 version. | ||
3 | * | ||
4 | * Copyright (C) 2012 ARM Limited | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | #ifndef __ASM_VDSO_DATAPAGE_H | ||
19 | #define __ASM_VDSO_DATAPAGE_H | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | ||
24 | |||
25 | #include <asm/page.h> | ||
26 | |||
27 | /* Try to be cache-friendly on systems that don't implement the | ||
28 | * generic timer: fit the unconditionally updated fields in the first | ||
29 | * 32 bytes. | ||
30 | */ | ||
31 | struct vdso_data { | ||
32 | u32 seq_count; /* sequence count - odd during updates */ | ||
33 | u16 tk_is_cntvct; /* fall back to syscall if false */ | ||
34 | u16 cs_shift; /* clocksource shift */ | ||
35 | u32 xtime_coarse_sec; /* coarse time */ | ||
36 | u32 xtime_coarse_nsec; | ||
37 | |||
38 | u32 wtm_clock_sec; /* wall to monotonic offset */ | ||
39 | u32 wtm_clock_nsec; | ||
40 | u32 xtime_clock_sec; /* CLOCK_REALTIME - seconds */ | ||
41 | u32 cs_mult; /* clocksource multiplier */ | ||
42 | |||
43 | u64 cs_cycle_last; /* last cycle value */ | ||
44 | u64 cs_mask; /* clocksource mask */ | ||
45 | |||
46 | u64 xtime_clock_snsec; /* CLOCK_REALTIME sub-ns base */ | ||
47 | u32 tz_minuteswest; /* timezone info for gettimeofday(2) */ | ||
48 | u32 tz_dsttime; | ||
49 | }; | ||
50 | |||
51 | union vdso_data_store { | ||
52 | struct vdso_data data; | ||
53 | u8 page[PAGE_SIZE]; | ||
54 | }; | ||
55 | |||
56 | #endif /* !__ASSEMBLY__ */ | ||
57 | |||
58 | #endif /* __KERNEL__ */ | ||
59 | |||
60 | #endif /* __ASM_VDSO_DATAPAGE_H */ | ||
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild index 70a1c9da30ca..a1c05f93d920 100644 --- a/arch/arm/include/uapi/asm/Kbuild +++ b/arch/arm/include/uapi/asm/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += auxvec.h | ||
4 | header-y += byteorder.h | 5 | header-y += byteorder.h |
5 | header-y += fcntl.h | 6 | header-y += fcntl.h |
6 | header-y += hwcap.h | 7 | header-y += hwcap.h |
diff --git a/arch/arm/include/uapi/asm/auxvec.h b/arch/arm/include/uapi/asm/auxvec.h new file mode 100644 index 000000000000..cb02a767a500 --- /dev/null +++ b/arch/arm/include/uapi/asm/auxvec.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_AUXVEC_H | ||
2 | #define __ASM_AUXVEC_H | ||
3 | |||
4 | /* VDSO location */ | ||
5 | #define AT_SYSINFO_EHDR 33 | ||
6 | |||
7 | #endif | ||