diff options
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/a.out-core.h | 71 | ||||
-rw-r--r-- | include/asm-x86/a.out.h | 10 | ||||
-rw-r--r-- | include/asm-x86/page_32.h | 2 | ||||
-rw-r--r-- | include/asm-x86/page_64.h | 2 | ||||
-rw-r--r-- | include/asm-x86/pgalloc_32.h | 6 | ||||
-rw-r--r-- | include/asm-x86/pgalloc_64.h | 22 | ||||
-rw-r--r-- | include/asm-x86/posix_types_32.h | 8 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 5 |
8 files changed, 103 insertions, 23 deletions
diff --git a/include/asm-x86/a.out-core.h b/include/asm-x86/a.out-core.h new file mode 100644 index 000000000000..d2b6e11d3e97 --- /dev/null +++ b/include/asm-x86/a.out-core.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* a.out coredump register dumper | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_A_OUT_CORE_H | ||
13 | #define _ASM_A_OUT_CORE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | #ifdef CONFIG_X86_32 | ||
17 | |||
18 | #include <linux/user.h> | ||
19 | #include <linux/elfcore.h> | ||
20 | |||
21 | /* | ||
22 | * fill in the user structure for an a.out core dump | ||
23 | */ | ||
24 | static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) | ||
25 | { | ||
26 | u16 gs; | ||
27 | |||
28 | /* changed the size calculations - should hopefully work better. lbt */ | ||
29 | dump->magic = CMAGIC; | ||
30 | dump->start_code = 0; | ||
31 | dump->start_stack = regs->sp & ~(PAGE_SIZE - 1); | ||
32 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
33 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
34 | dump->u_dsize -= dump->u_tsize; | ||
35 | dump->u_ssize = 0; | ||
36 | dump->u_debugreg[0] = current->thread.debugreg0; | ||
37 | dump->u_debugreg[1] = current->thread.debugreg1; | ||
38 | dump->u_debugreg[2] = current->thread.debugreg2; | ||
39 | dump->u_debugreg[3] = current->thread.debugreg3; | ||
40 | dump->u_debugreg[4] = 0; | ||
41 | dump->u_debugreg[5] = 0; | ||
42 | dump->u_debugreg[6] = current->thread.debugreg6; | ||
43 | dump->u_debugreg[7] = current->thread.debugreg7; | ||
44 | |||
45 | if (dump->start_stack < TASK_SIZE) | ||
46 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
47 | |||
48 | dump->regs.bx = regs->bx; | ||
49 | dump->regs.cx = regs->cx; | ||
50 | dump->regs.dx = regs->dx; | ||
51 | dump->regs.si = regs->si; | ||
52 | dump->regs.di = regs->di; | ||
53 | dump->regs.bp = regs->bp; | ||
54 | dump->regs.ax = regs->ax; | ||
55 | dump->regs.ds = (u16)regs->ds; | ||
56 | dump->regs.es = (u16)regs->es; | ||
57 | dump->regs.fs = (u16)regs->fs; | ||
58 | savesegment(gs,gs); | ||
59 | dump->regs.orig_ax = regs->orig_ax; | ||
60 | dump->regs.ip = regs->ip; | ||
61 | dump->regs.cs = (u16)regs->cs; | ||
62 | dump->regs.flags = regs->flags; | ||
63 | dump->regs.sp = regs->sp; | ||
64 | dump->regs.ss = (u16)regs->ss; | ||
65 | |||
66 | dump->u_fpvalid = dump_fpu (regs, &dump->i387); | ||
67 | } | ||
68 | |||
69 | #endif /* CONFIG_X86_32 */ | ||
70 | #endif /* __KERNEL__ */ | ||
71 | #endif /* _ASM_A_OUT_CORE_H */ | ||
diff --git a/include/asm-x86/a.out.h b/include/asm-x86/a.out.h index a62443e38eb8..4684f97a5bbd 100644 --- a/include/asm-x86/a.out.h +++ b/include/asm-x86/a.out.h | |||
@@ -17,14 +17,4 @@ struct exec | |||
17 | #define N_DRSIZE(a) ((a).a_drsize) | 17 | #define N_DRSIZE(a) ((a).a_drsize) |
18 | #define N_SYMSIZE(a) ((a).a_syms) | 18 | #define N_SYMSIZE(a) ((a).a_syms) |
19 | 19 | ||
20 | #ifdef __KERNEL__ | ||
21 | # include <linux/thread_info.h> | ||
22 | # define STACK_TOP TASK_SIZE | ||
23 | # ifdef CONFIG_X86_32 | ||
24 | # define STACK_TOP_MAX STACK_TOP | ||
25 | # else | ||
26 | # define STACK_TOP_MAX TASK_SIZE64 | ||
27 | # endif | ||
28 | #endif | ||
29 | |||
30 | #endif /* _ASM_X86_A_OUT_H */ | 20 | #endif /* _ASM_X86_A_OUT_H */ |
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h index a6fd10f230d2..ba715d9798b0 100644 --- a/include/asm-x86/page_32.h +++ b/include/asm-x86/page_32.h | |||
@@ -50,6 +50,8 @@ typedef unsigned long phys_addr_t; | |||
50 | typedef union { pteval_t pte, pte_low; } pte_t; | 50 | typedef union { pteval_t pte, pte_low; } pte_t; |
51 | typedef pte_t boot_pte_t; | 51 | typedef pte_t boot_pte_t; |
52 | 52 | ||
53 | typedef struct page *pgtable_t; | ||
54 | |||
53 | #endif /* __ASSEMBLY__ */ | 55 | #endif /* __ASSEMBLY__ */ |
54 | #endif /* CONFIG_X86_PAE */ | 56 | #endif /* CONFIG_X86_PAE */ |
55 | 57 | ||
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index dcf0c0746075..f7393bc516ef 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h | |||
@@ -71,6 +71,8 @@ typedef unsigned long pgdval_t; | |||
71 | typedef unsigned long pgprotval_t; | 71 | typedef unsigned long pgprotval_t; |
72 | typedef unsigned long phys_addr_t; | 72 | typedef unsigned long phys_addr_t; |
73 | 73 | ||
74 | typedef struct page *pgtable_t; | ||
75 | |||
74 | typedef struct { pteval_t pte; } pte_t; | 76 | typedef struct { pteval_t pte; } pte_t; |
75 | 77 | ||
76 | #define vmemmap ((struct page *)VMEMMAP_START) | 78 | #define vmemmap ((struct page *)VMEMMAP_START) |
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h index bab12718a913..6bea6e5b5ee5 100644 --- a/include/asm-x86/pgalloc_32.h +++ b/include/asm-x86/pgalloc_32.h | |||
@@ -31,6 +31,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p | |||
31 | paravirt_alloc_pt(mm, pfn); | 31 | paravirt_alloc_pt(mm, pfn); |
32 | set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE)); | 32 | set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE)); |
33 | } | 33 | } |
34 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
34 | 35 | ||
35 | /* | 36 | /* |
36 | * Allocate and free page tables. | 37 | * Allocate and free page tables. |
@@ -39,15 +40,16 @@ extern pgd_t *pgd_alloc(struct mm_struct *); | |||
39 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); | 40 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |
40 | 41 | ||
41 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); | 42 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); |
42 | extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); | 43 | extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long); |
43 | 44 | ||
44 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | 45 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
45 | { | 46 | { |
46 | free_page((unsigned long)pte); | 47 | free_page((unsigned long)pte); |
47 | } | 48 | } |
48 | 49 | ||
49 | static inline void pte_free(struct mm_struct *mm, struct page *pte) | 50 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) |
50 | { | 51 | { |
52 | pgtable_page_dtor(pte); | ||
51 | __free_page(pte); | 53 | __free_page(pte); |
52 | } | 54 | } |
53 | 55 | ||
diff --git a/include/asm-x86/pgalloc_64.h b/include/asm-x86/pgalloc_64.h index 4f6220db22b1..8d6722320dcc 100644 --- a/include/asm-x86/pgalloc_64.h +++ b/include/asm-x86/pgalloc_64.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #define pgd_populate(mm, pgd, pud) \ | 12 | #define pgd_populate(mm, pgd, pud) \ |
13 | set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud))) | 13 | set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud))) |
14 | 14 | ||
15 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
16 | |||
15 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) | 17 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) |
16 | { | 18 | { |
17 | set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); | 19 | set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); |
@@ -91,12 +93,17 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad | |||
91 | return (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); | 93 | return (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); |
92 | } | 94 | } |
93 | 95 | ||
94 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 96 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
95 | { | 97 | { |
96 | void *p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); | 98 | struct page *page; |
99 | void *p; | ||
100 | |||
101 | p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); | ||
97 | if (!p) | 102 | if (!p) |
98 | return NULL; | 103 | return NULL; |
99 | return virt_to_page(p); | 104 | page = virt_to_page(p); |
105 | pgtable_page_ctor(page); | ||
106 | return page; | ||
100 | } | 107 | } |
101 | 108 | ||
102 | /* Should really implement gc for free page table pages. This could be | 109 | /* Should really implement gc for free page table pages. This could be |
@@ -108,12 +115,17 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | |||
108 | free_page((unsigned long)pte); | 115 | free_page((unsigned long)pte); |
109 | } | 116 | } |
110 | 117 | ||
111 | static inline void pte_free(struct mm_struct *mm, struct page *pte) | 118 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) |
112 | { | 119 | { |
120 | pgtable_page_dtor(pte); | ||
113 | __free_page(pte); | 121 | __free_page(pte); |
114 | } | 122 | } |
115 | 123 | ||
116 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | 124 | #define __pte_free_tlb(tlb,pte) \ |
125 | do { \ | ||
126 | pgtable_page_dtor((pte)); \ | ||
127 | tlb_remove_page((tlb), (pte)); \ | ||
128 | } while (0) | ||
117 | 129 | ||
118 | #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) | 130 | #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) |
119 | #define __pud_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) | 131 | #define __pud_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) |
diff --git a/include/asm-x86/posix_types_32.h b/include/asm-x86/posix_types_32.h index 133e31e7dfde..015e539cdef5 100644 --- a/include/asm-x86/posix_types_32.h +++ b/include/asm-x86/posix_types_32.h | |||
@@ -39,14 +39,10 @@ typedef long long __kernel_loff_t; | |||
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | typedef struct { | 41 | typedef struct { |
42 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
43 | int val[2]; | 42 | int val[2]; |
44 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
45 | int __val[2]; | ||
46 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
47 | } __kernel_fsid_t; | 43 | } __kernel_fsid_t; |
48 | 44 | ||
49 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | 45 | #if defined(__KERNEL__) |
50 | 46 | ||
51 | #undef __FD_SET | 47 | #undef __FD_SET |
52 | #define __FD_SET(fd,fdsetp) \ | 48 | #define __FD_SET(fd,fdsetp) \ |
@@ -77,6 +73,6 @@ do { \ | |||
77 | "2" ((__kernel_fd_set *) (fdsetp)) : "memory"); \ | 73 | "2" ((__kernel_fd_set *) (fdsetp)) : "memory"); \ |
78 | } while (0) | 74 | } while (0) |
79 | 75 | ||
80 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | 76 | #endif /* defined(__KERNEL__) */ |
81 | 77 | ||
82 | #endif | 78 | #endif |
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index ab4d0c2a3f8f..149920dcd341 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -719,6 +719,8 @@ static inline void prefetchw(const void *x) | |||
719 | * User space process size: 3GB (default). | 719 | * User space process size: 3GB (default). |
720 | */ | 720 | */ |
721 | #define TASK_SIZE (PAGE_OFFSET) | 721 | #define TASK_SIZE (PAGE_OFFSET) |
722 | #define STACK_TOP TASK_SIZE | ||
723 | #define STACK_TOP_MAX STACK_TOP | ||
722 | 724 | ||
723 | #define INIT_THREAD { \ | 725 | #define INIT_THREAD { \ |
724 | .sp0 = sizeof(init_stack) + (long)&init_stack, \ | 726 | .sp0 = sizeof(init_stack) + (long)&init_stack, \ |
@@ -802,6 +804,9 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); | |||
802 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \ | 804 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \ |
803 | IA32_PAGE_OFFSET : TASK_SIZE64) | 805 | IA32_PAGE_OFFSET : TASK_SIZE64) |
804 | 806 | ||
807 | #define STACK_TOP TASK_SIZE | ||
808 | #define STACK_TOP_MAX TASK_SIZE64 | ||
809 | |||
805 | #define INIT_THREAD { \ | 810 | #define INIT_THREAD { \ |
806 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | 811 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ |
807 | } | 812 | } |