diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
commit | cf9b59e9d3e008591d1f54830f570982bb307a0d (patch) | |
tree | 113478ce8fd8c832ba726ffdf59b82cb46356476 /arch/microblaze/include | |
parent | 44504b2bebf8b5823c59484e73096a7d6574471d (diff) | |
parent | f4b87dee923342505e1ddba8d34ce9de33e75050 (diff) |
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and
build failures in vio.c after merge.
Conflicts:
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-mpc.c
drivers/net/gianfar.c
Also fixed up one line in arch/powerpc/kernel/vio.c to use the
correct node pointer.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/microblaze/include')
-rw-r--r-- | arch/microblaze/include/asm/cache.h | 2 | ||||
-rw-r--r-- | arch/microblaze/include/asm/dma.h | 6 | ||||
-rw-r--r-- | arch/microblaze/include/asm/exceptions.h | 6 | ||||
-rw-r--r-- | arch/microblaze/include/asm/io.h | 2 | ||||
-rw-r--r-- | arch/microblaze/include/asm/page.h | 12 | ||||
-rw-r--r-- | arch/microblaze/include/asm/pci.h | 8 | ||||
-rw-r--r-- | arch/microblaze/include/asm/pgalloc.h | 16 | ||||
-rw-r--r-- | arch/microblaze/include/asm/pgtable.h | 35 | ||||
-rw-r--r-- | arch/microblaze/include/asm/system.h | 11 | ||||
-rw-r--r-- | arch/microblaze/include/asm/thread_info.h | 2 | ||||
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 87 |
11 files changed, 94 insertions, 93 deletions
diff --git a/arch/microblaze/include/asm/cache.h b/arch/microblaze/include/asm/cache.h index e52210891d78..4efe96a036f7 100644 --- a/arch/microblaze/include/asm/cache.h +++ b/arch/microblaze/include/asm/cache.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <asm/registers.h> | 16 | #include <asm/registers.h> |
17 | 17 | ||
18 | #define L1_CACHE_SHIFT 2 | 18 | #define L1_CACHE_SHIFT 5 |
19 | /* word-granular cache in microblaze */ | 19 | /* word-granular cache in microblaze */ |
20 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | 20 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) |
21 | 21 | ||
diff --git a/arch/microblaze/include/asm/dma.h b/arch/microblaze/include/asm/dma.h index 08c073badf19..0d73d0c6de37 100644 --- a/arch/microblaze/include/asm/dma.h +++ b/arch/microblaze/include/asm/dma.h | |||
@@ -18,4 +18,10 @@ | |||
18 | #define MAX_DMA_ADDRESS (CONFIG_KERNEL_START + memory_size - 1) | 18 | #define MAX_DMA_ADDRESS (CONFIG_KERNEL_START + memory_size - 1) |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #ifdef CONFIG_PCI | ||
22 | extern int isa_dma_bridge_buggy; | ||
23 | #else | ||
24 | #define isa_dma_bridge_buggy (0) | ||
25 | #endif | ||
26 | |||
21 | #endif /* _ASM_MICROBLAZE_DMA_H */ | 27 | #endif /* _ASM_MICROBLAZE_DMA_H */ |
diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h index 90731df9e574..4c7b5d037c88 100644 --- a/arch/microblaze/include/asm/exceptions.h +++ b/arch/microblaze/include/asm/exceptions.h | |||
@@ -64,12 +64,6 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, | |||
64 | void die(const char *str, struct pt_regs *fp, long err); | 64 | void die(const char *str, struct pt_regs *fp, long err); |
65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | 65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); |
66 | 66 | ||
67 | #ifdef CONFIG_MMU | ||
68 | void __bug(const char *file, int line, void *data); | ||
69 | int bad_trap(int trap_num, struct pt_regs *regs); | ||
70 | int debug_trap(struct pt_regs *regs); | ||
71 | #endif /* CONFIG_MMU */ | ||
72 | |||
73 | #if defined(CONFIG_KGDB) | 67 | #if defined(CONFIG_KGDB) |
74 | void (*debugger)(struct pt_regs *regs); | 68 | void (*debugger)(struct pt_regs *regs); |
75 | int (*debugger_bpt)(struct pt_regs *regs); | 69 | int (*debugger_bpt)(struct pt_regs *regs); |
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index e45a6eea92e0..00b5398d08c7 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h | |||
@@ -139,8 +139,6 @@ static inline void writel(unsigned int v, volatile void __iomem *addr) | |||
139 | 139 | ||
140 | #ifdef CONFIG_MMU | 140 | #ifdef CONFIG_MMU |
141 | 141 | ||
142 | #define mm_ptov(addr) ((void *)__phys_to_virt(addr)) | ||
143 | #define mm_vtop(addr) ((unsigned long)__virt_to_phys(addr)) | ||
144 | #define phys_to_virt(addr) ((void *)__phys_to_virt(addr)) | 142 | #define phys_to_virt(addr) ((void *)__phys_to_virt(addr)) |
145 | #define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr)) | 143 | #define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr)) |
146 | #define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr)) | 144 | #define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr)) |
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 2dd1d04129e0..de493f86d28f 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h | |||
@@ -31,6 +31,9 @@ | |||
31 | 31 | ||
32 | #ifndef __ASSEMBLY__ | 32 | #ifndef __ASSEMBLY__ |
33 | 33 | ||
34 | /* MS be sure that SLAB allocates aligned objects */ | ||
35 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES | ||
36 | |||
34 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | 37 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) |
35 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | 38 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) |
36 | 39 | ||
@@ -70,14 +73,7 @@ typedef unsigned long pte_basic_t; | |||
70 | 73 | ||
71 | #endif /* CONFIG_MMU */ | 74 | #endif /* CONFIG_MMU */ |
72 | 75 | ||
73 | # ifndef CONFIG_MMU | 76 | # define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) |
74 | # define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) | ||
75 | # define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | ||
76 | # define free_user_page(page, addr) free_page(addr) | ||
77 | # else /* CONFIG_MMU */ | ||
78 | extern void copy_page(void *to, void *from); | ||
79 | # endif /* CONFIG_MMU */ | ||
80 | |||
81 | # define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) | 77 | # define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) |
82 | 78 | ||
83 | # define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) | 79 | # define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) |
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h index bdd65aaee30d..5a388eeeb28f 100644 --- a/arch/microblaze/include/asm/pci.h +++ b/arch/microblaze/include/asm/pci.h | |||
@@ -94,14 +94,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus, | |||
94 | 94 | ||
95 | #define HAVE_PCI_LEGACY 1 | 95 | #define HAVE_PCI_LEGACY 1 |
96 | 96 | ||
97 | /* pci_unmap_{page,single} is a nop so... */ | ||
98 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
99 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
100 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
101 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
102 | #define pci_unmap_len(PTR, LEN_NAME) (0) | ||
103 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
104 | |||
105 | /* The PCI address space does equal the physical memory | 97 | /* The PCI address space does equal the physical memory |
106 | * address space (no IOMMU). The IDE and SCSI device layers use | 98 | * address space (no IOMMU). The IDE and SCSI device layers use |
107 | * this boolean for bounce buffer decisions. | 99 | * this boolean for bounce buffer decisions. |
diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h index f44b0d696fe2..c614a893f8a3 100644 --- a/arch/microblaze/include/asm/pgalloc.h +++ b/arch/microblaze/include/asm/pgalloc.h | |||
@@ -108,21 +108,7 @@ extern inline void free_pgd_slow(pgd_t *pgd) | |||
108 | #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) | 108 | #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) |
109 | #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) | 109 | #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) |
110 | 110 | ||
111 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 111 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); |
112 | unsigned long address) | ||
113 | { | ||
114 | pte_t *pte; | ||
115 | extern void *early_get_page(void); | ||
116 | if (mem_init_done) { | ||
117 | pte = (pte_t *)__get_free_page(GFP_KERNEL | | ||
118 | __GFP_REPEAT | __GFP_ZERO); | ||
119 | } else { | ||
120 | pte = (pte_t *)early_get_page(); | ||
121 | if (pte) | ||
122 | clear_page(pte); | ||
123 | } | ||
124 | return pte; | ||
125 | } | ||
126 | 112 | ||
127 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 113 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
128 | unsigned long address) | 114 | unsigned long address) |
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index dd2bb60651c7..ca2d92871545 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h | |||
@@ -512,15 +512,6 @@ static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) | |||
512 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 512 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
513 | 513 | ||
514 | /* | 514 | /* |
515 | * When flushing the tlb entry for a page, we also need to flush the hash | ||
516 | * table entry. flush_hash_page is assembler (for speed) in hashtable.S. | ||
517 | */ | ||
518 | extern int flush_hash_page(unsigned context, unsigned long va, pte_t *ptep); | ||
519 | |||
520 | /* Add an HPTE to the hash table */ | ||
521 | extern void add_hash_page(unsigned context, unsigned long va, pte_t *ptep); | ||
522 | |||
523 | /* | ||
524 | * Encode and decode a swap entry. | 515 | * Encode and decode a swap entry. |
525 | * Note that the bits we use in a PTE for representing a swap entry | 516 | * Note that the bits we use in a PTE for representing a swap entry |
526 | * must not include the _PAGE_PRESENT bit, or the _PAGE_HASHPTE bit | 517 | * must not include the _PAGE_PRESENT bit, or the _PAGE_HASHPTE bit |
@@ -533,15 +524,7 @@ extern void add_hash_page(unsigned context, unsigned long va, pte_t *ptep); | |||
533 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 2 }) | 524 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 2 }) |
534 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 2 }) | 525 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 2 }) |
535 | 526 | ||
536 | |||
537 | /* CONFIG_APUS */ | ||
538 | /* For virtual address to physical address conversion */ | ||
539 | extern void cache_clear(__u32 addr, int length); | ||
540 | extern void cache_push(__u32 addr, int length); | ||
541 | extern int mm_end_of_chunk(unsigned long addr, int len); | ||
542 | extern unsigned long iopa(unsigned long addr); | 527 | extern unsigned long iopa(unsigned long addr); |
543 | /* extern unsigned long mm_ptov(unsigned long addr) \ | ||
544 | __attribute__ ((const)); TBD */ | ||
545 | 528 | ||
546 | /* Values for nocacheflag and cmode */ | 529 | /* Values for nocacheflag and cmode */ |
547 | /* These are not used by the APUS kernel_map, but prevents | 530 | /* These are not used by the APUS kernel_map, but prevents |
@@ -552,18 +535,6 @@ extern unsigned long iopa(unsigned long addr); | |||
552 | #define IOMAP_NOCACHE_NONSER 2 | 535 | #define IOMAP_NOCACHE_NONSER 2 |
553 | #define IOMAP_NO_COPYBACK 3 | 536 | #define IOMAP_NO_COPYBACK 3 |
554 | 537 | ||
555 | /* | ||
556 | * Map some physical address range into the kernel address space. | ||
557 | */ | ||
558 | extern unsigned long kernel_map(unsigned long paddr, unsigned long size, | ||
559 | int nocacheflag, unsigned long *memavailp); | ||
560 | |||
561 | /* | ||
562 | * Set cache mode of (kernel space) address range. | ||
563 | */ | ||
564 | extern void kernel_set_cachemode(unsigned long address, unsigned long size, | ||
565 | unsigned int cmode); | ||
566 | |||
567 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 538 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
568 | #define kern_addr_valid(addr) (1) | 539 | #define kern_addr_valid(addr) (1) |
569 | 540 | ||
@@ -577,10 +548,6 @@ extern void kernel_set_cachemode(unsigned long address, unsigned long size, | |||
577 | void do_page_fault(struct pt_regs *regs, unsigned long address, | 548 | void do_page_fault(struct pt_regs *regs, unsigned long address, |
578 | unsigned long error_code); | 549 | unsigned long error_code); |
579 | 550 | ||
580 | void __init io_block_mapping(unsigned long virt, phys_addr_t phys, | ||
581 | unsigned int size, int flags); | ||
582 | |||
583 | void __init adjust_total_lowmem(void); | ||
584 | void mapin_ram(void); | 551 | void mapin_ram(void); |
585 | int map_page(unsigned long va, phys_addr_t pa, int flags); | 552 | int map_page(unsigned long va, phys_addr_t pa, int flags); |
586 | 553 | ||
@@ -601,7 +568,7 @@ void __init *early_get_page(void); | |||
601 | extern unsigned long ioremap_bot, ioremap_base; | 568 | extern unsigned long ioremap_bot, ioremap_base; |
602 | 569 | ||
603 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); | 570 | void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); |
604 | void consistent_free(void *vaddr); | 571 | void consistent_free(size_t size, void *vaddr); |
605 | void consistent_sync(void *vaddr, size_t size, int direction); | 572 | void consistent_sync(void *vaddr, size_t size, int direction); |
606 | void consistent_sync_page(struct page *page, unsigned long offset, | 573 | void consistent_sync_page(struct page *page, unsigned long offset, |
607 | size_t size, int direction); | 574 | size_t size, int direction); |
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h index 59efb3fef957..48c4f0335e3f 100644 --- a/arch/microblaze/include/asm/system.h +++ b/arch/microblaze/include/asm/system.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/registers.h> | 12 | #include <asm/registers.h> |
13 | #include <asm/setup.h> | 13 | #include <asm/setup.h> |
14 | #include <asm/irqflags.h> | 14 | #include <asm/irqflags.h> |
15 | #include <asm/cache.h> | ||
15 | 16 | ||
16 | #include <asm-generic/cmpxchg.h> | 17 | #include <asm-generic/cmpxchg.h> |
17 | #include <asm-generic/cmpxchg-local.h> | 18 | #include <asm-generic/cmpxchg-local.h> |
@@ -96,4 +97,14 @@ extern struct dentry *of_debugfs_root; | |||
96 | 97 | ||
97 | #define arch_align_stack(x) (x) | 98 | #define arch_align_stack(x) (x) |
98 | 99 | ||
100 | /* | ||
101 | * MicroBlaze doesn't handle unaligned accesses in hardware. | ||
102 | * | ||
103 | * Based on this we force the IP header alignment in network drivers. | ||
104 | * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining | ||
105 | * cacheline alignment of buffers. | ||
106 | */ | ||
107 | #define NET_IP_ALIGN 2 | ||
108 | #define NET_SKB_PAD L1_CACHE_BYTES | ||
109 | |||
99 | #endif /* _ASM_MICROBLAZE_SYSTEM_H */ | 110 | #endif /* _ASM_MICROBLAZE_SYSTEM_H */ |
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h index b2ca80f64640..8a8e9fc6e0c0 100644 --- a/arch/microblaze/include/asm/thread_info.h +++ b/arch/microblaze/include/asm/thread_info.h | |||
@@ -122,7 +122,7 @@ static inline struct thread_info *current_thread_info(void) | |||
122 | /* restore singlestep on return to user mode */ | 122 | /* restore singlestep on return to user mode */ |
123 | #define TIF_SINGLESTEP 4 | 123 | #define TIF_SINGLESTEP 4 |
124 | #define TIF_IRET 5 /* return with iret */ | 124 | #define TIF_IRET 5 /* return with iret */ |
125 | #define TIF_MEMDIE 6 | 125 | #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ |
126 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ | 126 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ |
127 | #define TIF_SECCOMP 10 /* secure computing */ | 127 | #define TIF_SECCOMP 10 /* secure computing */ |
128 | #define TIF_FREEZE 14 /* Freezing for suspend */ | 128 | #define TIF_FREEZE 14 /* Freezing for suspend */ |
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 446bec29b142..26460d15b338 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -182,6 +182,39 @@ extern long __user_bad(void); | |||
182 | * Returns zero on success, or -EFAULT on error. | 182 | * Returns zero on success, or -EFAULT on error. |
183 | * On error, the variable @x is set to zero. | 183 | * On error, the variable @x is set to zero. |
184 | */ | 184 | */ |
185 | #define get_user(x, ptr) \ | ||
186 | __get_user_check((x), (ptr), sizeof(*(ptr))) | ||
187 | |||
188 | #define __get_user_check(x, ptr, size) \ | ||
189 | ({ \ | ||
190 | unsigned long __gu_val = 0; \ | ||
191 | const typeof(*(ptr)) __user *__gu_addr = (ptr); \ | ||
192 | int __gu_err = 0; \ | ||
193 | \ | ||
194 | if (access_ok(VERIFY_READ, __gu_addr, size)) { \ | ||
195 | switch (size) { \ | ||
196 | case 1: \ | ||
197 | __get_user_asm("lbu", __gu_addr, __gu_val, \ | ||
198 | __gu_err); \ | ||
199 | break; \ | ||
200 | case 2: \ | ||
201 | __get_user_asm("lhu", __gu_addr, __gu_val, \ | ||
202 | __gu_err); \ | ||
203 | break; \ | ||
204 | case 4: \ | ||
205 | __get_user_asm("lw", __gu_addr, __gu_val, \ | ||
206 | __gu_err); \ | ||
207 | break; \ | ||
208 | default: \ | ||
209 | __gu_err = __user_bad(); \ | ||
210 | break; \ | ||
211 | } \ | ||
212 | } else { \ | ||
213 | __gu_err = -EFAULT; \ | ||
214 | } \ | ||
215 | x = (typeof(*(ptr)))__gu_val; \ | ||
216 | __gu_err; \ | ||
217 | }) | ||
185 | 218 | ||
186 | #define __get_user(x, ptr) \ | 219 | #define __get_user(x, ptr) \ |
187 | ({ \ | 220 | ({ \ |
@@ -206,12 +239,6 @@ extern long __user_bad(void); | |||
206 | }) | 239 | }) |
207 | 240 | ||
208 | 241 | ||
209 | #define get_user(x, ptr) \ | ||
210 | ({ \ | ||
211 | access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \ | ||
212 | ? __get_user((x), (ptr)) : -EFAULT; \ | ||
213 | }) | ||
214 | |||
215 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ | 242 | #define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \ |
216 | ({ \ | 243 | ({ \ |
217 | __asm__ __volatile__ ( \ | 244 | __asm__ __volatile__ ( \ |
@@ -266,6 +293,42 @@ extern long __user_bad(void); | |||
266 | * | 293 | * |
267 | * Returns zero on success, or -EFAULT on error. | 294 | * Returns zero on success, or -EFAULT on error. |
268 | */ | 295 | */ |
296 | #define put_user(x, ptr) \ | ||
297 | __put_user_check((x), (ptr), sizeof(*(ptr))) | ||
298 | |||
299 | #define __put_user_check(x, ptr, size) \ | ||
300 | ({ \ | ||
301 | typeof(*(ptr)) __pu_val; \ | ||
302 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ | ||
303 | int __pu_err = 0; \ | ||
304 | \ | ||
305 | __pu_val = (x); \ | ||
306 | if (access_ok(VERIFY_WRITE, __pu_addr, size)) { \ | ||
307 | switch (size) { \ | ||
308 | case 1: \ | ||
309 | __put_user_asm("sb", __pu_addr, __pu_val, \ | ||
310 | __pu_err); \ | ||
311 | break; \ | ||
312 | case 2: \ | ||
313 | __put_user_asm("sh", __pu_addr, __pu_val, \ | ||
314 | __pu_err); \ | ||
315 | break; \ | ||
316 | case 4: \ | ||
317 | __put_user_asm("sw", __pu_addr, __pu_val, \ | ||
318 | __pu_err); \ | ||
319 | break; \ | ||
320 | case 8: \ | ||
321 | __put_user_asm_8(__pu_addr, __pu_val, __pu_err);\ | ||
322 | break; \ | ||
323 | default: \ | ||
324 | __pu_err = __user_bad(); \ | ||
325 | break; \ | ||
326 | } \ | ||
327 | } else { \ | ||
328 | __pu_err = -EFAULT; \ | ||
329 | } \ | ||
330 | __pu_err; \ | ||
331 | }) | ||
269 | 332 | ||
270 | #define __put_user(x, ptr) \ | 333 | #define __put_user(x, ptr) \ |
271 | ({ \ | 334 | ({ \ |
@@ -290,18 +353,6 @@ extern long __user_bad(void); | |||
290 | __gu_err; \ | 353 | __gu_err; \ |
291 | }) | 354 | }) |
292 | 355 | ||
293 | #ifndef CONFIG_MMU | ||
294 | |||
295 | #define put_user(x, ptr) __put_user((x), (ptr)) | ||
296 | |||
297 | #else /* CONFIG_MMU */ | ||
298 | |||
299 | #define put_user(x, ptr) \ | ||
300 | ({ \ | ||
301 | access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \ | ||
302 | ? __put_user((x), (ptr)) : -EFAULT; \ | ||
303 | }) | ||
304 | #endif /* CONFIG_MMU */ | ||
305 | 356 | ||
306 | /* copy_to_from_user */ | 357 | /* copy_to_from_user */ |
307 | #define __copy_from_user(to, from, n) \ | 358 | #define __copy_from_user(to, from, n) \ |