Commit 8192ab42bf60e1e9b7efa046990e9cc5e4a95cf4
Committed by
Linus Torvalds
1 parent
9157f90f08
Exists in
master
and in
4 other branches
uml: header untangling
Untangle UML headers somewhat and add some includes where they were needed explicitly, but gotten accidentally via some other header. arch/um/include/um_uaccess.h loses asm/fixmap.h because it uses no fixmap stuff and gains elf.h, because it needs FIXADDR_USER_*, and archsetjmp.h, because it needs jmp_buf. pmd_alloc_one is uninlined because it needs mm_struct, and that's inconvenient to provide in asm-um/pgtable-3level.h. elf_core_copy_fpregs is also uninlined from elf-i386.h and elf-x86_64.h, which duplicated the code anyway, to arch/um/kernel/process.c, so that the reference to current_thread doesn't pull sched.h or anything related into asm/elf.h. arch/um/sys-i386/ldt.c, arch/um/kernel/tlb.c and arch/um/kernel/skas/uaccess.c got sched.h because they dereference task_structs. Its includes of linux and asm headers got turned from "" to <>. arch/um/sys-i386/bug.c gets asm/errno.h because it needs errno constants. asm/elf-i386 gets asm/user.h because it needs user_regs_struct. asm/fixmap.h gets page.h because it needs PAGE_SIZE and PAGE_MASK and system.h for BUG_ON. asm/pgtable doesn't need sched.h. asm/processor-generic.h defined mm_segment_t, but didn't use it. So, that definition is moved to uaccess.h, which defines a bunch of mm_segment_t-related stuff. thread_info.h uses mm_segment_t, and includes uaccess.h, which causes a recursion. So, the definition is placed above the include of thread_info. in uaccess.h. thread_info.h also gets page.h because it needs PAGE_SIZE. ObCheckpatchViolationJustification - I'm not adding a typedef; I'm moving mm_segment_t from one place to another. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 16 changed files with 62 additions and 48 deletions Side-by-side Diff
- arch/um/drivers/random.c
- arch/um/include/um_uaccess.h
- arch/um/kernel/mem.c
- arch/um/kernel/process.c
- arch/um/kernel/skas/uaccess.c
- arch/um/kernel/tlb.c
- arch/um/sys-i386/bug.c
- arch/um/sys-i386/ldt.c
- include/asm-um/elf-i386.h
- include/asm-um/elf-x86_64.h
- include/asm-um/fixmap.h
- include/asm-um/pgtable-3level.h
- include/asm-um/pgtable.h
- include/asm-um/processor-generic.h
- include/asm-um/thread_info.h
- include/asm-um/uaccess.h
arch/um/drivers/random.c
arch/um/include/um_uaccess.h
... | ... | @@ -6,7 +6,9 @@ |
6 | 6 | #ifndef __ARCH_UM_UACCESS_H |
7 | 7 | #define __ARCH_UM_UACCESS_H |
8 | 8 | |
9 | -#include "asm/fixmap.h" | |
9 | +#include <asm/elf.h> | |
10 | +#include <asm/fixmap.h> | |
11 | +#include "sysdep/archsetjmp.h" | |
10 | 12 | |
11 | 13 | #define __under_task_size(addr, size) \ |
12 | 14 | (((unsigned long) (addr) < TASK_SIZE) && \ |
arch/um/kernel/mem.c
... | ... | @@ -152,7 +152,7 @@ |
152 | 152 | |
153 | 153 | #define kmap_get_fixmap_pte(vaddr) \ |
154 | 154 | pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)),\ |
155 | - (vaddr)), (vaddr)) | |
155 | + (vaddr)), (vaddr)) | |
156 | 156 | |
157 | 157 | static void __init kmap_init(void) |
158 | 158 | { |
... | ... | @@ -278,7 +278,8 @@ |
278 | 278 | goto again; |
279 | 279 | } |
280 | 280 | |
281 | -/* This can't do anything because nothing in the kernel image can be freed | |
281 | +/* | |
282 | + * This can't do anything because nothing in the kernel image can be freed | |
282 | 283 | * since it's not in kernel physical memory. |
283 | 284 | */ |
284 | 285 | |
... | ... | @@ -331,9 +332,7 @@ |
331 | 332 | printk("%d pages swap cached\n", cached); |
332 | 333 | } |
333 | 334 | |
334 | -/* | |
335 | - * Allocate and free page tables. | |
336 | - */ | |
335 | +/* Allocate and free page tables. */ | |
337 | 336 | |
338 | 337 | pgd_t *pgd_alloc(struct mm_struct *mm) |
339 | 338 | { |
... | ... | @@ -368,4 +367,16 @@ |
368 | 367 | pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); |
369 | 368 | return pte; |
370 | 369 | } |
370 | + | |
371 | +#ifdef CONFIG_3_LEVEL_PGTABLES | |
372 | +pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | |
373 | +{ | |
374 | + pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); | |
375 | + | |
376 | + if (pmd) | |
377 | + memset(pmd, 0, PAGE_SIZE); | |
378 | + | |
379 | + return pmd; | |
380 | +} | |
381 | +#endif |
arch/um/kernel/process.c
arch/um/kernel/skas/uaccess.c
... | ... | @@ -3,12 +3,13 @@ |
3 | 3 | * Licensed under the GPL |
4 | 4 | */ |
5 | 5 | |
6 | -#include "linux/err.h" | |
7 | -#include "linux/highmem.h" | |
8 | -#include "linux/mm.h" | |
9 | -#include "asm/current.h" | |
10 | -#include "asm/page.h" | |
11 | -#include "asm/pgtable.h" | |
6 | +#include <linux/err.h> | |
7 | +#include <linux/highmem.h> | |
8 | +#include <linux/mm.h> | |
9 | +#include <linux/sched.h> | |
10 | +#include <asm/current.h> | |
11 | +#include <asm/page.h> | |
12 | +#include <asm/pgtable.h> | |
12 | 13 | #include "kern_util.h" |
13 | 14 | #include "os.h" |
14 | 15 |
arch/um/kernel/tlb.c
... | ... | @@ -3,9 +3,10 @@ |
3 | 3 | * Licensed under the GPL |
4 | 4 | */ |
5 | 5 | |
6 | -#include "linux/mm.h" | |
7 | -#include "asm/pgtable.h" | |
8 | -#include "asm/tlbflush.h" | |
6 | +#include <linux/mm.h> | |
7 | +#include <linux/sched.h> | |
8 | +#include <asm/pgtable.h> | |
9 | +#include <asm/tlbflush.h> | |
9 | 10 | #include "as-layout.h" |
10 | 11 | #include "mem_user.h" |
11 | 12 | #include "os.h" |
arch/um/sys-i386/bug.c
arch/um/sys-i386/ldt.c
include/asm-um/elf-i386.h
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | #ifndef __UM_ELF_I386_H |
6 | 6 | #define __UM_ELF_I386_H |
7 | 7 | |
8 | -#include <linux/sched.h> | |
8 | +#include <asm/user.h> | |
9 | 9 | #include "skas.h" |
10 | 10 | |
11 | 11 | #define R_386_NONE 0 |
... | ... | @@ -76,12 +76,7 @@ |
76 | 76 | pr_reg[16] = PT_REGS_SS(regs); \ |
77 | 77 | } while(0); |
78 | 78 | |
79 | -static inline int elf_core_copy_fpregs(struct task_struct *t, | |
80 | - elf_fpregset_t *fpu) | |
81 | -{ | |
82 | - int cpu = ((struct thread_info *) t->stack)->cpu; | |
83 | - return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu); | |
84 | -} | |
79 | +extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); | |
85 | 80 | |
86 | 81 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) |
87 | 82 |
include/asm-um/elf-x86_64.h
... | ... | @@ -7,7 +7,6 @@ |
7 | 7 | #ifndef __UM_ELF_X86_64_H |
8 | 8 | #define __UM_ELF_X86_64_H |
9 | 9 | |
10 | -#include <linux/sched.h> | |
11 | 10 | #include <asm/user.h> |
12 | 11 | #include "skas.h" |
13 | 12 | |
... | ... | @@ -96,12 +95,7 @@ |
96 | 95 | (pr_reg)[25] = 0; \ |
97 | 96 | (pr_reg)[26] = 0; |
98 | 97 | |
99 | -static inline int elf_core_copy_fpregs(struct task_struct *t, | |
100 | - elf_fpregset_t *fpu) | |
101 | -{ | |
102 | - int cpu = current_thread->cpu; | |
103 | - return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu); | |
104 | -} | |
98 | +extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); | |
105 | 99 | |
106 | 100 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) |
107 | 101 |
include/asm-um/fixmap.h
include/asm-um/pgtable-3level.h
... | ... | @@ -59,15 +59,8 @@ |
59 | 59 | |
60 | 60 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) |
61 | 61 | |
62 | -static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | |
63 | -{ | |
64 | - pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); | |
65 | - | |
66 | - if(pmd) | |
67 | - memset(pmd, 0, PAGE_SIZE); | |
68 | - | |
69 | - return pmd; | |
70 | -} | |
62 | +struct mm_struct; | |
63 | +extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); | |
71 | 64 | |
72 | 65 | static inline void pud_clear (pud_t *pud) |
73 | 66 | { |
include/asm-um/pgtable.h
include/asm-um/processor-generic.h
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | struct task_struct; |
12 | 12 | |
13 | 13 | #include "asm/ptrace.h" |
14 | +#include "asm/pgtable.h" | |
14 | 15 | #include "registers.h" |
15 | 16 | #include "sysdep/archsetjmp.h" |
16 | 17 | |
... | ... | @@ -67,10 +68,6 @@ |
67 | 68 | .arch = INIT_ARCH_THREAD, \ |
68 | 69 | .request = { 0 } \ |
69 | 70 | } |
70 | - | |
71 | -typedef struct { | |
72 | - unsigned long seg; | |
73 | -} mm_segment_t; | |
74 | 71 | |
75 | 72 | extern struct task_struct *alloc_task_struct(void); |
76 | 73 |
include/asm-um/thread_info.h
include/asm-um/uaccess.h
... | ... | @@ -6,7 +6,15 @@ |
6 | 6 | #ifndef __UM_UACCESS_H |
7 | 7 | #define __UM_UACCESS_H |
8 | 8 | |
9 | -#include "linux/sched.h" | |
9 | +#include <asm/errno.h> | |
10 | +#include <asm/processor.h> | |
11 | + | |
12 | +/* thread_info has a mm_segment_t in it, so put the definition up here */ | |
13 | +typedef struct { | |
14 | + unsigned long seg; | |
15 | +} mm_segment_t; | |
16 | + | |
17 | +#include "linux/thread_info.h" | |
10 | 18 | |
11 | 19 | #define VERIFY_READ 0 |
12 | 20 | #define VERIFY_WRITE 1 |