aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 20:38:33 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 20:38:33 -0500
commit1ca949299260aa49eeba34ff912e2321c8b1f647 (patch)
treebb23ca6055b30a43c6c6c51c869c66f23180bb48
parentc9ce228306fda4448f5f495b4f36c07956f45acd (diff)
parent0cfd5267476ce8051c4447988d2b0377d09188e8 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] Cobalt: Fix UART I/O type [MIPS] Fixup copy_from_user_inatomic [MIPS] Fix struct sigcontext for N32 userland [MIPS] Make some __setup functions static [MIPS] Declare highstart_pfn, highend_pfn only if CONFIG_HIGHMEM=y [MIPS] Allow selection of KGDB only on platforms where it's supported.
-rw-r--r--arch/mips/Kconfig14
-rw-r--r--arch/mips/Kconfig.debug5
-rw-r--r--arch/mips/cobalt/setup.c14
-rw-r--r--arch/mips/kernel/cpu-probe.c2
-rw-r--r--arch/mips/kernel/setup.c4
-rw-r--r--arch/mips/lib/Makefile2
-rw-r--r--arch/mips/lib/memcpy-inatomic.S436
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--include/asm-mips/sigcontext.h33
-rw-r--r--include/asm-mips/uaccess.h51
10 files changed, 532 insertions, 33 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 46fa5ca9f5ac..c6f74f1c6398 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -144,6 +144,7 @@ config BASLER_EXCITE
144 select SYS_SUPPORTS_32BIT_KERNEL 144 select SYS_SUPPORTS_32BIT_KERNEL
145 select SYS_SUPPORTS_64BIT_KERNEL 145 select SYS_SUPPORTS_64BIT_KERNEL
146 select SYS_SUPPORTS_BIG_ENDIAN 146 select SYS_SUPPORTS_BIG_ENDIAN
147 select SYS_SUPPORTS_KGDB
147 help 148 help
148 The eXcite is a smart camera platform manufactured by 149 The eXcite is a smart camera platform manufactured by
149 Basler Vision Technologies AG 150 Basler Vision Technologies AG
@@ -210,6 +211,7 @@ config MIPS_EV64120
210 select SYS_SUPPORTS_32BIT_KERNEL 211 select SYS_SUPPORTS_32BIT_KERNEL
211 select SYS_SUPPORTS_64BIT_KERNEL 212 select SYS_SUPPORTS_64BIT_KERNEL
212 select SYS_SUPPORTS_BIG_ENDIAN 213 select SYS_SUPPORTS_BIG_ENDIAN
214 select SYS_SUPPORTS_KGDB
213 help 215 help
214 This is an evaluation board based on the Galileo GT-64120 216 This is an evaluation board based on the Galileo GT-64120
215 single-chip system controller that contains a MIPS R5000 compatible 217 single-chip system controller that contains a MIPS R5000 compatible
@@ -374,6 +376,7 @@ config MOMENCO_JAGUAR_ATX
374 select SYS_SUPPORTS_32BIT_KERNEL 376 select SYS_SUPPORTS_32BIT_KERNEL
375 select SYS_SUPPORTS_64BIT_KERNEL 377 select SYS_SUPPORTS_64BIT_KERNEL
376 select SYS_SUPPORTS_BIG_ENDIAN 378 select SYS_SUPPORTS_BIG_ENDIAN
379 select SYS_SUPPORTS_KGDB
377 help 380 help
378 The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by 381 The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by
379 Momentum Computer <http://www.momenco.com/>. 382 Momentum Computer <http://www.momenco.com/>.
@@ -391,6 +394,7 @@ config MOMENCO_OCELOT
391 select SYS_SUPPORTS_32BIT_KERNEL 394 select SYS_SUPPORTS_32BIT_KERNEL
392 select SYS_SUPPORTS_64BIT_KERNEL 395 select SYS_SUPPORTS_64BIT_KERNEL
393 select SYS_SUPPORTS_BIG_ENDIAN 396 select SYS_SUPPORTS_BIG_ENDIAN
397 select SYS_SUPPORTS_KGDB
394 help 398 help
395 The Ocelot is a MIPS-based Single Board Computer (SBC) made by 399 The Ocelot is a MIPS-based Single Board Computer (SBC) made by
396 Momentum Computer <http://www.momenco.com/>. 400 Momentum Computer <http://www.momenco.com/>.
@@ -480,6 +484,8 @@ config DDB5477
480 select SYS_HAS_CPU_R5432 484 select SYS_HAS_CPU_R5432
481 select SYS_SUPPORTS_32BIT_KERNEL 485 select SYS_SUPPORTS_32BIT_KERNEL
482 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 486 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
487 select SYS_SUPPORTS_KGDB
488 select SYS_SUPPORTS_KGDB
483 select SYS_SUPPORTS_LITTLE_ENDIAN 489 select SYS_SUPPORTS_LITTLE_ENDIAN
484 help 490 help
485 This enables support for the R5432-based NEC DDB Vrc-5477, 491 This enables support for the R5432-based NEC DDB Vrc-5477,
@@ -508,6 +514,7 @@ config PMC_YOSEMITE
508 select SYS_SUPPORTS_64BIT_KERNEL 514 select SYS_SUPPORTS_64BIT_KERNEL
509 select SYS_SUPPORTS_BIG_ENDIAN 515 select SYS_SUPPORTS_BIG_ENDIAN
510 select SYS_SUPPORTS_HIGHMEM 516 select SYS_SUPPORTS_HIGHMEM
517 select SYS_SUPPORTS_KGDB
511 select SYS_SUPPORTS_SMP 518 select SYS_SUPPORTS_SMP
512 help 519 help
513 Yosemite is an evaluation board for the RM9000x2 processor 520 Yosemite is an evaluation board for the RM9000x2 processor
@@ -584,6 +591,7 @@ config SGI_IP27
584 select SYS_HAS_CPU_R10000 591 select SYS_HAS_CPU_R10000
585 select SYS_SUPPORTS_64BIT_KERNEL 592 select SYS_SUPPORTS_64BIT_KERNEL
586 select SYS_SUPPORTS_BIG_ENDIAN 593 select SYS_SUPPORTS_BIG_ENDIAN
594 select SYS_SUPPORTS_KGDB
587 select SYS_SUPPORTS_NUMA 595 select SYS_SUPPORTS_NUMA
588 select SYS_SUPPORTS_SMP 596 select SYS_SUPPORTS_SMP
589 select GENERIC_HARDIRQS_NO__DO_IRQ 597 select GENERIC_HARDIRQS_NO__DO_IRQ
@@ -633,6 +641,7 @@ config SIBYTE_SWARM
633 select SYS_HAS_CPU_SB1 641 select SYS_HAS_CPU_SB1
634 select SYS_SUPPORTS_BIG_ENDIAN 642 select SYS_SUPPORTS_BIG_ENDIAN
635 select SYS_SUPPORTS_HIGHMEM 643 select SYS_SUPPORTS_HIGHMEM
644 select SYS_SUPPORTS_KGDB
636 select SYS_SUPPORTS_LITTLE_ENDIAN 645 select SYS_SUPPORTS_LITTLE_ENDIAN
637 646
638config SIBYTE_SENTOSA 647config SIBYTE_SENTOSA
@@ -773,6 +782,7 @@ config TOSHIBA_RBTX4927
773 select SYS_SUPPORTS_64BIT_KERNEL 782 select SYS_SUPPORTS_64BIT_KERNEL
774 select SYS_SUPPORTS_LITTLE_ENDIAN 783 select SYS_SUPPORTS_LITTLE_ENDIAN
775 select SYS_SUPPORTS_BIG_ENDIAN 784 select SYS_SUPPORTS_BIG_ENDIAN
785 select SYS_SUPPORTS_KGDB
776 select TOSHIBA_BOARDS 786 select TOSHIBA_BOARDS
777 select GENERIC_HARDIRQS_NO__DO_IRQ 787 select GENERIC_HARDIRQS_NO__DO_IRQ
778 help 788 help
@@ -793,6 +803,7 @@ config TOSHIBA_RBTX4938
793 select SYS_SUPPORTS_32BIT_KERNEL 803 select SYS_SUPPORTS_32BIT_KERNEL
794 select SYS_SUPPORTS_LITTLE_ENDIAN 804 select SYS_SUPPORTS_LITTLE_ENDIAN
795 select SYS_SUPPORTS_BIG_ENDIAN 805 select SYS_SUPPORTS_BIG_ENDIAN
806 select SYS_SUPPORTS_KGDB
796 select TOSHIBA_BOARDS 807 select TOSHIBA_BOARDS
797 select GENERIC_HARDIRQS_NO__DO_IRQ 808 select GENERIC_HARDIRQS_NO__DO_IRQ
798 help 809 help
@@ -959,6 +970,7 @@ config IRQ_MV64340
959 970
960config DDB5XXX_COMMON 971config DDB5XXX_COMMON
961 bool 972 bool
973 select SYS_SUPPORTS_KGDB
962 974
963config MIPS_BOARDS_GEN 975config MIPS_BOARDS_GEN
964 bool 976 bool
@@ -1007,6 +1019,7 @@ config SOC_AU1X00
1007 select SYS_HAS_CPU_MIPS32_R1 1019 select SYS_HAS_CPU_MIPS32_R1
1008 select SYS_SUPPORTS_32BIT_KERNEL 1020 select SYS_SUPPORTS_32BIT_KERNEL
1009 select SYS_SUPPORTS_APM_EMULATION 1021 select SYS_SUPPORTS_APM_EMULATION
1022 select SYS_SUPPORTS_KGDB
1010 1023
1011config PNX8550 1024config PNX8550
1012 bool 1025 bool
@@ -1019,6 +1032,7 @@ config SOC_PNX8550
1019 select SYS_HAS_CPU_MIPS32_R1 1032 select SYS_HAS_CPU_MIPS32_R1
1020 select SYS_SUPPORTS_32BIT_KERNEL 1033 select SYS_SUPPORTS_32BIT_KERNEL
1021 select GENERIC_HARDIRQS_NO__DO_IRQ 1034 select GENERIC_HARDIRQS_NO__DO_IRQ
1035 select SYS_SUPPORTS_KGDB
1022 1036
1023config SWAP_IO_SPACE 1037config SWAP_IO_SPACE
1024 bool 1038 bool
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 9351f1c04a9d..d5e60a0c1ded 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -39,7 +39,7 @@ config DEBUG_STACK_USAGE
39 39
40config KGDB 40config KGDB
41 bool "Remote GDB kernel debugging" 41 bool "Remote GDB kernel debugging"
42 depends on DEBUG_KERNEL 42 depends on DEBUG_KERNEL && SYS_SUPPORTS_KGDB
43 select DEBUG_INFO 43 select DEBUG_INFO
44 help 44 help
45 If you say Y here, it will be possible to remotely debug the MIPS 45 If you say Y here, it will be possible to remotely debug the MIPS
@@ -48,6 +48,9 @@ config KGDB
48 better 32 MB RAM to avoid excessive linking time. This is only 48 better 32 MB RAM to avoid excessive linking time. This is only
49 useful for kernel hackers. If unsure, say N. 49 useful for kernel hackers. If unsure, say N.
50 50
51config SYS_SUPPORTS_KGDB
52 bool
53
51config GDB_CONSOLE 54config GDB_CONSOLE
52 bool "Console output to GDB" 55 bool "Console output to GDB"
53 depends on KGDB 56 depends on KGDB
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index a4b69b543bd9..415ff8710b55 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -130,7 +130,7 @@ void __init plat_mem_setup(void)
130 130
131 set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE)); 131 set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
132 132
133 /* I/O port resource must include UART and LCD/buttons */ 133 /* I/O port resource must include LCD/buttons */
134 ioport_resource.end = 0x0fffffff; 134 ioport_resource.end = 0x0fffffff;
135 135
136 /* request I/O space for devices used on all i[345]86 PCs */ 136 /* request I/O space for devices used on all i[345]86 PCs */
@@ -149,24 +149,24 @@ void __init plat_mem_setup(void)
149 register_pci_controller(&cobalt_pci_controller); 149 register_pci_controller(&cobalt_pci_controller);
150#endif 150#endif
151 151
152#ifdef CONFIG_SERIAL_8250
153 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { 152 if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
154
155#ifdef CONFIG_EARLY_PRINTK 153#ifdef CONFIG_EARLY_PRINTK
156 cobalt_early_console(); 154 cobalt_early_console();
157#endif 155#endif
158 156
157#ifdef CONFIG_SERIAL_8250
159 uart.line = 0; 158 uart.line = 0;
160 uart.type = PORT_UNKNOWN; 159 uart.type = PORT_UNKNOWN;
161 uart.uartclk = 18432000; 160 uart.uartclk = 18432000;
162 uart.irq = COBALT_SERIAL_IRQ; 161 uart.irq = COBALT_SERIAL_IRQ;
163 uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 162 uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF |
164 uart.iobase = 0xc800000; 163 UPF_SKIP_TEST;
165 uart.iotype = UPIO_PORT; 164 uart.iotype = UPIO_MEM;
165 uart.mapbase = 0x1c800000;
166 166
167 early_serial_setup(&uart); 167 early_serial_setup(&uart);
168 }
169#endif 168#endif
169 }
170} 170}
171 171
172/* 172/*
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 50ed6d58ae71..ab755ea26c6a 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -98,7 +98,7 @@ static void au1k_wait(void)
98 98
99static int __initdata nowait = 0; 99static int __initdata nowait = 0;
100 100
101int __init wait_disable(char *s) 101static int __init wait_disable(char *s)
102{ 102{
103 nowait = 1; 103 nowait = 1;
104 104
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 394540fad769..11ab222a2e97 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -543,7 +543,7 @@ void __init setup_arch(char **cmdline_p)
543#endif 543#endif
544} 544}
545 545
546int __init fpu_disable(char *s) 546static int __init fpu_disable(char *s)
547{ 547{
548 int i; 548 int i;
549 549
@@ -555,7 +555,7 @@ int __init fpu_disable(char *s)
555 555
556__setup("nofpu", fpu_disable); 556__setup("nofpu", fpu_disable);
557 557
558int __init dsp_disable(char *s) 558static int __init dsp_disable(char *s)
559{ 559{
560 cpu_data[0].ases &= ~MIPS_ASE_DSP; 560 cpu_data[0].ases &= ~MIPS_ASE_DSP;
561 561
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 9e5d985936b3..2453ea244cb8 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for MIPS-specific library files.. 2# Makefile for MIPS-specific library files..
3# 3#
4 4
5lib-y += csum_partial.o memcpy.o memset.o promlib.o \ 5lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o promlib.o \
6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o 6 strlen_user.o strncpy_user.o strnlen_user.o uncached.o
7 7
8obj-y += iomap.o 8obj-y += iomap.o
diff --git a/arch/mips/lib/memcpy-inatomic.S b/arch/mips/lib/memcpy-inatomic.S
new file mode 100644
index 000000000000..3a534b2baa0f
--- /dev/null
+++ b/arch/mips/lib/memcpy-inatomic.S
@@ -0,0 +1,436 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Unified implementation of memcpy, memmove and the __copy_user backend.
7 *
8 * Copyright (C) 1998, 99, 2000, 01, 2002 Ralf Baechle (ralf@gnu.org)
9 * Copyright (C) 1999, 2000, 01, 2002 Silicon Graphics, Inc.
10 * Copyright (C) 2002 Broadcom, Inc.
11 * memcpy/copy_user author: Mark Vandevoorde
12 *
13 * Mnemonic names for arguments to memcpy/__copy_user
14 */
15
16/*
17 * Hack to resolve longstanding prefetch issue
18 *
19 * Prefetching may be fatal on some systems if we're prefetching beyond the
20 * end of memory on some systems. It's also a seriously bad idea on non
21 * dma-coherent systems.
22 */
23#if !defined(CONFIG_DMA_COHERENT) || !defined(CONFIG_DMA_IP27)
24#undef CONFIG_CPU_HAS_PREFETCH
25#endif
26#ifdef CONFIG_MIPS_MALTA
27#undef CONFIG_CPU_HAS_PREFETCH
28#endif
29
30#include <asm/asm.h>
31#include <asm/asm-offsets.h>
32#include <asm/regdef.h>
33
34#define dst a0
35#define src a1
36#define len a2
37
38/*
39 * Spec
40 *
41 * memcpy copies len bytes from src to dst and sets v0 to dst.
42 * It assumes that
43 * - src and dst don't overlap
44 * - src is readable
45 * - dst is writable
46 * memcpy uses the standard calling convention
47 *
48 * __copy_user copies up to len bytes from src to dst and sets a2 (len) to
49 * the number of uncopied bytes due to an exception caused by a read or write.
50 * __copy_user assumes that src and dst don't overlap, and that the call is
51 * implementing one of the following:
52 * copy_to_user
53 * - src is readable (no exceptions when reading src)
54 * copy_from_user
55 * - dst is writable (no exceptions when writing dst)
56 * __copy_user uses a non-standard calling convention; see
57 * include/asm-mips/uaccess.h
58 *
59 * When an exception happens on a load, the handler must
60 # ensure that all of the destination buffer is overwritten to prevent
61 * leaking information to user mode programs.
62 */
63
64/*
65 * Implementation
66 */
67
68/*
69 * The exception handler for loads requires that:
70 * 1- AT contain the address of the byte just past the end of the source
71 * of the copy,
72 * 2- src_entry <= src < AT, and
73 * 3- (dst - src) == (dst_entry - src_entry),
74 * The _entry suffix denotes values when __copy_user was called.
75 *
76 * (1) is set up up by uaccess.h and maintained by not writing AT in copy_user
77 * (2) is met by incrementing src by the number of bytes copied
78 * (3) is met by not doing loads between a pair of increments of dst and src
79 *
80 * The exception handlers for stores adjust len (if necessary) and return.
81 * These handlers do not need to overwrite any data.
82 *
83 * For __rmemcpy and memmove an exception is always a kernel bug, therefore
84 * they're not protected.
85 */
86
87#define EXC(inst_reg,addr,handler) \
889: inst_reg, addr; \
89 .section __ex_table,"a"; \
90 PTR 9b, handler; \
91 .previous
92
93/*
94 * Only on the 64-bit kernel we can made use of 64-bit registers.
95 */
96#ifdef CONFIG_64BIT
97#define USE_DOUBLE
98#endif
99
100#ifdef USE_DOUBLE
101
102#define LOAD ld
103#define LOADL ldl
104#define LOADR ldr
105#define STOREL sdl
106#define STORER sdr
107#define STORE sd
108#define ADD daddu
109#define SUB dsubu
110#define SRL dsrl
111#define SRA dsra
112#define SLL dsll
113#define SLLV dsllv
114#define SRLV dsrlv
115#define NBYTES 8
116#define LOG_NBYTES 3
117
118/*
119 * As we are sharing code base with the mips32 tree (which use the o32 ABI
120 * register definitions). We need to redefine the register definitions from
121 * the n64 ABI register naming to the o32 ABI register naming.
122 */
123#undef t0
124#undef t1
125#undef t2
126#undef t3
127#define t0 $8
128#define t1 $9
129#define t2 $10
130#define t3 $11
131#define t4 $12
132#define t5 $13
133#define t6 $14
134#define t7 $15
135
136#else
137
138#define LOAD lw
139#define LOADL lwl
140#define LOADR lwr
141#define STOREL swl
142#define STORER swr
143#define STORE sw
144#define ADD addu
145#define SUB subu
146#define SRL srl
147#define SLL sll
148#define SRA sra
149#define SLLV sllv
150#define SRLV srlv
151#define NBYTES 4
152#define LOG_NBYTES 2
153
154#endif /* USE_DOUBLE */
155
156#ifdef CONFIG_CPU_LITTLE_ENDIAN
157#define LDFIRST LOADR
158#define LDREST LOADL
159#define STFIRST STORER
160#define STREST STOREL
161#define SHIFT_DISCARD SLLV
162#else
163#define LDFIRST LOADL
164#define LDREST LOADR
165#define STFIRST STOREL
166#define STREST STORER
167#define SHIFT_DISCARD SRLV
168#endif
169
170#define FIRST(unit) ((unit)*NBYTES)
171#define REST(unit) (FIRST(unit)+NBYTES-1)
172#define UNIT(unit) FIRST(unit)
173
174#define ADDRMASK (NBYTES-1)
175
176 .text
177 .set noreorder
178 .set noat
179
180/*
181 * A combined memcpy/__copy_user
182 * __copy_user sets len to 0 for success; else to an upper bound of
183 * the number of uncopied bytes.
184 * memcpy sets v0 to dst.
185 */
186 .align 5
187LEAF(__copy_user_inatomic)
188 /*
189 * Note: dst & src may be unaligned, len may be 0
190 * Temps
191 */
192#define rem t8
193
194 /*
195 * The "issue break"s below are very approximate.
196 * Issue delays for dcache fills will perturb the schedule, as will
197 * load queue full replay traps, etc.
198 *
199 * If len < NBYTES use byte operations.
200 */
201 PREF( 0, 0(src) )
202 PREF( 1, 0(dst) )
203 sltu t2, len, NBYTES
204 and t1, dst, ADDRMASK
205 PREF( 0, 1*32(src) )
206 PREF( 1, 1*32(dst) )
207 bnez t2, copy_bytes_checklen
208 and t0, src, ADDRMASK
209 PREF( 0, 2*32(src) )
210 PREF( 1, 2*32(dst) )
211 bnez t1, dst_unaligned
212 nop
213 bnez t0, src_unaligned_dst_aligned
214 /*
215 * use delay slot for fall-through
216 * src and dst are aligned; need to compute rem
217 */
218both_aligned:
219 SRL t0, len, LOG_NBYTES+3 # +3 for 8 units/iter
220 beqz t0, cleanup_both_aligned # len < 8*NBYTES
221 and rem, len, (8*NBYTES-1) # rem = len % (8*NBYTES)
222 PREF( 0, 3*32(src) )
223 PREF( 1, 3*32(dst) )
224 .align 4
2251:
226EXC( LOAD t0, UNIT(0)(src), l_exc)
227EXC( LOAD t1, UNIT(1)(src), l_exc_copy)
228EXC( LOAD t2, UNIT(2)(src), l_exc_copy)
229EXC( LOAD t3, UNIT(3)(src), l_exc_copy)
230 SUB len, len, 8*NBYTES
231EXC( LOAD t4, UNIT(4)(src), l_exc_copy)
232EXC( LOAD t7, UNIT(5)(src), l_exc_copy)
233 STORE t0, UNIT(0)(dst)
234 STORE t1, UNIT(1)(dst)
235EXC( LOAD t0, UNIT(6)(src), l_exc_copy)
236EXC( LOAD t1, UNIT(7)(src), l_exc_copy)
237 ADD src, src, 8*NBYTES
238 ADD dst, dst, 8*NBYTES
239 STORE t2, UNIT(-6)(dst)
240 STORE t3, UNIT(-5)(dst)
241 STORE t4, UNIT(-4)(dst)
242 STORE t7, UNIT(-3)(dst)
243 STORE t0, UNIT(-2)(dst)
244 STORE t1, UNIT(-1)(dst)
245 PREF( 0, 8*32(src) )
246 PREF( 1, 8*32(dst) )
247 bne len, rem, 1b
248 nop
249
250 /*
251 * len == rem == the number of bytes left to copy < 8*NBYTES
252 */
253cleanup_both_aligned:
254 beqz len, done
255 sltu t0, len, 4*NBYTES
256 bnez t0, less_than_4units
257 and rem, len, (NBYTES-1) # rem = len % NBYTES
258 /*
259 * len >= 4*NBYTES
260 */
261EXC( LOAD t0, UNIT(0)(src), l_exc)
262EXC( LOAD t1, UNIT(1)(src), l_exc_copy)
263EXC( LOAD t2, UNIT(2)(src), l_exc_copy)
264EXC( LOAD t3, UNIT(3)(src), l_exc_copy)
265 SUB len, len, 4*NBYTES
266 ADD src, src, 4*NBYTES
267 STORE t0, UNIT(0)(dst)
268 STORE t1, UNIT(1)(dst)
269 STORE t2, UNIT(2)(dst)
270 STORE t3, UNIT(3)(dst)
271 beqz len, done
272 ADD dst, dst, 4*NBYTES
273less_than_4units:
274 /*
275 * rem = len % NBYTES
276 */
277 beq rem, len, copy_bytes
278 nop
2791:
280EXC( LOAD t0, 0(src), l_exc)
281 ADD src, src, NBYTES
282 SUB len, len, NBYTES
283 STORE t0, 0(dst)
284 bne rem, len, 1b
285 ADD dst, dst, NBYTES
286
287 /*
288 * src and dst are aligned, need to copy rem bytes (rem < NBYTES)
289 * A loop would do only a byte at a time with possible branch
290 * mispredicts. Can't do an explicit LOAD dst,mask,or,STORE
291 * because can't assume read-access to dst. Instead, use
292 * STREST dst, which doesn't require read access to dst.
293 *
294 * This code should perform better than a simple loop on modern,
295 * wide-issue mips processors because the code has fewer branches and
296 * more instruction-level parallelism.
297 */
298#define bits t2
299 beqz len, done
300 ADD t1, dst, len # t1 is just past last byte of dst
301 li bits, 8*NBYTES
302 SLL rem, len, 3 # rem = number of bits to keep
303EXC( LOAD t0, 0(src), l_exc)
304 SUB bits, bits, rem # bits = number of bits to discard
305 SHIFT_DISCARD t0, t0, bits
306 STREST t0, -1(t1)
307 jr ra
308 move len, zero
309dst_unaligned:
310 /*
311 * dst is unaligned
312 * t0 = src & ADDRMASK
313 * t1 = dst & ADDRMASK; T1 > 0
314 * len >= NBYTES
315 *
316 * Copy enough bytes to align dst
317 * Set match = (src and dst have same alignment)
318 */
319#define match rem
320EXC( LDFIRST t3, FIRST(0)(src), l_exc)
321 ADD t2, zero, NBYTES
322EXC( LDREST t3, REST(0)(src), l_exc_copy)
323 SUB t2, t2, t1 # t2 = number of bytes copied
324 xor match, t0, t1
325 STFIRST t3, FIRST(0)(dst)
326 beq len, t2, done
327 SUB len, len, t2
328 ADD dst, dst, t2
329 beqz match, both_aligned
330 ADD src, src, t2
331
332src_unaligned_dst_aligned:
333 SRL t0, len, LOG_NBYTES+2 # +2 for 4 units/iter
334 PREF( 0, 3*32(src) )
335 beqz t0, cleanup_src_unaligned
336 and rem, len, (4*NBYTES-1) # rem = len % 4*NBYTES
337 PREF( 1, 3*32(dst) )
3381:
339/*
340 * Avoid consecutive LD*'s to the same register since some mips
341 * implementations can't issue them in the same cycle.
342 * It's OK to load FIRST(N+1) before REST(N) because the two addresses
343 * are to the same unit (unless src is aligned, but it's not).
344 */
345EXC( LDFIRST t0, FIRST(0)(src), l_exc)
346EXC( LDFIRST t1, FIRST(1)(src), l_exc_copy)
347 SUB len, len, 4*NBYTES
348EXC( LDREST t0, REST(0)(src), l_exc_copy)
349EXC( LDREST t1, REST(1)(src), l_exc_copy)
350EXC( LDFIRST t2, FIRST(2)(src), l_exc_copy)
351EXC( LDFIRST t3, FIRST(3)(src), l_exc_copy)
352EXC( LDREST t2, REST(2)(src), l_exc_copy)
353EXC( LDREST t3, REST(3)(src), l_exc_copy)
354 PREF( 0, 9*32(src) ) # 0 is PREF_LOAD (not streamed)
355 ADD src, src, 4*NBYTES
356#ifdef CONFIG_CPU_SB1
357 nop # improves slotting
358#endif
359 STORE t0, UNIT(0)(dst)
360 STORE t1, UNIT(1)(dst)
361 STORE t2, UNIT(2)(dst)
362 STORE t3, UNIT(3)(dst)
363 PREF( 1, 9*32(dst) ) # 1 is PREF_STORE (not streamed)
364 bne len, rem, 1b
365 ADD dst, dst, 4*NBYTES
366
367cleanup_src_unaligned:
368 beqz len, done
369 and rem, len, NBYTES-1 # rem = len % NBYTES
370 beq rem, len, copy_bytes
371 nop
3721:
373EXC( LDFIRST t0, FIRST(0)(src), l_exc)
374EXC( LDREST t0, REST(0)(src), l_exc_copy)
375 ADD src, src, NBYTES
376 SUB len, len, NBYTES
377 STORE t0, 0(dst)
378 bne len, rem, 1b
379 ADD dst, dst, NBYTES
380
381copy_bytes_checklen:
382 beqz len, done
383 nop
384copy_bytes:
385 /* 0 < len < NBYTES */
386#define COPY_BYTE(N) \
387EXC( lb t0, N(src), l_exc); \
388 SUB len, len, 1; \
389 beqz len, done; \
390 sb t0, N(dst)
391
392 COPY_BYTE(0)
393 COPY_BYTE(1)
394#ifdef USE_DOUBLE
395 COPY_BYTE(2)
396 COPY_BYTE(3)
397 COPY_BYTE(4)
398 COPY_BYTE(5)
399#endif
400EXC( lb t0, NBYTES-2(src), l_exc)
401 SUB len, len, 1
402 jr ra
403 sb t0, NBYTES-2(dst)
404done:
405 jr ra
406 nop
407 END(__copy_user_inatomic)
408
409l_exc_copy:
410 /*
411 * Copy bytes from src until faulting load address (or until a
412 * lb faults)
413 *
414 * When reached by a faulting LDFIRST/LDREST, THREAD_BUADDR($28)
415 * may be more than a byte beyond the last address.
416 * Hence, the lb below may get an exception.
417 *
418 * Assumes src < THREAD_BUADDR($28)
419 */
420 LOAD t0, TI_TASK($28)
421 nop
422 LOAD t0, THREAD_BUADDR(t0)
4231:
424EXC( lb t1, 0(src), l_exc)
425 ADD src, src, 1
426 sb t1, 0(dst) # can't fault -- we're copy_from_user
427 bne src, t0, 1b
428 ADD dst, dst, 1
429l_exc:
430 LOAD t0, TI_TASK($28)
431 nop
432 LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address
433 nop
434 SUB len, AT, t0 # len number of uncopied bytes
435 jr ra
436 nop
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 13a420844436..f08ae71c46ff 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -61,8 +61,6 @@
61 61
62DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 62DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
63 63
64unsigned long highstart_pfn, highend_pfn;
65
66/* 64/*
67 * We have up to 8 empty zeroed pages so we can map one of the right colour 65 * We have up to 8 empty zeroed pages so we can map one of the right colour
68 * when needed. This is necessary only on R4000 / R4400 SC and MC versions 66 * when needed. This is necessary only on R4000 / R4400 SC and MC versions
@@ -261,6 +259,8 @@ EXPORT_SYMBOL(copy_from_user_page);
261 259
262 260
263#ifdef CONFIG_HIGHMEM 261#ifdef CONFIG_HIGHMEM
262unsigned long highstart_pfn, highend_pfn;
263
264pte_t *kmap_pte; 264pte_t *kmap_pte;
265pgprot_t kmap_prot; 265pgprot_t kmap_prot;
266 266
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index 3c175a7e4345..972947474eb7 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -42,6 +42,7 @@ struct sigcontext {
42 42
43#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 43#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
44 44
45#include <linux/posix_types.h>
45/* 46/*
46 * Keep this struct definition in sync with the sigcontext fragment 47 * Keep this struct definition in sync with the sigcontext fragment
47 * in arch/mips/tools/offset.c 48 * in arch/mips/tools/offset.c
@@ -53,27 +54,25 @@ struct sigcontext {
53 * entries, add sc_dsp and sc_reserved for padding. No prisoners. 54 * entries, add sc_dsp and sc_reserved for padding. No prisoners.
54 */ 55 */
55struct sigcontext { 56struct sigcontext {
56 unsigned long sc_regs[32]; 57 __u64 sc_regs[32];
57 unsigned long sc_fpregs[32]; 58 __u64 sc_fpregs[32];
58 unsigned long sc_mdhi; 59 __u64 sc_mdhi;
59 unsigned long sc_hi1; 60 __u64 sc_hi1;
60 unsigned long sc_hi2; 61 __u64 sc_hi2;
61 unsigned long sc_hi3; 62 __u64 sc_hi3;
62 unsigned long sc_mdlo; 63 __u64 sc_mdlo;
63 unsigned long sc_lo1; 64 __u64 sc_lo1;
64 unsigned long sc_lo2; 65 __u64 sc_lo2;
65 unsigned long sc_lo3; 66 __u64 sc_lo3;
66 unsigned long sc_pc; 67 __u64 sc_pc;
67 unsigned int sc_fpc_csr; 68 __u32 sc_fpc_csr;
68 unsigned int sc_used_math; 69 __u32 sc_used_math;
69 unsigned int sc_dsp; 70 __u32 sc_dsp;
70 unsigned int sc_reserved; 71 __u32 sc_reserved;
71}; 72};
72 73
73#ifdef __KERNEL__ 74#ifdef __KERNEL__
74 75
75#include <linux/posix_types.h>
76
77struct sigcontext32 { 76struct sigcontext32 {
78 __u32 sc_regmask; /* Unused */ 77 __u32 sc_regmask; /* Unused */
79 __u32 sc_status; /* Unused */ 78 __u32 sc_status; /* Unused */
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 3eff8d8fe28a..c62c20e7b5c6 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -435,8 +435,32 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
435 __cu_len; \ 435 __cu_len; \
436}) 436})
437 437
438#define __copy_to_user_inatomic __copy_to_user 438#define __copy_to_user_inatomic(to,from,n) \
439#define __copy_from_user_inatomic __copy_from_user 439({ \
440 void __user *__cu_to; \
441 const void *__cu_from; \
442 long __cu_len; \
443 \
444 __cu_to = (to); \
445 __cu_from = (from); \
446 __cu_len = (n); \
447 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
448 __cu_len; \
449})
450
451#define __copy_from_user_inatomic(to,from,n) \
452({ \
453 void *__cu_to; \
454 const void __user *__cu_from; \
455 long __cu_len; \
456 \
457 __cu_to = (to); \
458 __cu_from = (from); \
459 __cu_len = (n); \
460 __cu_len = __invoke_copy_from_user_inatomic(__cu_to, __cu_from, \
461 __cu_len); \
462 __cu_len; \
463})
440 464
441/* 465/*
442 * copy_to_user: - Copy a block of data into user space. 466 * copy_to_user: - Copy a block of data into user space.
@@ -490,6 +514,29 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
490 __cu_len_r; \ 514 __cu_len_r; \
491}) 515})
492 516
517#define __invoke_copy_from_user_inatomic(to,from,n) \
518({ \
519 register void *__cu_to_r __asm__ ("$4"); \
520 register const void __user *__cu_from_r __asm__ ("$5"); \
521 register long __cu_len_r __asm__ ("$6"); \
522 \
523 __cu_to_r = (to); \
524 __cu_from_r = (from); \
525 __cu_len_r = (n); \
526 __asm__ __volatile__( \
527 ".set\tnoreorder\n\t" \
528 __MODULE_JAL(__copy_user_inatomic) \
529 ".set\tnoat\n\t" \
530 __UA_ADDU "\t$1, %1, %2\n\t" \
531 ".set\tat\n\t" \
532 ".set\treorder" \
533 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
534 : \
535 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
536 "memory"); \
537 __cu_len_r; \
538})
539
493/* 540/*
494 * __copy_from_user: - Copy a block of data from user space, with less checking. 541 * __copy_from_user: - Copy a block of data from user space, with less checking.
495 * @to: Destination address, in kernel space. 542 * @to: Destination address, in kernel space.