Commit b21d4b08b6686fa13bf9d4cae1ae08cb23ea3d53
Committed by
Linus Torvalds
1 parent
3cdaf45578
Exists in
master
and in
4 other branches
uml: fix inlines
"extern inline" will have different semantics with gcc 4.3. Signed-off-by: Adrian Bunk <bunk@kernel.org> 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 4 changed files with 4 additions and 4 deletions Inline Diff
include/asm-um/pgalloc.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Copyright 2003 PathScale, Inc. | 3 | * Copyright 2003 PathScale, Inc. |
4 | * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h | 4 | * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h |
5 | * Licensed under the GPL | 5 | * Licensed under the GPL |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __UM_PGALLOC_H | 8 | #ifndef __UM_PGALLOC_H |
9 | #define __UM_PGALLOC_H | 9 | #define __UM_PGALLOC_H |
10 | 10 | ||
11 | #include "linux/mm.h" | 11 | #include "linux/mm.h" |
12 | #include "asm/fixmap.h" | 12 | #include "asm/fixmap.h" |
13 | 13 | ||
14 | #define pmd_populate_kernel(mm, pmd, pte) \ | 14 | #define pmd_populate_kernel(mm, pmd, pte) \ |
15 | set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) | 15 | set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) |
16 | 16 | ||
17 | #define pmd_populate(mm, pmd, pte) \ | 17 | #define pmd_populate(mm, pmd, pte) \ |
18 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ | 18 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ |
19 | ((unsigned long long)page_to_pfn(pte) << \ | 19 | ((unsigned long long)page_to_pfn(pte) << \ |
20 | (unsigned long long) PAGE_SHIFT))) | 20 | (unsigned long long) PAGE_SHIFT))) |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Allocate and free page tables. | 23 | * Allocate and free page tables. |
24 | */ | 24 | */ |
25 | extern pgd_t *pgd_alloc(struct mm_struct *); | 25 | extern pgd_t *pgd_alloc(struct mm_struct *); |
26 | extern void pgd_free(pgd_t *pgd); | 26 | extern void pgd_free(pgd_t *pgd); |
27 | 27 | ||
28 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); | 28 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); |
29 | extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); | 29 | extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); |
30 | 30 | ||
31 | static inline void pte_free_kernel(pte_t *pte) | 31 | static inline void pte_free_kernel(pte_t *pte) |
32 | { | 32 | { |
33 | free_page((unsigned long) pte); | 33 | free_page((unsigned long) pte); |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline void pte_free(struct page *pte) | 36 | static inline void pte_free(struct page *pte) |
37 | { | 37 | { |
38 | __free_page(pte); | 38 | __free_page(pte); |
39 | } | 39 | } |
40 | 40 | ||
41 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | 41 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) |
42 | 42 | ||
43 | #ifdef CONFIG_3_LEVEL_PGTABLES | 43 | #ifdef CONFIG_3_LEVEL_PGTABLES |
44 | 44 | ||
45 | extern __inline__ void pmd_free(pmd_t *pmd) | 45 | static inline void pmd_free(pmd_t *pmd) |
46 | { | 46 | { |
47 | free_page((unsigned long)pmd); | 47 | free_page((unsigned long)pmd); |
48 | } | 48 | } |
49 | 49 | ||
50 | #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) | 50 | #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define check_pgt_cache() do { } while (0) | 53 | #define check_pgt_cache() do { } while (0) |
54 | 54 | ||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * Overrides for Emacs so that we follow Linus's tabbing style. | 58 | * Overrides for Emacs so that we follow Linus's tabbing style. |
59 | * Emacs will notice this stuff at the end of the file and automatically | 59 | * Emacs will notice this stuff at the end of the file and automatically |
60 | * adjust the settings for this buffer only. This must remain at the end | 60 | * adjust the settings for this buffer only. This must remain at the end |
61 | * of the file. | 61 | * of the file. |
62 | * --------------------------------------------------------------------------- | 62 | * --------------------------------------------------------------------------- |
63 | * Local variables: | 63 | * Local variables: |
64 | * c-file-style: "linux" | 64 | * c-file-style: "linux" |
65 | * End: | 65 | * End: |
66 | */ | 66 | */ |
67 | 67 |
include/asm-um/pgtable-3level.h
1 | /* | 1 | /* |
2 | * Copyright 2003 PathScale Inc | 2 | * Copyright 2003 PathScale Inc |
3 | * Derived from include/asm-i386/pgtable.h | 3 | * Derived from include/asm-i386/pgtable.h |
4 | * Licensed under the GPL | 4 | * Licensed under the GPL |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_PGTABLE_3LEVEL_H | 7 | #ifndef __UM_PGTABLE_3LEVEL_H |
8 | #define __UM_PGTABLE_3LEVEL_H | 8 | #define __UM_PGTABLE_3LEVEL_H |
9 | 9 | ||
10 | #include <asm-generic/pgtable-nopud.h> | 10 | #include <asm-generic/pgtable-nopud.h> |
11 | 11 | ||
12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ |
13 | 13 | ||
14 | #define PGDIR_SHIFT 30 | 14 | #define PGDIR_SHIFT 30 |
15 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 15 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
16 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 16 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
17 | 17 | ||
18 | /* PMD_SHIFT determines the size of the area a second-level page table can | 18 | /* PMD_SHIFT determines the size of the area a second-level page table can |
19 | * map | 19 | * map |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define PMD_SHIFT 21 | 22 | #define PMD_SHIFT 21 |
23 | #define PMD_SIZE (1UL << PMD_SHIFT) | 23 | #define PMD_SIZE (1UL << PMD_SHIFT) |
24 | #define PMD_MASK (~(PMD_SIZE-1)) | 24 | #define PMD_MASK (~(PMD_SIZE-1)) |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * entries per page directory level | 27 | * entries per page directory level |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define PTRS_PER_PTE 512 | 30 | #define PTRS_PER_PTE 512 |
31 | #define PTRS_PER_PMD 512 | 31 | #define PTRS_PER_PMD 512 |
32 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | 32 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) |
33 | #define PTRS_PER_PGD 512 | 33 | #define PTRS_PER_PGD 512 |
34 | #define FIRST_USER_ADDRESS 0 | 34 | #define FIRST_USER_ADDRESS 0 |
35 | 35 | ||
36 | #define pte_ERROR(e) \ | 36 | #define pte_ERROR(e) \ |
37 | printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | 37 | printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \ |
38 | pte_val(e)) | 38 | pte_val(e)) |
39 | #define pmd_ERROR(e) \ | 39 | #define pmd_ERROR(e) \ |
40 | printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | 40 | printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ |
41 | pmd_val(e)) | 41 | pmd_val(e)) |
42 | #define pgd_ERROR(e) \ | 42 | #define pgd_ERROR(e) \ |
43 | printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | 43 | printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ |
44 | pgd_val(e)) | 44 | pgd_val(e)) |
45 | 45 | ||
46 | #define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE)) | 46 | #define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE)) |
47 | #define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | 47 | #define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) |
48 | #define pud_present(x) (pud_val(x) & _PAGE_PRESENT) | 48 | #define pud_present(x) (pud_val(x) & _PAGE_PRESENT) |
49 | #define pud_populate(mm, pud, pmd) \ | 49 | #define pud_populate(mm, pud, pmd) \ |
50 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) | 50 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) |
51 | 51 | ||
52 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) | 52 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) |
53 | static inline int pgd_newpage(pgd_t pgd) | 53 | static inline int pgd_newpage(pgd_t pgd) |
54 | { | 54 | { |
55 | return(pgd_val(pgd) & _PAGE_NEWPAGE); | 55 | return(pgd_val(pgd) & _PAGE_NEWPAGE); |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } | 58 | 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 | ||
62 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | 62 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) |
63 | { | 63 | { |
64 | pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); | 64 | pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); |
65 | 65 | ||
66 | if(pmd) | 66 | if(pmd) |
67 | memset(pmd, 0, PAGE_SIZE); | 67 | memset(pmd, 0, PAGE_SIZE); |
68 | 68 | ||
69 | return pmd; | 69 | return pmd; |
70 | } | 70 | } |
71 | 71 | ||
72 | extern inline void pud_clear (pud_t *pud) | 72 | static inline void pud_clear (pud_t *pud) |
73 | { | 73 | { |
74 | set_pud(pud, __pud(0)); | 74 | set_pud(pud, __pud(0)); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) | 77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) |
78 | #define pud_page_vaddr(pud) \ | 78 | #define pud_page_vaddr(pud) \ |
79 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | 79 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) |
80 | 80 | ||
81 | /* Find an entry in the second-level page table.. */ | 81 | /* Find an entry in the second-level page table.. */ |
82 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ | 82 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ |
83 | pmd_index(address)) | 83 | pmd_index(address)) |
84 | 84 | ||
85 | static inline unsigned long pte_pfn(pte_t pte) | 85 | static inline unsigned long pte_pfn(pte_t pte) |
86 | { | 86 | { |
87 | return phys_to_pfn(pte_val(pte)); | 87 | return phys_to_pfn(pte_val(pte)); |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot) | 90 | static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot) |
91 | { | 91 | { |
92 | pte_t pte; | 92 | pte_t pte; |
93 | phys_t phys = pfn_to_phys(page_nr); | 93 | phys_t phys = pfn_to_phys(page_nr); |
94 | 94 | ||
95 | pte_set_val(pte, phys, pgprot); | 95 | pte_set_val(pte, phys, pgprot); |
96 | return pte; | 96 | return pte; |
97 | } | 97 | } |
98 | 98 | ||
99 | static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot) | 99 | static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot) |
100 | { | 100 | { |
101 | return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); | 101 | return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); |
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Bits 0 through 3 are taken in the low part of the pte, | 105 | * Bits 0 through 3 are taken in the low part of the pte, |
106 | * put the 32 bits of offset into the high part. | 106 | * put the 32 bits of offset into the high part. |
107 | */ | 107 | */ |
108 | #define PTE_FILE_MAX_BITS 32 | 108 | #define PTE_FILE_MAX_BITS 32 |
109 | 109 | ||
110 | #ifdef CONFIG_64BIT | 110 | #ifdef CONFIG_64BIT |
111 | 111 | ||
112 | #define pte_to_pgoff(p) ((p).pte >> 32) | 112 | #define pte_to_pgoff(p) ((p).pte >> 32) |
113 | 113 | ||
114 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE }) | 114 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE }) |
115 | 115 | ||
116 | #else | 116 | #else |
117 | 117 | ||
118 | #define pte_to_pgoff(pte) ((pte).pte_high) | 118 | #define pte_to_pgoff(pte) ((pte).pte_high) |
119 | 119 | ||
120 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) | 120 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) |
121 | 121 | ||
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Overrides for Emacs so that we follow Linus's tabbing style. | 127 | * Overrides for Emacs so that we follow Linus's tabbing style. |
128 | * Emacs will notice this stuff at the end of the file and automatically | 128 | * Emacs will notice this stuff at the end of the file and automatically |
129 | * adjust the settings for this buffer only. This must remain at the end | 129 | * adjust the settings for this buffer only. This must remain at the end |
130 | * of the file. | 130 | * of the file. |
131 | * --------------------------------------------------------------------------- | 131 | * --------------------------------------------------------------------------- |
132 | * Local variables: | 132 | * Local variables: |
133 | * c-file-style: "linux" | 133 | * c-file-style: "linux" |
134 | * End: | 134 | * End: |
135 | */ | 135 | */ |
136 | 136 |
include/asm-um/processor-x86_64.h
1 | /* | 1 | /* |
2 | * Copyright 2003 PathScale, Inc. | 2 | * Copyright 2003 PathScale, Inc. |
3 | * | 3 | * |
4 | * Licensed under the GPL | 4 | * Licensed under the GPL |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_PROCESSOR_X86_64_H | 7 | #ifndef __UM_PROCESSOR_X86_64_H |
8 | #define __UM_PROCESSOR_X86_64_H | 8 | #define __UM_PROCESSOR_X86_64_H |
9 | 9 | ||
10 | /* include faultinfo structure */ | 10 | /* include faultinfo structure */ |
11 | #include "sysdep/faultinfo.h" | 11 | #include "sysdep/faultinfo.h" |
12 | 12 | ||
13 | struct arch_thread { | 13 | struct arch_thread { |
14 | unsigned long debugregs[8]; | 14 | unsigned long debugregs[8]; |
15 | int debugregs_seq; | 15 | int debugregs_seq; |
16 | unsigned long fs; | 16 | unsigned long fs; |
17 | struct faultinfo faultinfo; | 17 | struct faultinfo faultinfo; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | 20 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ |
21 | extern inline void rep_nop(void) | 21 | static inline void rep_nop(void) |
22 | { | 22 | { |
23 | __asm__ __volatile__("rep;nop": : :"memory"); | 23 | __asm__ __volatile__("rep;nop": : :"memory"); |
24 | } | 24 | } |
25 | 25 | ||
26 | #define cpu_relax() rep_nop() | 26 | #define cpu_relax() rep_nop() |
27 | 27 | ||
28 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ | 28 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ |
29 | .debugregs_seq = 0, \ | 29 | .debugregs_seq = 0, \ |
30 | .fs = 0, \ | 30 | .fs = 0, \ |
31 | .faultinfo = { 0, 0, 0 } } | 31 | .faultinfo = { 0, 0, 0 } } |
32 | 32 | ||
33 | static inline void arch_flush_thread(struct arch_thread *thread) | 33 | static inline void arch_flush_thread(struct arch_thread *thread) |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | static inline void arch_copy_thread(struct arch_thread *from, | 37 | static inline void arch_copy_thread(struct arch_thread *from, |
38 | struct arch_thread *to) | 38 | struct arch_thread *to) |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | #include "asm/arch/user.h" | 42 | #include "asm/arch/user.h" |
43 | 43 | ||
44 | #define current_text_addr() \ | 44 | #define current_text_addr() \ |
45 | ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) | 45 | ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) |
46 | 46 | ||
47 | #define ARCH_IS_STACKGROW(address) \ | 47 | #define ARCH_IS_STACKGROW(address) \ |
48 | (address + 128 >= UPT_SP(¤t->thread.regs.regs)) | 48 | (address + 128 >= UPT_SP(¤t->thread.regs.regs)) |
49 | 49 | ||
50 | #define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) | 50 | #define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) |
51 | #define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) | 51 | #define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) |
52 | 52 | ||
53 | #include "asm/processor-generic.h" | 53 | #include "asm/processor-generic.h" |
54 | 54 | ||
55 | #endif | 55 | #endif |
56 | 56 |
include/asm-um/smp.h
1 | #ifndef __UM_SMP_H | 1 | #ifndef __UM_SMP_H |
2 | #define __UM_SMP_H | 2 | #define __UM_SMP_H |
3 | 3 | ||
4 | #ifdef CONFIG_SMP | 4 | #ifdef CONFIG_SMP |
5 | 5 | ||
6 | #include "linux/bitops.h" | 6 | #include "linux/bitops.h" |
7 | #include "asm/current.h" | 7 | #include "asm/current.h" |
8 | #include "linux/cpumask.h" | 8 | #include "linux/cpumask.h" |
9 | 9 | ||
10 | #define raw_smp_processor_id() (current_thread->cpu) | 10 | #define raw_smp_processor_id() (current_thread->cpu) |
11 | 11 | ||
12 | #define cpu_logical_map(n) (n) | 12 | #define cpu_logical_map(n) (n) |
13 | #define cpu_number_map(n) (n) | 13 | #define cpu_number_map(n) (n) |
14 | #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ | 14 | #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ |
15 | extern int hard_smp_processor_id(void); | 15 | extern int hard_smp_processor_id(void); |
16 | #define NO_PROC_ID -1 | 16 | #define NO_PROC_ID -1 |
17 | 17 | ||
18 | extern int ncpus; | 18 | extern int ncpus; |
19 | 19 | ||
20 | 20 | ||
21 | extern inline void smp_cpus_done(unsigned int maxcpus) | 21 | static inline void smp_cpus_done(unsigned int maxcpus) |
22 | { | 22 | { |
23 | } | 23 | } |
24 | 24 | ||
25 | extern struct task_struct *idle_threads[NR_CPUS]; | 25 | extern struct task_struct *idle_threads[NR_CPUS]; |
26 | 26 | ||
27 | #else | 27 | #else |
28 | 28 | ||
29 | #define hard_smp_processor_id() 0 | 29 | #define hard_smp_processor_id() 0 |
30 | 30 | ||
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #endif | 33 | #endif |
34 | 34 |