aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:30:53 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:28 -0500
commit8192ab42bf60e1e9b7efa046990e9cc5e4a95cf4 (patch)
treef61fee85b0eccbc055ec8c5a98932b20eca64bf1
parent9157f90f08f7db3188cd06971f41cb2ba5646e57 (diff)
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>
-rw-r--r--arch/um/drivers/random.c1
-rw-r--r--arch/um/include/um_uaccess.h4
-rw-r--r--arch/um/kernel/mem.c21
-rw-r--r--arch/um/kernel/process.c8
-rw-r--r--arch/um/kernel/skas/uaccess.c13
-rw-r--r--arch/um/kernel/tlb.c7
-rw-r--r--arch/um/sys-i386/bug.c1
-rw-r--r--arch/um/sys-i386/ldt.c5
-rw-r--r--include/asm-um/elf-i386.h9
-rw-r--r--include/asm-um/elf-x86_64.h8
-rw-r--r--include/asm-um/fixmap.h3
-rw-r--r--include/asm-um/pgtable-3level.h11
-rw-r--r--include/asm-um/pgtable.h1
-rw-r--r--include/asm-um/processor-generic.h5
-rw-r--r--include/asm-um/thread_info.h3
-rw-r--r--include/asm-um/uaccess.h10
16 files changed, 62 insertions, 48 deletions
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index e942e836f995..71f0959c1535 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -5,6 +5,7 @@
5 * This software may be used and distributed according to the terms 5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference. 6 * of the GNU General Public License, incorporated herein by reference.
7 */ 7 */
8#include <linux/sched.h>
8#include <linux/module.h> 9#include <linux/module.h>
9#include <linux/fs.h> 10#include <linux/fs.h>
10#include <linux/miscdevice.h> 11#include <linux/miscdevice.h>
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index fdfc06b85605..2b6fc8e0f071 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -6,7 +6,9 @@
6#ifndef __ARCH_UM_UACCESS_H 6#ifndef __ARCH_UM_UACCESS_H
7#define __ARCH_UM_UACCESS_H 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#define __under_task_size(addr, size) \ 13#define __under_task_size(addr, size) \
12 (((unsigned long) (addr) < TASK_SIZE) && \ 14 (((unsigned long) (addr) < TASK_SIZE) && \
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 96072e27a0e7..1f8f0c195173 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -152,7 +152,7 @@ pgprot_t kmap_prot;
152 152
153#define kmap_get_fixmap_pte(vaddr) \ 153#define kmap_get_fixmap_pte(vaddr) \
154 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)),\ 154 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)),\
155 (vaddr)), (vaddr)) 155 (vaddr)), (vaddr))
156 156
157static void __init kmap_init(void) 157static void __init kmap_init(void)
158{ 158{
@@ -278,7 +278,8 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order)
278 goto again; 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 * since it's not in kernel physical memory. 283 * since it's not in kernel physical memory.
283 */ 284 */
284 285
@@ -331,9 +332,7 @@ void show_mem(void)
331 printk("%d pages swap cached\n", cached); 332 printk("%d pages swap cached\n", cached);
332} 333}
333 334
334/* 335/* Allocate and free page tables. */
335 * Allocate and free page tables.
336 */
337 336
338pgd_t *pgd_alloc(struct mm_struct *mm) 337pgd_t *pgd_alloc(struct mm_struct *mm)
339{ 338{
@@ -368,3 +367,15 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
368 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 367 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
369 return pte; 368 return pte;
370} 369}
370
371#ifdef CONFIG_3_LEVEL_PGTABLES
372pmd_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
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 541a2bf331c5..570471218086 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -446,3 +446,11 @@ unsigned long get_wchan(struct task_struct *p)
446 446
447 return 0; 447 return 0;
448} 448}
449
450int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu)
451{
452 int cpu = current_thread_info()->cpu;
453
454 return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu);
455}
456
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 302425b03d49..d145565b5f4b 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -3,12 +3,13 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/err.h" 6#include <linux/err.h>
7#include "linux/highmem.h" 7#include <linux/highmem.h>
8#include "linux/mm.h" 8#include <linux/mm.h>
9#include "asm/current.h" 9#include <linux/sched.h>
10#include "asm/page.h" 10#include <asm/current.h>
11#include "asm/pgtable.h" 11#include <asm/page.h>
12#include <asm/pgtable.h>
12#include "kern_util.h" 13#include "kern_util.h"
13#include "os.h" 14#include "os.h"
14 15
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index f4a0e407eee4..96e097879f5b 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -3,9 +3,10 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h" 6#include <linux/mm.h>
7#include "asm/pgtable.h" 7#include <linux/sched.h>
8#include "asm/tlbflush.h" 8#include <asm/pgtable.h>
9#include <asm/tlbflush.h>
9#include "as-layout.h" 10#include "as-layout.h"
10#include "mem_user.h" 11#include "mem_user.h"
11#include "os.h" 12#include "os.h"
diff --git a/arch/um/sys-i386/bug.c b/arch/um/sys-i386/bug.c
index a4360b5207db..8d4f273f1219 100644
--- a/arch/um/sys-i386/bug.c
+++ b/arch/um/sys-i386/bug.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/uaccess.h> 6#include <linux/uaccess.h>
7#include <asm/errno.h>
7 8
8/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because 9/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because
9 * that's not relevant in skas mode. 10 * that's not relevant in skas mode.
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 67c0958eb984..505ed5c9a68d 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -3,8 +3,9 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/mm.h" 6#include <linux/mm.h>
7#include "asm/unistd.h" 7#include <linux/sched.h>
8#include <asm/unistd.h>
8#include "os.h" 9#include "os.h"
9#include "proc_mm.h" 10#include "proc_mm.h"
10#include "skas.h" 11#include "skas.h"
diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h
index ca94a136dfe8..22bbb755ee51 100644
--- a/include/asm-um/elf-i386.h
+++ b/include/asm-um/elf-i386.h
@@ -5,7 +5,7 @@
5#ifndef __UM_ELF_I386_H 5#ifndef __UM_ELF_I386_H
6#define __UM_ELF_I386_H 6#define __UM_ELF_I386_H
7 7
8#include <linux/sched.h> 8#include <asm/user.h>
9#include "skas.h" 9#include "skas.h"
10 10
11#define R_386_NONE 0 11#define R_386_NONE 0
@@ -76,12 +76,7 @@ typedef struct user_i387_struct elf_fpregset_t;
76 pr_reg[16] = PT_REGS_SS(regs); \ 76 pr_reg[16] = PT_REGS_SS(regs); \
77} while(0); 77} while(0);
78 78
79static inline int elf_core_copy_fpregs(struct task_struct *t, 79extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
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}
85 80
86#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) 81#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
87 82
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h
index 3c9d543eb61e..3b2d5224a7e1 100644
--- a/include/asm-um/elf-x86_64.h
+++ b/include/asm-um/elf-x86_64.h
@@ -7,7 +7,6 @@
7#ifndef __UM_ELF_X86_64_H 7#ifndef __UM_ELF_X86_64_H
8#define __UM_ELF_X86_64_H 8#define __UM_ELF_X86_64_H
9 9
10#include <linux/sched.h>
11#include <asm/user.h> 10#include <asm/user.h>
12#include "skas.h" 11#include "skas.h"
13 12
@@ -96,12 +95,7 @@ typedef struct user_i387_struct elf_fpregset_t;
96 (pr_reg)[25] = 0; \ 95 (pr_reg)[25] = 0; \
97 (pr_reg)[26] = 0; 96 (pr_reg)[26] = 0;
98 97
99static inline int elf_core_copy_fpregs(struct task_struct *t, 98extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
100 elf_fpregset_t *fpu)
101{
102 int cpu = current_thread->cpu;
103 return save_fp_registers(userspace_pid[cpu], (unsigned long *) fpu);
104}
105 99
106#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) 100#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
107 101
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h
index d352a35cfafb..3d3e85d30ac2 100644
--- a/include/asm-um/fixmap.h
+++ b/include/asm-um/fixmap.h
@@ -1,9 +1,10 @@
1#ifndef __UM_FIXMAP_H 1#ifndef __UM_FIXMAP_H
2#define __UM_FIXMAP_H 2#define __UM_FIXMAP_H
3 3
4#include <asm/system.h>
4#include <asm/kmap_types.h> 5#include <asm/kmap_types.h>
5#include <asm/archparam.h> 6#include <asm/archparam.h>
6#include <asm/elf.h> 7#include <asm/page.h>
7 8
8/* 9/*
9 * Here we define all the compile-time 'special' virtual 10 * Here we define all the compile-time 'special' virtual
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index 3ebafbaacb24..e0b6c16a3a41 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -59,15 +59,8 @@ static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
59 59
60#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) 60#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
61 61
62static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 62struct mm_struct;
63{ 63extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
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}
71 64
72static inline void pud_clear (pud_t *pud) 65static inline void pud_clear (pud_t *pud)
73{ 66{
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index e268506f322a..bec4840d30ea 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -8,7 +8,6 @@
8#ifndef __UM_PGTABLE_H 8#ifndef __UM_PGTABLE_H
9#define __UM_PGTABLE_H 9#define __UM_PGTABLE_H
10 10
11#include "linux/sched.h"
12#include <asm/fixmap.h> 11#include <asm/fixmap.h>
13 12
14#define _PAGE_PRESENT 0x001 13#define _PAGE_PRESENT 0x001
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index 057a76d41569..35ab6a292d63 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -11,6 +11,7 @@ struct pt_regs;
11struct task_struct; 11struct task_struct;
12 12
13#include "asm/ptrace.h" 13#include "asm/ptrace.h"
14#include "asm/pgtable.h"
14#include "registers.h" 15#include "registers.h"
15#include "sysdep/archsetjmp.h" 16#include "sysdep/archsetjmp.h"
16 17
@@ -68,10 +69,6 @@ struct thread_struct {
68 .request = { 0 } \ 69 .request = { 0 } \
69} 70}
70 71
71typedef struct {
72 unsigned long seg;
73} mm_segment_t;
74
75extern struct task_struct *alloc_task_struct(void); 72extern struct task_struct *alloc_task_struct(void);
76 73
77static inline void release_thread(struct task_struct *task) 74static inline void release_thread(struct task_struct *task)
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index 6e5fd5c892d0..cdfc91cb77a8 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -8,8 +8,9 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11#include <asm/processor.h>
12#include <asm/types.h> 11#include <asm/types.h>
12#include <asm/page.h>
13#include <asm/uaccess.h>
13 14
14struct thread_info { 15struct thread_info {
15 struct task_struct *task; /* main task structure */ 16 struct task_struct *task; /* main task structure */
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
index 077032d4fc47..b9a895d6fa1d 100644
--- a/include/asm-um/uaccess.h
+++ b/include/asm-um/uaccess.h
@@ -6,7 +6,15 @@
6#ifndef __UM_UACCESS_H 6#ifndef __UM_UACCESS_H
7#define __UM_UACCESS_H 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 */
13typedef struct {
14 unsigned long seg;
15} mm_segment_t;
16
17#include "linux/thread_info.h"
10 18
11#define VERIFY_READ 0 19#define VERIFY_READ 0
12#define VERIFY_WRITE 1 20#define VERIFY_WRITE 1