diff options
Diffstat (limited to 'include/asm-frv')
-rw-r--r-- | include/asm-frv/atomic.h | 4 | ||||
-rw-r--r-- | include/asm-frv/checksum.h | 2 | ||||
-rw-r--r-- | include/asm-frv/highmem.h | 2 | ||||
-rw-r--r-- | include/asm-frv/io.h | 40 | ||||
-rw-r--r-- | include/asm-frv/mb-regs.h | 27 | ||||
-rw-r--r-- | include/asm-frv/signal.h | 6 | ||||
-rw-r--r-- | include/asm-frv/uaccess.h | 64 | ||||
-rw-r--r-- | include/asm-frv/unistd.h | 19 |
8 files changed, 84 insertions, 80 deletions
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h index 9a4ff03c3969..066386ac238e 100644 --- a/include/asm-frv/atomic.h +++ b/include/asm-frv/atomic.h | |||
@@ -227,7 +227,7 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig | |||
227 | break; \ | 227 | break; \ |
228 | \ | 228 | \ |
229 | default: \ | 229 | default: \ |
230 | __xg_orig = 0; \ | 230 | __xg_orig = (__typeof__(__xg_orig))0; \ |
231 | asm volatile("break"); \ | 231 | asm volatile("break"); \ |
232 | break; \ | 232 | break; \ |
233 | } \ | 233 | } \ |
@@ -247,7 +247,7 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v); | |||
247 | switch (sizeof(__xg_orig)) { \ | 247 | switch (sizeof(__xg_orig)) { \ |
248 | case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ | 248 | case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ |
249 | default: \ | 249 | default: \ |
250 | __xg_orig = 0; \ | 250 | __xg_orig = (__typeof__(__xg_orig))0; \ |
251 | asm volatile("break"); \ | 251 | asm volatile("break"); \ |
252 | break; \ | 252 | break; \ |
253 | } \ | 253 | } \ |
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h index 10236f6802db..42bf0db2287a 100644 --- a/include/asm-frv/checksum.h +++ b/include/asm-frv/checksum.h | |||
@@ -43,7 +43,7 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); | |||
43 | * here even more important to align src and dst on a 32-bit (or even | 43 | * here even more important to align src and dst on a 32-bit (or even |
44 | * better 64-bit) boundary | 44 | * better 64-bit) boundary |
45 | */ | 45 | */ |
46 | extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, | 46 | extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, |
47 | int len, int sum, int *csum_err); | 47 | int len, int sum, int *csum_err); |
48 | 48 | ||
49 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | 49 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ |
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h index cfbf7d3a1feb..e2247c22a638 100644 --- a/include/asm-frv/highmem.h +++ b/include/asm-frv/highmem.h | |||
@@ -134,7 +134,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type) | |||
134 | 134 | ||
135 | default: | 135 | default: |
136 | BUG(); | 136 | BUG(); |
137 | return 0; | 137 | return NULL; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h index b56eba59e3cd..7765f5528894 100644 --- a/include/asm-frv/io.h +++ b/include/asm-frv/io.h | |||
@@ -40,13 +40,13 @@ static inline unsigned long _swapl(unsigned long v) | |||
40 | //#define __iormb() asm volatile("membar") | 40 | //#define __iormb() asm volatile("membar") |
41 | //#define __iowmb() asm volatile("membar") | 41 | //#define __iowmb() asm volatile("membar") |
42 | 42 | ||
43 | #define __raw_readb(addr) __builtin_read8((void *) (addr)) | 43 | #define __raw_readb __builtin_read8 |
44 | #define __raw_readw(addr) __builtin_read16((void *) (addr)) | 44 | #define __raw_readw __builtin_read16 |
45 | #define __raw_readl(addr) __builtin_read32((void *) (addr)) | 45 | #define __raw_readl __builtin_read32 |
46 | 46 | ||
47 | #define __raw_writeb(datum, addr) __builtin_write8((void *) (addr), datum) | 47 | #define __raw_writeb(datum, addr) __builtin_write8(addr, datum) |
48 | #define __raw_writew(datum, addr) __builtin_write16((void *) (addr), datum) | 48 | #define __raw_writew(datum, addr) __builtin_write16(addr, datum) |
49 | #define __raw_writel(datum, addr) __builtin_write32((void *) (addr), datum) | 49 | #define __raw_writel(datum, addr) __builtin_write32(addr, datum) |
50 | 50 | ||
51 | static inline void io_outsb(unsigned int addr, const void *buf, int len) | 51 | static inline void io_outsb(unsigned int addr, const void *buf, int len) |
52 | { | 52 | { |
@@ -116,7 +116,7 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val, int | |||
116 | memset((void __force *) addr, val, count); | 116 | memset((void __force *) addr, val, count); |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline void memcpy_fromio(void *dst, volatile void __iomem *src, int count) | 119 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) |
120 | { | 120 | { |
121 | memcpy(dst, (void __force *) src, count); | 121 | memcpy(dst, (void __force *) src, count); |
122 | } | 122 | } |
@@ -128,12 +128,12 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int | |||
128 | 128 | ||
129 | static inline uint8_t inb(unsigned long addr) | 129 | static inline uint8_t inb(unsigned long addr) |
130 | { | 130 | { |
131 | return __builtin_read8((void *)addr); | 131 | return __builtin_read8((void __iomem *)addr); |
132 | } | 132 | } |
133 | 133 | ||
134 | static inline uint16_t inw(unsigned long addr) | 134 | static inline uint16_t inw(unsigned long addr) |
135 | { | 135 | { |
136 | uint16_t ret = __builtin_read16((void *)addr); | 136 | uint16_t ret = __builtin_read16((void __iomem *)addr); |
137 | 137 | ||
138 | if (__is_PCI_IO(addr)) | 138 | if (__is_PCI_IO(addr)) |
139 | ret = _swapw(ret); | 139 | ret = _swapw(ret); |
@@ -143,7 +143,7 @@ static inline uint16_t inw(unsigned long addr) | |||
143 | 143 | ||
144 | static inline uint32_t inl(unsigned long addr) | 144 | static inline uint32_t inl(unsigned long addr) |
145 | { | 145 | { |
146 | uint32_t ret = __builtin_read32((void *)addr); | 146 | uint32_t ret = __builtin_read32((void __iomem *)addr); |
147 | 147 | ||
148 | if (__is_PCI_IO(addr)) | 148 | if (__is_PCI_IO(addr)) |
149 | ret = _swapl(ret); | 149 | ret = _swapl(ret); |
@@ -153,21 +153,21 @@ static inline uint32_t inl(unsigned long addr) | |||
153 | 153 | ||
154 | static inline void outb(uint8_t datum, unsigned long addr) | 154 | static inline void outb(uint8_t datum, unsigned long addr) |
155 | { | 155 | { |
156 | __builtin_write8((void *)addr, datum); | 156 | __builtin_write8((void __iomem *)addr, datum); |
157 | } | 157 | } |
158 | 158 | ||
159 | static inline void outw(uint16_t datum, unsigned long addr) | 159 | static inline void outw(uint16_t datum, unsigned long addr) |
160 | { | 160 | { |
161 | if (__is_PCI_IO(addr)) | 161 | if (__is_PCI_IO(addr)) |
162 | datum = _swapw(datum); | 162 | datum = _swapw(datum); |
163 | __builtin_write16((void *)addr, datum); | 163 | __builtin_write16((void __iomem *)addr, datum); |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline void outl(uint32_t datum, unsigned long addr) | 166 | static inline void outl(uint32_t datum, unsigned long addr) |
167 | { | 167 | { |
168 | if (__is_PCI_IO(addr)) | 168 | if (__is_PCI_IO(addr)) |
169 | datum = _swapl(datum); | 169 | datum = _swapl(datum); |
170 | __builtin_write32((void *)addr, datum); | 170 | __builtin_write32((void __iomem *)addr, datum); |
171 | } | 171 | } |
172 | 172 | ||
173 | #define inb_p(addr) inb(addr) | 173 | #define inb_p(addr) inb(addr) |
@@ -189,12 +189,12 @@ static inline void outl(uint32_t datum, unsigned long addr) | |||
189 | 189 | ||
190 | static inline uint8_t readb(const volatile void __iomem *addr) | 190 | static inline uint8_t readb(const volatile void __iomem *addr) |
191 | { | 191 | { |
192 | return __builtin_read8((volatile uint8_t __force *) addr); | 192 | return __builtin_read8((__force void volatile __iomem *) addr); |
193 | } | 193 | } |
194 | 194 | ||
195 | static inline uint16_t readw(const volatile void __iomem *addr) | 195 | static inline uint16_t readw(const volatile void __iomem *addr) |
196 | { | 196 | { |
197 | uint16_t ret = __builtin_read16((volatile uint16_t __force *)addr); | 197 | uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr); |
198 | 198 | ||
199 | if (__is_PCI_MEM(addr)) | 199 | if (__is_PCI_MEM(addr)) |
200 | ret = _swapw(ret); | 200 | ret = _swapw(ret); |
@@ -203,7 +203,7 @@ static inline uint16_t readw(const volatile void __iomem *addr) | |||
203 | 203 | ||
204 | static inline uint32_t readl(const volatile void __iomem *addr) | 204 | static inline uint32_t readl(const volatile void __iomem *addr) |
205 | { | 205 | { |
206 | uint32_t ret = __builtin_read32((volatile uint32_t __force *)addr); | 206 | uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr); |
207 | 207 | ||
208 | if (__is_PCI_MEM(addr)) | 208 | if (__is_PCI_MEM(addr)) |
209 | ret = _swapl(ret); | 209 | ret = _swapl(ret); |
@@ -217,7 +217,7 @@ static inline uint32_t readl(const volatile void __iomem *addr) | |||
217 | 217 | ||
218 | static inline void writeb(uint8_t datum, volatile void __iomem *addr) | 218 | static inline void writeb(uint8_t datum, volatile void __iomem *addr) |
219 | { | 219 | { |
220 | __builtin_write8((volatile uint8_t __force *) addr, datum); | 220 | __builtin_write8(addr, datum); |
221 | if (__is_PCI_MEM(addr)) | 221 | if (__is_PCI_MEM(addr)) |
222 | __flush_PCI_writes(); | 222 | __flush_PCI_writes(); |
223 | } | 223 | } |
@@ -227,7 +227,7 @@ static inline void writew(uint16_t datum, volatile void __iomem *addr) | |||
227 | if (__is_PCI_MEM(addr)) | 227 | if (__is_PCI_MEM(addr)) |
228 | datum = _swapw(datum); | 228 | datum = _swapw(datum); |
229 | 229 | ||
230 | __builtin_write16((volatile uint16_t __force *) addr, datum); | 230 | __builtin_write16(addr, datum); |
231 | if (__is_PCI_MEM(addr)) | 231 | if (__is_PCI_MEM(addr)) |
232 | __flush_PCI_writes(); | 232 | __flush_PCI_writes(); |
233 | } | 233 | } |
@@ -237,7 +237,7 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr) | |||
237 | if (__is_PCI_MEM(addr)) | 237 | if (__is_PCI_MEM(addr)) |
238 | datum = _swapl(datum); | 238 | datum = _swapl(datum); |
239 | 239 | ||
240 | __builtin_write32((volatile uint32_t __force *) addr, datum); | 240 | __builtin_write32(addr, datum); |
241 | if (__is_PCI_MEM(addr)) | 241 | if (__is_PCI_MEM(addr)) |
242 | __flush_PCI_writes(); | 242 | __flush_PCI_writes(); |
243 | } | 243 | } |
@@ -271,7 +271,7 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l | |||
271 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | 271 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); |
272 | } | 272 | } |
273 | 273 | ||
274 | extern void iounmap(void __iomem *addr); | 274 | extern void iounmap(void volatile __iomem *addr); |
275 | 275 | ||
276 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | 276 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) |
277 | { | 277 | { |
diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h index 93fa732fb0cd..219e5f926f18 100644 --- a/include/asm-frv/mb-regs.h +++ b/include/asm-frv/mb-regs.h | |||
@@ -16,6 +16,17 @@ | |||
16 | #include <asm/sections.h> | 16 | #include <asm/sections.h> |
17 | #include <asm/mem-layout.h> | 17 | #include <asm/mem-layout.h> |
18 | 18 | ||
19 | #ifndef __ASSEMBLY__ | ||
20 | /* gcc builtins, annotated */ | ||
21 | |||
22 | unsigned long __builtin_read8(volatile void __iomem *); | ||
23 | unsigned long __builtin_read16(volatile void __iomem *); | ||
24 | unsigned long __builtin_read32(volatile void __iomem *); | ||
25 | void __builtin_write8(volatile void __iomem *, unsigned char); | ||
26 | void __builtin_write16(volatile void __iomem *, unsigned short); | ||
27 | void __builtin_write32(volatile void __iomem *, unsigned long); | ||
28 | #endif | ||
29 | |||
19 | #define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable | 30 | #define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable |
20 | * protection laid over the top for use in memory-mapped | 31 | * protection laid over the top for use in memory-mapped |
21 | * I/O | 32 | * I/O |
@@ -59,7 +70,7 @@ | |||
59 | #define __region_PCI_MEM (__region_CS2 + 0x08000000UL) | 70 | #define __region_PCI_MEM (__region_CS2 + 0x08000000UL) |
60 | #define __flush_PCI_writes() \ | 71 | #define __flush_PCI_writes() \ |
61 | do { \ | 72 | do { \ |
62 | __builtin_write8((volatile void *) __region_PCI_MEM, 0); \ | 73 | __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \ |
63 | } while(0) | 74 | } while(0) |
64 | 75 | ||
65 | #define __is_PCI_IO(addr) \ | 76 | #define __is_PCI_IO(addr) \ |
@@ -83,15 +94,15 @@ extern int __nongprelbss mb93090_mb00_detected; | |||
83 | #define __set_LEDS(X) \ | 94 | #define __set_LEDS(X) \ |
84 | do { \ | 95 | do { \ |
85 | if (mb93090_mb00_detected) \ | 96 | if (mb93090_mb00_detected) \ |
86 | __builtin_write32((void *) __addr_LEDS(), ~(X)); \ | 97 | __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \ |
87 | } while (0) | 98 | } while (0) |
88 | #else | 99 | #else |
89 | #define __set_LEDS(X) | 100 | #define __set_LEDS(X) |
90 | #endif | 101 | #endif |
91 | 102 | ||
92 | #define __addr_LCD() (__region_CS2 + 0x01200008UL) | 103 | #define __addr_LCD() (__region_CS2 + 0x01200008UL) |
93 | #define __get_LCD(B) __builtin_read32((volatile void *) (B)) | 104 | #define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B)) |
94 | #define __set_LCD(B,X) __builtin_write32((volatile void *) (B), (X)) | 105 | #define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X)) |
95 | 106 | ||
96 | #define LCD_D 0x000000ff /* LCD data bus */ | 107 | #define LCD_D 0x000000ff /* LCD data bus */ |
97 | #define LCD_RW 0x00000100 /* LCD R/W signal */ | 108 | #define LCD_RW 0x00000100 /* LCD R/W signal */ |
@@ -161,11 +172,11 @@ do { \ | |||
161 | #define __get_CLKIN() 66000000UL | 172 | #define __get_CLKIN() 66000000UL |
162 | 173 | ||
163 | #define __addr_LEDS() (__region_CS2 + 0x00000023UL) | 174 | #define __addr_LEDS() (__region_CS2 + 0x00000023UL) |
164 | #define __set_LEDS(X) __builtin_write8((volatile void *) __addr_LEDS(), (X)) | 175 | #define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X)) |
165 | 176 | ||
166 | #define __addr_FPGATR() (__region_CS2 + 0x00000030UL) | 177 | #define __addr_FPGATR() (__region_CS2 + 0x00000030UL) |
167 | #define __set_FPGATR(X) __builtin_write32((volatile void *) __addr_FPGATR(), (X)) | 178 | #define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X)) |
168 | #define __get_FPGATR() __builtin_read32((volatile void *) __addr_FPGATR()) | 179 | #define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR()) |
169 | 180 | ||
170 | #define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 | 181 | #define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 |
171 | 182 | ||
@@ -180,7 +191,7 @@ do { \ | |||
180 | #define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) | 191 | #define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) |
181 | #define MB93093_FPGA_SWR_PUSHSW4 (1<<29) | 192 | #define MB93093_FPGA_SWR_PUSHSW4 (1<<29) |
182 | 193 | ||
183 | #define __addr_FPGA_SWR ((volatile void *)(__region_CS2 + 0x28UL)) | 194 | #define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL)) |
184 | #define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) | 195 | #define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) |
185 | 196 | ||
186 | 197 | ||
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h index 67366894780f..dcc1b3592918 100644 --- a/include/asm-frv/signal.h +++ b/include/asm-frv/signal.h | |||
@@ -114,13 +114,13 @@ struct old_sigaction { | |||
114 | __sighandler_t sa_handler; | 114 | __sighandler_t sa_handler; |
115 | old_sigset_t sa_mask; | 115 | old_sigset_t sa_mask; |
116 | unsigned long sa_flags; | 116 | unsigned long sa_flags; |
117 | void (*sa_restorer)(void); | 117 | __sigrestore_t sa_restorer; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct sigaction { | 120 | struct sigaction { |
121 | __sighandler_t sa_handler; | 121 | __sighandler_t sa_handler; |
122 | unsigned long sa_flags; | 122 | unsigned long sa_flags; |
123 | void (*sa_restorer)(void); | 123 | __sigrestore_t sa_restorer; |
124 | sigset_t sa_mask; /* mask last for extensibility */ | 124 | sigset_t sa_mask; /* mask last for extensibility */ |
125 | }; | 125 | }; |
126 | 126 | ||
@@ -146,7 +146,7 @@ struct sigaction { | |||
146 | #endif /* __KERNEL__ */ | 146 | #endif /* __KERNEL__ */ |
147 | 147 | ||
148 | typedef struct sigaltstack { | 148 | typedef struct sigaltstack { |
149 | void *ss_sp; | 149 | void __user *ss_sp; |
150 | int ss_flags; | 150 | int ss_flags; |
151 | size_t ss_size; | 151 | size_t ss_size; |
152 | } stack_t; | 152 | } stack_t; |
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h index a1d140438863..3d90e1018ee2 100644 --- a/include/asm-frv/uaccess.h +++ b/include/asm-frv/uaccess.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ | 23 | #define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ |
24 | 24 | ||
25 | #define __ptr(x) ((unsigned long *)(x)) | 25 | #define __ptr(x) ((unsigned long __force *)(x)) |
26 | 26 | ||
27 | #define VERIFY_READ 0 | 27 | #define VERIFY_READ 0 |
28 | #define VERIFY_WRITE 1 | 28 | #define VERIFY_WRITE 1 |
@@ -64,7 +64,7 @@ static inline int ___range_ok(unsigned long addr, unsigned long size) | |||
64 | 64 | ||
65 | #define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size)) | 65 | #define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size)) |
66 | 66 | ||
67 | #define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0) | 67 | #define access_ok(type,addr,size) (__range_ok((void __user *)(addr), (size)) == 0) |
68 | #define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) | 68 | #define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) |
69 | 69 | ||
70 | /* | 70 | /* |
@@ -97,6 +97,7 @@ extern unsigned long search_exception_table(unsigned long); | |||
97 | int __pu_err = 0; \ | 97 | int __pu_err = 0; \ |
98 | \ | 98 | \ |
99 | typeof(*(ptr)) __pu_val = (x); \ | 99 | typeof(*(ptr)) __pu_val = (x); \ |
100 | __chk_user_ptr(ptr); \ | ||
100 | \ | 101 | \ |
101 | switch (sizeof (*(ptr))) { \ | 102 | switch (sizeof (*(ptr))) { \ |
102 | case 1: \ | 103 | case 1: \ |
@@ -120,7 +121,7 @@ extern unsigned long search_exception_table(unsigned long); | |||
120 | 121 | ||
121 | #define put_user(x, ptr) \ | 122 | #define put_user(x, ptr) \ |
122 | ({ \ | 123 | ({ \ |
123 | typeof(&*ptr) _p = (ptr); \ | 124 | typeof(*(ptr)) __user *_p = (ptr); \ |
124 | int _e; \ | 125 | int _e; \ |
125 | \ | 126 | \ |
126 | _e = __range_ok(_p, sizeof(*_p)); \ | 127 | _e = __range_ok(_p, sizeof(*_p)); \ |
@@ -175,33 +176,44 @@ do { \ | |||
175 | */ | 176 | */ |
176 | #define __get_user(x, ptr) \ | 177 | #define __get_user(x, ptr) \ |
177 | ({ \ | 178 | ({ \ |
178 | typeof(*(ptr)) __gu_val = 0; \ | ||
179 | int __gu_err = 0; \ | 179 | int __gu_err = 0; \ |
180 | __chk_user_ptr(ptr); \ | ||
180 | \ | 181 | \ |
181 | switch (sizeof(*(ptr))) { \ | 182 | switch (sizeof(*(ptr))) { \ |
182 | case 1: \ | 183 | case 1: { \ |
183 | __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \ | 184 | unsigned char __gu_val; \ |
185 | __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \ | ||
186 | (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ | ||
184 | break; \ | 187 | break; \ |
185 | case 2: \ | 188 | } \ |
186 | __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \ | 189 | case 2: { \ |
190 | unsigned short __gu_val; \ | ||
191 | __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \ | ||
192 | (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ | ||
187 | break; \ | 193 | break; \ |
188 | case 4: \ | 194 | } \ |
189 | __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \ | 195 | case 4: { \ |
196 | unsigned int __gu_val; \ | ||
197 | __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \ | ||
198 | (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ | ||
190 | break; \ | 199 | break; \ |
191 | case 8: \ | 200 | } \ |
192 | __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \ | 201 | case 8: { \ |
202 | unsigned long long __gu_val; \ | ||
203 | __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \ | ||
204 | (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ | ||
193 | break; \ | 205 | break; \ |
206 | } \ | ||
194 | default: \ | 207 | default: \ |
195 | __gu_err = __get_user_bad(); \ | 208 | __gu_err = __get_user_bad(); \ |
196 | break; \ | 209 | break; \ |
197 | } \ | 210 | } \ |
198 | (x) = __gu_val; \ | ||
199 | __gu_err; \ | 211 | __gu_err; \ |
200 | }) | 212 | }) |
201 | 213 | ||
202 | #define get_user(x, ptr) \ | 214 | #define get_user(x, ptr) \ |
203 | ({ \ | 215 | ({ \ |
204 | typeof(&*ptr) _p = (ptr); \ | 216 | const typeof(*(ptr)) __user *_p = (ptr);\ |
205 | int _e; \ | 217 | int _e; \ |
206 | \ | 218 | \ |
207 | _e = __range_ok(_p, sizeof(*_p)); \ | 219 | _e = __range_ok(_p, sizeof(*_p)); \ |
@@ -248,19 +260,20 @@ do { \ | |||
248 | /* | 260 | /* |
249 | * | 261 | * |
250 | */ | 262 | */ |
263 | #define ____force(x) (__force void *)(void __user *)(x) | ||
251 | #ifdef CONFIG_MMU | 264 | #ifdef CONFIG_MMU |
252 | extern long __memset_user(void *dst, unsigned long count); | 265 | extern long __memset_user(void *dst, unsigned long count); |
253 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); | 266 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
254 | 267 | ||
255 | #define clear_user(dst,count) __memset_user((dst), (count)) | 268 | #define clear_user(dst,count) __memset_user(____force(dst), (count)) |
256 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) | 269 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) |
257 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user((to), (from), (n)) | 270 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) |
258 | 271 | ||
259 | #else | 272 | #else |
260 | 273 | ||
261 | #define clear_user(dst,count) (memset((dst), 0, (count)), 0) | 274 | #define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
262 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) | 275 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) |
263 | #define __copy_to_user_inatomic(to, from, n) (memcpy((to), (from), (n)), 0) | 276 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) |
264 | 277 | ||
265 | #endif | 278 | #endif |
266 | 279 | ||
@@ -278,7 +291,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n) | |||
278 | return __copy_from_user_inatomic(to, from, n); | 291 | return __copy_from_user_inatomic(to, from, n); |
279 | } | 292 | } |
280 | 293 | ||
281 | static inline long copy_from_user(void *to, const void *from, unsigned long n) | 294 | static inline long copy_from_user(void *to, const void __user *from, unsigned long n) |
282 | { | 295 | { |
283 | unsigned long ret = n; | 296 | unsigned long ret = n; |
284 | 297 | ||
@@ -291,16 +304,13 @@ static inline long copy_from_user(void *to, const void *from, unsigned long n) | |||
291 | return ret; | 304 | return ret; |
292 | } | 305 | } |
293 | 306 | ||
294 | static inline long copy_to_user(void *to, const void *from, unsigned long n) | 307 | static inline long copy_to_user(void __user *to, const void *from, unsigned long n) |
295 | { | 308 | { |
296 | return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n; | 309 | return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n; |
297 | } | 310 | } |
298 | 311 | ||
299 | #define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) | 312 | extern long strncpy_from_user(char *dst, const char __user *src, long count); |
300 | #define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) | 313 | extern long strnlen_user(const char __user *src, long count); |
301 | |||
302 | extern long strncpy_from_user(char *dst, const char *src, long count); | ||
303 | extern long strnlen_user(const char *src, long count); | ||
304 | 314 | ||
305 | #define strlen_user(str) strnlen_user(str, 32767) | 315 | #define strlen_user(str) strnlen_user(str, 32767) |
306 | 316 | ||
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h index 7c2e712c3b73..b80dbd839475 100644 --- a/include/asm-frv/unistd.h +++ b/include/asm-frv/unistd.h | |||
@@ -306,7 +306,7 @@ | |||
306 | #define __NR_mknodat 297 | 306 | #define __NR_mknodat 297 |
307 | #define __NR_fchownat 298 | 307 | #define __NR_fchownat 298 |
308 | #define __NR_futimesat 299 | 308 | #define __NR_futimesat 299 |
309 | #define __NR_newfstatat 300 | 309 | #define __NR_fstatat64 300 |
310 | #define __NR_unlinkat 301 | 310 | #define __NR_unlinkat 301 |
311 | #define __NR_renameat 302 | 311 | #define __NR_renameat 302 |
312 | #define __NR_linkat 303 | 312 | #define __NR_linkat 303 |
@@ -460,24 +460,7 @@ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg | |||
460 | * some others too. | 460 | * some others too. |
461 | */ | 461 | */ |
462 | #define __NR__exit __NR_exit | 462 | #define __NR__exit __NR_exit |
463 | static inline _syscall0(int,pause) | ||
464 | static inline _syscall0(int,sync) | ||
465 | static inline _syscall0(pid_t,setsid) | ||
466 | static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) | ||
467 | static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
468 | static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
469 | static inline _syscall1(int,dup,int,fd) | ||
470 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) | 463 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) |
471 | static inline _syscall3(int,open,const char *,file,int,flag,int,mode) | ||
472 | static inline _syscall1(int,close,int,fd) | ||
473 | static inline _syscall1(int,_exit,int,exitcode) | ||
474 | static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
475 | static inline _syscall1(int,delete_module,const char *,name) | ||
476 | |||
477 | static inline pid_t wait(int * wait_stat) | ||
478 | { | ||
479 | return waitpid(-1,wait_stat,0); | ||
480 | } | ||
481 | 464 | ||
482 | #endif /* __KERNEL_SYSCALLS__ */ | 465 | #endif /* __KERNEL_SYSCALLS__ */ |
483 | 466 | ||