aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
commitb0138a6cb7923a997d278b47c176778534d1095b (patch)
tree4fcb8822a69631baba568e4e1942847747123887 /arch
parent6572d6d7d0f965dda19d02af804ed3ae4b3bf1fc (diff)
parent1055a8af093fea7490445bd15cd671020e542035 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits) [PARISC] Use symbolic last syscall in __NR_Linux_syscalls [PARISC] Add missing statfs64 and fstatfs64 syscalls Revert "[PARISC] Optimize TLB flush on SMP systems" [PARISC] Compat signal fixes for 64-bit parisc [PARISC] Reorder syscalls to match unistd.h Revert "[PATCH] make kernel/signal.c:kill_proc_info() static" [PARISC] fix sys_rt_sigqueueinfo [PARISC] fix section mismatch warnings in harmony sound driver [PARISC] do not export get_register/set_register [PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code [PARISC] convert to use CONFIG_64BIT instead of __LP64__ [PARISC] use CONFIG_64BIT instead of __LP64__ [PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro [PARISC] more ENTRY(), ENDPROC(), END() conversions [PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc [PARISC] Fixes /proc/cpuinfo cache output on B160L [PARISC] implement standard ENTRY(), END() and ENDPROC() [PARISC] kill ENTRY_SYS_CPUS [PARISC] clean up debugging printks in smp.c [PARISC] factor syscall_restart code out of do_signal ... Fix conflict in include/linux/sched.h due to kill_proc_info() being made publicly available to PARISC again.
Diffstat (limited to 'arch')
-rw-r--r--arch/parisc/Kconfig9
-rw-r--r--arch/parisc/Makefile8
-rw-r--r--arch/parisc/hpux/entry_hpux.S10
-rw-r--r--arch/parisc/hpux/fs.c26
-rw-r--r--arch/parisc/hpux/gate.S23
-rw-r--r--arch/parisc/hpux/sys_hpux.c32
-rw-r--r--arch/parisc/hpux/wrappers.S45
-rw-r--r--arch/parisc/kernel/asm-offsets.c2
-rw-r--r--arch/parisc/kernel/cache.c188
-rw-r--r--arch/parisc/kernel/drivers.c19
-rw-r--r--arch/parisc/kernel/entry.S241
-rw-r--r--arch/parisc/kernel/firmware.c26
-rw-r--r--arch/parisc/kernel/head.S15
-rw-r--r--arch/parisc/kernel/hpmc.S16
-rw-r--r--arch/parisc/kernel/inventory.c10
-rw-r--r--arch/parisc/kernel/irq.c6
-rw-r--r--arch/parisc/kernel/module.c23
-rw-r--r--arch/parisc/kernel/pacache.S89
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c10
-rw-r--r--arch/parisc/kernel/pci-dma.c2
-rw-r--r--arch/parisc/kernel/pci.c4
-rw-r--r--arch/parisc/kernel/perf_asm.S26
-rw-r--r--arch/parisc/kernel/process.c8
-rw-r--r--arch/parisc/kernel/processor.c11
-rw-r--r--arch/parisc/kernel/ptrace.c10
-rw-r--r--arch/parisc/kernel/real2.S16
-rw-r--r--arch/parisc/kernel/setup.c6
-rw-r--r--arch/parisc/kernel/signal.c273
-rw-r--r--arch/parisc/kernel/signal32.c42
-rw-r--r--arch/parisc/kernel/smp.c178
-rw-r--r--arch/parisc/kernel/syscall.S71
-rw-r--r--arch/parisc/kernel/syscall_table.S16
-rw-r--r--arch/parisc/kernel/time.c146
-rw-r--r--arch/parisc/kernel/traps.c153
-rw-r--r--arch/parisc/kernel/unaligned.c115
-rw-r--r--arch/parisc/kernel/unwind.c1
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S2
-rw-r--r--arch/parisc/lib/bitops.c4
-rw-r--r--arch/parisc/lib/fixup.S20
-rw-r--r--arch/parisc/lib/lusercopy.S37
-rw-r--r--arch/parisc/lib/memcpy.c38
-rw-r--r--arch/parisc/mm/fault.c4
-rw-r--r--arch/parisc/mm/init.c72
-rw-r--r--arch/parisc/mm/ioremap.c6
-rw-r--r--arch/parisc/mm/kmap.c166
-rw-r--r--arch/parisc/oprofile/init.c2
46 files changed, 957 insertions, 1270 deletions
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 28da4e71c443..3d73545e8c48 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -37,6 +37,11 @@ config GENERIC_FIND_NEXT_BIT
37 bool 37 bool
38 default y 38 default y
39 39
40config GENERIC_BUG
41 bool
42 default y
43 depends on BUG
44
40config GENERIC_HWEIGHT 45config GENERIC_HWEIGHT
41 bool 46 bool
42 default y 47 default y
@@ -45,6 +50,10 @@ config GENERIC_CALIBRATE_DELAY
45 bool 50 bool
46 default y 51 default y
47 52
53config GENERIC_TIME
54 bool
55 default y
56
48config TIME_LOW_RES 57config TIME_LOW_RES
49 bool 58 bool
50 depends on SMP 59 depends on SMP
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 9b7e42490dd1..760567a9ba16 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -35,12 +35,8 @@ FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
35 35
36OBJCOPY_FLAGS =-O binary -R .note -R .comment -S 36OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
37 37
38GCC_VERSION := $(call cc-version) 38ifneq ($(call cc-ifversion, -lt, 0303, "bad"),)
39ifneq ($(shell if [ -z $(GCC_VERSION) ] ; then echo "bad"; fi ;),) 39$(error Sorry, GCC v3.3 or above is required.)
40$(error Sorry, couldn't find ($(cc-version)).)
41endif
42ifneq ($(shell if [ $(GCC_VERSION) -lt 0303 ] ; then echo "bad"; fi ;),)
43$(error Sorry, your compiler is too old ($(GCC_VERSION)). GCC v3.3 or above is required.)
44endif 40endif
45 41
46cflags-y := -pipe 42cflags-y := -pipe
diff --git a/arch/parisc/hpux/entry_hpux.S b/arch/parisc/hpux/entry_hpux.S
index 31c8cccfba31..d15a413572f0 100644
--- a/arch/parisc/hpux/entry_hpux.S
+++ b/arch/parisc/hpux/entry_hpux.S
@@ -18,17 +18,16 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <asm/unistd.h>
22#include <asm/assembly.h>
21#include <linux/sys.h> 23#include <linux/sys.h>
22#include <linux/linkage.h> 24#include <linux/linkage.h>
23#include <asm/unistd.h>
24 25
25#define ENTRY_NAME(_name_) .word _name_ 26#define ENTRY_NAME(_name_) ASM_ULONG_INSN _name_
26 27
27 .section .rodata,"a" 28 .section .rodata,"a"
28 .align 4
29 .export hpux_call_table
30 .import hpux_unimplemented_wrapper 29 .import hpux_unimplemented_wrapper
31hpux_call_table: 30ENTRY(hpux_call_table)
32 ENTRY_NAME(sys_ni_syscall) /* 0 */ 31 ENTRY_NAME(sys_ni_syscall) /* 0 */
33 ENTRY_NAME(sys_exit) 32 ENTRY_NAME(sys_exit)
34 ENTRY_NAME(hpux_fork_wrapper) 33 ENTRY_NAME(hpux_fork_wrapper)
@@ -542,5 +541,6 @@ hpux_call_table:
542 ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */ 541 ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */
543 ENTRY_NAME(hpux_unimplemented_wrapper) 542 ENTRY_NAME(hpux_unimplemented_wrapper)
544 ENTRY_NAME(hpux_unimplemented_wrapper) 543 ENTRY_NAME(hpux_unimplemented_wrapper)
544END(hpux_call_table)
545.end 545.end
546 546
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 4204cd1f3cf9..c7a81a2c014c 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -35,13 +35,13 @@ int hpux_execve(struct pt_regs *regs)
35 int error; 35 int error;
36 char *filename; 36 char *filename;
37 37
38 filename = getname((char *) regs->gr[26]); 38 filename = getname((char __user *) regs->gr[26]);
39 error = PTR_ERR(filename); 39 error = PTR_ERR(filename);
40 if (IS_ERR(filename)) 40 if (IS_ERR(filename))
41 goto out; 41 goto out;
42 42
43 error = do_execve(filename, (char **) regs->gr[25], 43 error = do_execve(filename, (char __user * __user *) regs->gr[25],
44 (char **)regs->gr[24], regs); 44 (char __user * __user *) regs->gr[24], regs);
45 45
46 if (error == 0) { 46 if (error == 0) {
47 task_lock(current); 47 task_lock(current);
@@ -63,19 +63,19 @@ struct hpux_dirent {
63}; 63};
64 64
65struct getdents_callback { 65struct getdents_callback {
66 struct hpux_dirent *current_dir; 66 struct hpux_dirent __user *current_dir;
67 struct hpux_dirent *previous; 67 struct hpux_dirent __user *previous;
68 int count; 68 int count;
69 int error; 69 int error;
70}; 70};
71 71
72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) 72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
73#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) 73#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
74 74
75static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 75static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
76 u64 ino, unsigned d_type) 76 u64 ino, unsigned d_type)
77{ 77{
78 struct hpux_dirent * dirent; 78 struct hpux_dirent __user * dirent;
79 struct getdents_callback * buf = (struct getdents_callback *) __buf; 79 struct getdents_callback * buf = (struct getdents_callback *) __buf;
80 ino_t d_ino; 80 ino_t d_ino;
81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
@@ -105,10 +105,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
105#undef NAME_OFFSET 105#undef NAME_OFFSET
106#undef ROUND_UP 106#undef ROUND_UP
107 107
108int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count) 108int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
109{ 109{
110 struct file * file; 110 struct file * file;
111 struct hpux_dirent * lastdirent; 111 struct hpux_dirent __user * lastdirent;
112 struct getdents_callback buf; 112 struct getdents_callback buf;
113 int error = -EBADF; 113 int error = -EBADF;
114 114
@@ -143,7 +143,7 @@ int hpux_mount(const char *fs, const char *path, int mflag,
143 return -ENOSYS; 143 return -ENOSYS;
144} 144}
145 145
146static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf) 146static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
147{ 147{
148 struct hpux_stat64 tmp; 148 struct hpux_stat64 tmp;
149 149
@@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 169 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
170} 170}
171 171
172long hpux_stat64(char *filename, struct hpux_stat64 *statbuf) 172long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf)
173{ 173{
174 struct kstat stat; 174 struct kstat stat;
175 int error = vfs_stat(filename, &stat); 175 int error = vfs_stat(filename, &stat);
@@ -180,7 +180,7 @@ long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
180 return error; 180 return error;
181} 181}
182 182
183long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf) 183long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
184{ 184{
185 struct kstat stat; 185 struct kstat stat;
186 int error = vfs_fstat(fd, &stat); 186 int error = vfs_fstat(fd, &stat);
@@ -191,7 +191,7 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
191 return error; 191 return error;
192} 192}
193 193
194long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf) 194long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf)
195{ 195{
196 struct kstat stat; 196 struct kstat stat;
197 int error = vfs_lstat(filename, &stat); 197 int error = vfs_lstat(filename, &stat);
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S
index aaaf3306c05a..0b9d5b1e4b37 100644
--- a/arch/parisc/hpux/gate.S
+++ b/arch/parisc/hpux/gate.S
@@ -12,27 +12,18 @@
12#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/unistd.h> 13#include <asm/unistd.h>
14#include <asm/errno.h> 14#include <asm/errno.h>
15#include <linux/linkage.h>
15 16
16#ifdef __LP64__ 17 .level LEVEL
17 .level 2.0w
18#else
19 .level 1.1
20#endif
21 .text 18 .text
22 19
23#ifdef __LP64__
24#define FRAME_SIZE 128
25#else
26#define FRAME_SIZE 64
27#endif
28 .import hpux_call_table 20 .import hpux_call_table
29 .import hpux_syscall_exit,code 21 .import hpux_syscall_exit,code
30 .export hpux_gateway_page
31 22
32 .align 4096 23 .align 4096
33hpux_gateway_page: 24ENTRY(hpux_gateway_page)
34 nop 25 nop
35#ifdef __LP64__ 26#ifdef CONFIG_64BIT
36#warning NEEDS WORK for 64-bit 27#warning NEEDS WORK for 64-bit
37#endif 28#endif
38 ldw -64(%r30), %r29 ;! 8th argument 29 ldw -64(%r30), %r29 ;! 8th argument
@@ -101,7 +92,7 @@ hpux_gateway_page:
101 ldo R%hpux_call_table(%r21), %r21 92 ldo R%hpux_call_table(%r21), %r21
102 comiclr,>>= __NR_HPUX_syscalls, %r22, %r0 93 comiclr,>>= __NR_HPUX_syscalls, %r22, %r0
103 b,n syscall_nosys 94 b,n syscall_nosys
104 ldwx,s %r22(%r21), %r21 95 LDREGX %r22(%r21), %r21
105 ldil L%hpux_syscall_exit,%r2 96 ldil L%hpux_syscall_exit,%r2
106 be 0(%sr7,%r21) 97 be 0(%sr7,%r21)
107 ldo R%hpux_syscall_exit(%r2),%r2 98 ldo R%hpux_syscall_exit(%r2),%r2
@@ -110,7 +101,7 @@ syscall_nosys:
110 ldil L%hpux_syscall_exit,%r1 101 ldil L%hpux_syscall_exit,%r1
111 be R%hpux_syscall_exit(%sr7,%r1) 102 be R%hpux_syscall_exit(%sr7,%r1)
112 ldo -ENOSYS(%r0),%r28 103 ldo -ENOSYS(%r0),%r28
104ENDPROC(hpux_gateway_page)
113 105
114 .align 4096 106 .align 4096
115 .export end_hpux_gateway_page 107ENTRY(end_hpux_gateway_page)
116end_hpux_gateway_page:
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 04c2ff444396..3e025df2dc86 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -61,7 +61,7 @@ int hpux_ptrace(void)
61 return -ENOSYS; 61 return -ENOSYS;
62} 62}
63 63
64int hpux_wait(int *stat_loc) 64int hpux_wait(int __user *stat_loc)
65{ 65{
66 return sys_waitpid(-1, stat_loc, 0); 66 return sys_waitpid(-1, stat_loc, 0);
67} 67}
@@ -255,7 +255,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
255/* TODO: Are these put_user calls OK? Should they pass an int? 255/* TODO: Are these put_user calls OK? Should they pass an int?
256 * (I copied it from sys_i386.c like this.) 256 * (I copied it from sys_i386.c like this.)
257 */ 257 */
258static int hpux_uname(struct hpux_utsname *name) 258static int hpux_uname(struct hpux_utsname __user *name)
259{ 259{
260 int error; 260 int error;
261 261
@@ -300,14 +300,14 @@ static int hpux_uname(struct hpux_utsname *name)
300/* Note: HP-UX just uses the old suser() function to check perms 300/* Note: HP-UX just uses the old suser() function to check perms
301 * in this system call. We'll use capable(CAP_SYS_ADMIN). 301 * in this system call. We'll use capable(CAP_SYS_ADMIN).
302 */ 302 */
303int hpux_utssys(char *ubuf, int n, int type) 303int hpux_utssys(char __user *ubuf, int n, int type)
304{ 304{
305 int len; 305 int len;
306 int error; 306 int error;
307 switch( type ) { 307 switch( type ) {
308 case 0: 308 case 0:
309 /* uname(): */ 309 /* uname(): */
310 return( hpux_uname( (struct hpux_utsname *)ubuf ) ); 310 return hpux_uname((struct hpux_utsname __user *)ubuf);
311 break ; 311 break ;
312 case 1: 312 case 1:
313 /* Obsolete (used to be umask().) */ 313 /* Obsolete (used to be umask().) */
@@ -315,8 +315,9 @@ int hpux_utssys(char *ubuf, int n, int type)
315 break ; 315 break ;
316 case 2: 316 case 2:
317 /* ustat(): */ 317 /* ustat(): */
318 return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) ); 318 return hpux_ustat(new_decode_dev(n),
319 break ; 319 (struct hpux_ustat __user *)ubuf);
320 break;
320 case 3: 321 case 3:
321 /* setuname(): 322 /* setuname():
322 * 323 *
@@ -332,7 +333,7 @@ int hpux_utssys(char *ubuf, int n, int type)
332 return -EINVAL ; 333 return -EINVAL ;
333 /* Unlike Linux, HP-UX truncates it if n is too big: */ 334 /* Unlike Linux, HP-UX truncates it if n is too big: */
334 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 335 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
335 return( sys_sethostname(ubuf, len) ); 336 return sys_sethostname(ubuf, len);
336 break ; 337 break ;
337 case 4: 338 case 4:
338 /* sethostname(): 339 /* sethostname():
@@ -346,7 +347,7 @@ int hpux_utssys(char *ubuf, int n, int type)
346 return -EINVAL ; 347 return -EINVAL ;
347 /* Unlike Linux, HP-UX truncates it if n is too big: */ 348 /* Unlike Linux, HP-UX truncates it if n is too big: */
348 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; 349 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
349 return( sys_sethostname(ubuf, len) ); 350 return sys_sethostname(ubuf, len);
350 break ; 351 break ;
351 case 5: 352 case 5:
352 /* gethostname(): 353 /* gethostname():
@@ -356,7 +357,7 @@ int hpux_utssys(char *ubuf, int n, int type)
356 /* Unlike Linux, HP-UX returns an error if n==0: */ 357 /* Unlike Linux, HP-UX returns an error if n==0: */
357 if ( n <= 0 ) 358 if ( n <= 0 )
358 return -EINVAL ; 359 return -EINVAL ;
359 return( sys_gethostname(ubuf, n) ); 360 return sys_gethostname(ubuf, n);
360 break ; 361 break ;
361 case 6: 362 case 6:
362 /* Supposedly called from setuname() in libc. 363 /* Supposedly called from setuname() in libc.
@@ -420,7 +421,7 @@ int hpux_utssys(char *ubuf, int n, int type)
420 } 421 }
421} 422}
422 423
423int hpux_getdomainname(char *name, int len) 424int hpux_getdomainname(char __user *name, int len)
424{ 425{
425 int nlen; 426 int nlen;
426 int err = -EFAULT; 427 int err = -EFAULT;
@@ -471,17 +472,18 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
471 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1); 472 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1);
472 473
473 if ( opcode == 1 ) { /* GETFSIND */ 474 if ( opcode == 1 ) { /* GETFSIND */
474 len = strlen_user((char *)arg1); 475 char __user *user_fsname = (char __user *)arg1;
476 len = strlen_user(user_fsname);
475 printk(KERN_DEBUG "len of arg1 = %d\n", len); 477 printk(KERN_DEBUG "len of arg1 = %d\n", len);
476 if (len == 0) 478 if (len == 0)
477 return 0; 479 return 0;
478 fsname = kmalloc(len, GFP_KERNEL); 480 fsname = kmalloc(len, GFP_KERNEL);
479 if ( !fsname ) { 481 if (!fsname) {
480 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 482 printk(KERN_DEBUG "failed to kmalloc fsname\n");
481 return 0; 483 return 0;
482 } 484 }
483 485
484 if ( copy_from_user(fsname, (char *)arg1, len) ) { 486 if (copy_from_user(fsname, user_fsname, len)) {
485 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 487 printk(KERN_DEBUG "failed to copy_from_user fsname\n");
486 kfree(fsname); 488 kfree(fsname);
487 return 0; 489 return 0;
@@ -495,7 +497,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
495 fstype = 0; 497 fstype = 0;
496 } else { 498 } else {
497 fstype = 0; 499 fstype = 0;
498 }; 500 }
499 501
500 kfree(fsname); 502 kfree(fsname);
501 503
@@ -509,7 +511,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
509 511
510 512
511/* Table of syscall names and handle for unimplemented routines */ 513/* Table of syscall names and handle for unimplemented routines */
512static const char *syscall_names[] = { 514static const char * const syscall_names[] = {
513 "nosys", /* 0 */ 515 "nosys", /* 0 */
514 "exit", 516 "exit",
515 "fork", 517 "fork",
diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S
index 0b0c3a66b1be..58c53c879c02 100644
--- a/arch/parisc/hpux/wrappers.S
+++ b/arch/parisc/hpux/wrappers.S
@@ -20,19 +20,16 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#ifdef __LP64__ 23#ifdef CONFIG_64BIT
24#warning PA64 support needs more work...did first cut 24#warning PA64 support needs more work...did first cut
25#endif 25#endif
26 26
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/assembly.h> 28#include <asm/assembly.h>
29#include <asm/signal.h> 29#include <asm/signal.h>
30#include <linux/linkage.h>
30 31
31#ifdef __LP64__ 32 .level LEVEL
32 .level 2.0w
33#else
34 .level 1.1
35#endif
36 .text 33 .text
37 34
38 /* These should probably go in a header file somewhere. 35 /* These should probably go in a header file somewhere.
@@ -41,7 +38,7 @@
41 * register save/restore macros. 38 * register save/restore macros.
42 */ 39 */
43 .macro reg_save regs 40 .macro reg_save regs
44#ifdef __LP64__ 41#ifdef CONFIG_64BIT
45#warning NEEDS WORK for 64-bit 42#warning NEEDS WORK for 64-bit
46#endif 43#endif
47 STREG %r3, PT_GR3(\regs) 44 STREG %r3, PT_GR3(\regs)
@@ -82,11 +79,9 @@
82 .endm 79 .endm
83 80
84 81
85 .export hpux_fork_wrapper
86 .export hpux_child_return
87 .import sys_fork 82 .import sys_fork
88 83
89hpux_fork_wrapper: 84ENTRY(hpux_fork_wrapper)
90 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs 85 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
91 ;! pointer in task 86 ;! pointer in task
92 reg_save %r1 87 reg_save %r1
@@ -128,27 +123,26 @@ fork_return:
128fork_exit: 123fork_exit:
129 bv %r0(%r2) 124 bv %r0(%r2)
130 nop 125 nop
126ENDPROC(hpux_fork_wrapper)
131 127
132 /* Set the return value for the child */ 128 /* Set the return value for the child */
133 129
134hpux_child_return: 130ENTRY(hpux_child_return)
135#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) 131#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
136 bl schedule_tail, %r2 132 bl,n schedule_tail, %r2
137 nop
138#endif 133#endif
139 134
140 LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2 135 LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2
141 b fork_return 136 b fork_return
142 copy %r0,%r28 137 copy %r0,%r28
138ENDPROC(hpux_child_return)
143 139
144 .export hpux_execve_wrapper
145 .export hpux_execv_wrapper
146 .import hpux_execve 140 .import hpux_execve
147 141
148hpux_execv_wrapper: 142ENTRY(hpux_execv_wrapper)
149 copy %r0,%r24 /* NULL environment */ 143 copy %r0,%r24 /* NULL environment */
150 144
151hpux_execve_wrapper: 145ENTRY(hpux_execve_wrapper)
152 146
153 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs 147 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
154 148
@@ -187,13 +181,13 @@ hpux_execve_wrapper:
187exec_error: 181exec_error:
188 bv %r0(%r19) 182 bv %r0(%r19)
189 nop 183 nop
184ENDPROC(hpux_execv_wrapper)
190 185
191 .export hpux_pipe_wrapper
192 .import hpux_pipe 186 .import hpux_pipe
193 187
194 /* HP-UX expects pipefd's returned in r28 & r29 */ 188 /* HP-UX expects pipefd's returned in r28 & r29 */
195 189
196hpux_pipe_wrapper: 190ENTRY(hpux_pipe_wrapper)
197 STREG %r2,-20(%r30) 191 STREG %r2,-20(%r30)
198 ldo 64(%r30),%r30 192 ldo 64(%r30),%r30
199 bl hpux_pipe,%r2 193 bl hpux_pipe,%r2
@@ -212,12 +206,11 @@ hpux_pipe_wrapper:
212pipe_exit: 206pipe_exit:
213 bv %r0(%r2) 207 bv %r0(%r2)
214 ldo -64(%r30),%r30 208 ldo -64(%r30),%r30
209ENDPROC(hpux_pipe_wrapper)
215 210
216 .export hpux_syscall_exit
217 .import syscall_exit 211 .import syscall_exit
218 212
219hpux_syscall_exit: 213ENTRY(hpux_syscall_exit)
220
221 /* 214 /*
222 * 215 *
223 * HP-UX call return conventions: 216 * HP-UX call return conventions:
@@ -246,12 +239,12 @@ hpux_syscall_exit:
246 ldo 1(%r0),%r22 239 ldo 1(%r0),%r22
247 240
248no_error: 241no_error:
249 b syscall_exit 242 b,n syscall_exit
250 nop 243ENDPROC(hpux_syscall_exit)
251 244
252 .export hpux_unimplemented_wrapper
253 .import hpux_unimplemented 245 .import hpux_unimplemented
254 246
255hpux_unimplemented_wrapper: 247ENTRY(hpux_unimplemented_wrapper)
256 b hpux_unimplemented 248 b hpux_unimplemented
257 STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */ 249 STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */
250ENDPROC(hpux_unimplemented_wrapper)
diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c
index c11a5bc7c067..54fdb959149c 100644
--- a/arch/parisc/kernel/asm-offsets.c
+++ b/arch/parisc/kernel/asm-offsets.c
@@ -44,7 +44,7 @@
44 44
45#define BLANK() asm volatile("\n->" : : ) 45#define BLANK() asm volatile("\n->" : : )
46 46
47#ifdef __LP64__ 47#ifdef CONFIG_64BIT
48#define FRAME_SIZE 128 48#define FRAME_SIZE 128
49#else 49#else
50#define FRAME_SIZE 64 50#define FRAME_SIZE 64
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 0be51e92a2fc..0dc924ccceb5 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -68,16 +68,6 @@ flush_cache_all_local(void)
68} 68}
69EXPORT_SYMBOL(flush_cache_all_local); 69EXPORT_SYMBOL(flush_cache_all_local);
70 70
71/* flushes EVERYTHING (tlb & cache) */
72
73void
74flush_all_caches(void)
75{
76 flush_cache_all();
77 flush_tlb_all();
78}
79EXPORT_SYMBOL(flush_all_caches);
80
81void 71void
82update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 72update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
83{ 73{
@@ -99,7 +89,7 @@ show_cache_info(struct seq_file *m)
99 89
100 seq_printf(m, "I-cache\t\t: %ld KB\n", 90 seq_printf(m, "I-cache\t\t: %ld KB\n",
101 cache_info.ic_size/1024 ); 91 cache_info.ic_size/1024 );
102 if (cache_info.dc_loop == 1) 92 if (cache_info.dc_loop != 1)
103 snprintf(buf, 32, "%lu-way associative", cache_info.dc_loop); 93 snprintf(buf, 32, "%lu-way associative", cache_info.dc_loop);
104 seq_printf(m, "D-cache\t\t: %ld KB (%s%s, %s)\n", 94 seq_printf(m, "D-cache\t\t: %ld KB (%s%s, %s)\n",
105 cache_info.dc_size/1024, 95 cache_info.dc_size/1024,
@@ -270,6 +260,83 @@ void disable_sr_hashing(void)
270 panic("SpaceID hashing is still on!\n"); 260 panic("SpaceID hashing is still on!\n");
271} 261}
272 262
263/* Simple function to work out if we have an existing address translation
264 * for a user space vma. */
265static inline int translation_exists(struct vm_area_struct *vma,
266 unsigned long addr, unsigned long pfn)
267{
268 pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
269 pmd_t *pmd;
270 pte_t pte;
271
272 if(pgd_none(*pgd))
273 return 0;
274
275 pmd = pmd_offset(pgd, addr);
276 if(pmd_none(*pmd) || pmd_bad(*pmd))
277 return 0;
278
279 /* We cannot take the pte lock here: flush_cache_page is usually
280 * called with pte lock already held. Whereas flush_dcache_page
281 * takes flush_dcache_mmap_lock, which is lower in the hierarchy:
282 * the vma itself is secure, but the pte might come or go racily.
283 */
284 pte = *pte_offset_map(pmd, addr);
285 /* But pte_unmap() does nothing on this architecture */
286
287 /* Filter out coincidental file entries and swap entries */
288 if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
289 return 0;
290
291 return pte_pfn(pte) == pfn;
292}
293
294/* Private function to flush a page from the cache of a non-current
295 * process. cr25 contains the Page Directory of the current user
296 * process; we're going to hijack both it and the user space %sr3 to
297 * temporarily make the non-current process current. We have to do
298 * this because cache flushing may cause a non-access tlb miss which
299 * the handlers have to fill in from the pgd of the non-current
300 * process. */
301static inline void
302flush_user_cache_page_non_current(struct vm_area_struct *vma,
303 unsigned long vmaddr)
304{
305 /* save the current process space and pgd */
306 unsigned long space = mfsp(3), pgd = mfctl(25);
307
308 /* we don't mind taking interrups since they may not
309 * do anything with user space, but we can't
310 * be preempted here */
311 preempt_disable();
312
313 /* make us current */
314 mtctl(__pa(vma->vm_mm->pgd), 25);
315 mtsp(vma->vm_mm->context, 3);
316
317 flush_user_dcache_page(vmaddr);
318 if(vma->vm_flags & VM_EXEC)
319 flush_user_icache_page(vmaddr);
320
321 /* put the old current process back */
322 mtsp(space, 3);
323 mtctl(pgd, 25);
324 preempt_enable();
325}
326
327
328static inline void
329__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
330{
331 if (likely(vma->vm_mm->context == mfsp(3))) {
332 flush_user_dcache_page(vmaddr);
333 if (vma->vm_flags & VM_EXEC)
334 flush_user_icache_page(vmaddr);
335 } else {
336 flush_user_cache_page_non_current(vma, vmaddr);
337 }
338}
339
273void flush_dcache_page(struct page *page) 340void flush_dcache_page(struct page *page)
274{ 341{
275 struct address_space *mapping = page_mapping(page); 342 struct address_space *mapping = page_mapping(page);
@@ -342,7 +409,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr)
342#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ 409#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
343int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD; 410int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD;
344 411
345void parisc_setup_cache_timing(void) 412void __init parisc_setup_cache_timing(void)
346{ 413{
347 unsigned long rangetime, alltime; 414 unsigned long rangetime, alltime;
348 unsigned long size; 415 unsigned long size;
@@ -366,6 +433,9 @@ void parisc_setup_cache_timing(void)
366 if (!parisc_cache_flush_threshold) 433 if (!parisc_cache_flush_threshold)
367 parisc_cache_flush_threshold = FLUSH_THRESHOLD; 434 parisc_cache_flush_threshold = FLUSH_THRESHOLD;
368 435
436 if (parisc_cache_flush_threshold > cache_info.dc_size)
437 parisc_cache_flush_threshold = cache_info.dc_size;
438
369 printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus()); 439 printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus());
370} 440}
371 441
@@ -410,3 +480,97 @@ void kunmap_parisc(void *addr)
410} 480}
411EXPORT_SYMBOL(kunmap_parisc); 481EXPORT_SYMBOL(kunmap_parisc);
412#endif 482#endif
483
484void __flush_tlb_range(unsigned long sid, unsigned long start,
485 unsigned long end)
486{
487 unsigned long npages;
488
489 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
490 if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
491 flush_tlb_all();
492 else {
493 mtsp(sid, 1);
494 purge_tlb_start();
495 if (split_tlb) {
496 while (npages--) {
497 pdtlb(start);
498 pitlb(start);
499 start += PAGE_SIZE;
500 }
501 } else {
502 while (npages--) {
503 pdtlb(start);
504 start += PAGE_SIZE;
505 }
506 }
507 purge_tlb_end();
508 }
509}
510
511static void cacheflush_h_tmp_function(void *dummy)
512{
513 flush_cache_all_local();
514}
515
516void flush_cache_all(void)
517{
518 on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1);
519}
520
521void flush_cache_mm(struct mm_struct *mm)
522{
523#ifdef CONFIG_SMP
524 flush_cache_all();
525#else
526 flush_cache_all_local();
527#endif
528}
529
530void
531flush_user_dcache_range(unsigned long start, unsigned long end)
532{
533 if ((end - start) < parisc_cache_flush_threshold)
534 flush_user_dcache_range_asm(start,end);
535 else
536 flush_data_cache();
537}
538
539void
540flush_user_icache_range(unsigned long start, unsigned long end)
541{
542 if ((end - start) < parisc_cache_flush_threshold)
543 flush_user_icache_range_asm(start,end);
544 else
545 flush_instruction_cache();
546}
547
548
549void flush_cache_range(struct vm_area_struct *vma,
550 unsigned long start, unsigned long end)
551{
552 int sr3;
553
554 if (!vma->vm_mm->context) {
555 BUG();
556 return;
557 }
558
559 sr3 = mfsp(3);
560 if (vma->vm_mm->context == sr3) {
561 flush_user_dcache_range(start,end);
562 flush_user_icache_range(start,end);
563 } else {
564 flush_cache_all();
565 }
566}
567
568void
569flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
570{
571 BUG_ON(!vma->vm_mm->context);
572
573 if (likely(translation_exists(vma, vmaddr, pfn)))
574 __flush_cache_page(vma, vmaddr);
575
576}
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index d6c486e9501c..2ca654bd6322 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -562,12 +562,23 @@ pa_dev_attr(rev, id.hversion_rev, "0x%x\n");
562pa_dev_attr_id(hversion, "0x%03x\n"); 562pa_dev_attr_id(hversion, "0x%03x\n");
563pa_dev_attr_id(sversion, "0x%05x\n"); 563pa_dev_attr_id(sversion, "0x%05x\n");
564 564
565static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
566{
567 struct parisc_device *padev = to_parisc_device(dev);
568 struct parisc_device_id *id = &padev->id;
569
570 return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
571 (u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
572 (u32)id->sversion);
573}
574
565static struct device_attribute parisc_device_attrs[] = { 575static struct device_attribute parisc_device_attrs[] = {
566 __ATTR_RO(irq), 576 __ATTR_RO(irq),
567 __ATTR_RO(hw_type), 577 __ATTR_RO(hw_type),
568 __ATTR_RO(rev), 578 __ATTR_RO(rev),
569 __ATTR_RO(hversion), 579 __ATTR_RO(hversion),
570 __ATTR_RO(sversion), 580 __ATTR_RO(sversion),
581 __ATTR_RO(modalias),
571 __ATTR_NULL, 582 __ATTR_NULL,
572}; 583};
573 584
@@ -689,7 +700,9 @@ parse_tree_node(struct device *parent, int index, struct hardware_path *modpath)
689 .fn = check_parent, 700 .fn = check_parent,
690 }; 701 };
691 702
692 device_for_each_child(parent, &recurse_data, descend_children); 703 if (device_for_each_child(parent, &recurse_data, descend_children))
704 /* nothing */;
705
693 return d.dev; 706 return d.dev;
694} 707}
695 708
@@ -835,8 +848,8 @@ static void print_parisc_device(struct parisc_device *dev)
835 static int count; 848 static int count;
836 849
837 print_pa_hwpath(dev, hw_path); 850 print_pa_hwpath(dev, hw_path);
838 printk(KERN_INFO "%d. %s at 0x%lx [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", 851 printk(KERN_INFO "%d. %s at 0x%p [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
839 ++count, dev->name, dev->hpa.start, hw_path, dev->id.hw_type, 852 ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
840 dev->id.hversion_rev, dev->id.hversion, dev->id.sversion); 853 dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
841 854
842 if (dev->num_addrs) { 855 if (dev->num_addrs) {
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 340b5e8d67ba..8474f9e5ca10 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -37,6 +37,8 @@
37#include <asm/unistd.h> 37#include <asm/unistd.h>
38#include <asm/thread_info.h> 38#include <asm/thread_info.h>
39 39
40#include <linux/linkage.h>
41
40#ifdef CONFIG_64BIT 42#ifdef CONFIG_64BIT
41#define CMPIB cmpib,* 43#define CMPIB cmpib,*
42#define CMPB cmpb,* 44#define CMPB cmpb,*
@@ -648,13 +650,11 @@
648 * the static part of the kernel address space. 650 * the static part of the kernel address space.
649 */ 651 */
650 652
651 .export fault_vector_20
652
653 .text 653 .text
654 654
655 .align 4096 655 .align 4096
656 656
657fault_vector_20: 657ENTRY(fault_vector_20)
658 /* First vector is invalid (0) */ 658 /* First vector is invalid (0) */
659 .ascii "cows can fly" 659 .ascii "cows can fly"
660 .byte 0 660 .byte 0
@@ -695,14 +695,13 @@ fault_vector_20:
695 def 29 695 def 29
696 def 30 696 def 30
697 def 31 697 def 31
698END(fault_vector_20)
698 699
699#ifndef CONFIG_64BIT 700#ifndef CONFIG_64BIT
700 701
701 .export fault_vector_11
702
703 .align 2048 702 .align 2048
704 703
705fault_vector_11: 704ENTRY(fault_vector_11)
706 /* First vector is invalid (0) */ 705 /* First vector is invalid (0) */
707 .ascii "cows can fly" 706 .ascii "cows can fly"
708 .byte 0 707 .byte 0
@@ -743,6 +742,7 @@ fault_vector_11:
743 def 29 742 def 29
744 def 30 743 def 30
745 def 31 744 def 31
745END(fault_vector_11)
746 746
747#endif 747#endif
748 748
@@ -762,9 +762,8 @@ fault_vector_11:
762#define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */ 762#define CLONE_VM 0x100 /* Must agree with <linux/sched.h> */
763#define CLONE_UNTRACED 0x00800000 763#define CLONE_UNTRACED 0x00800000
764 764
765 .export __kernel_thread, code
766 .import do_fork 765 .import do_fork
767__kernel_thread: 766ENTRY(__kernel_thread)
768 STREG %r2, -RP_OFFSET(%r30) 767 STREG %r2, -RP_OFFSET(%r30)
769 768
770 copy %r30, %r1 769 copy %r30, %r1
@@ -797,6 +796,7 @@ __kernel_thread:
797 ldo -PT_SZ_ALGN(%r30), %r30 796 ldo -PT_SZ_ALGN(%r30), %r30
798 bv %r0(%r2) 797 bv %r0(%r2)
799 nop 798 nop
799ENDPROC(__kernel_thread)
800 800
801 /* 801 /*
802 * Child Returns here 802 * Child Returns here
@@ -805,8 +805,7 @@ __kernel_thread:
805 * into task save area. 805 * into task save area.
806 */ 806 */
807 807
808 .export ret_from_kernel_thread 808ENTRY(ret_from_kernel_thread)
809ret_from_kernel_thread:
810 809
811 /* Call schedule_tail first though */ 810 /* Call schedule_tail first though */
812 BL schedule_tail, %r2 811 BL schedule_tail, %r2
@@ -833,10 +832,10 @@ ret_from_kernel_thread:
833 bv %r0(%r1) 832 bv %r0(%r1)
834#endif 833#endif
835 ldi 0, %r26 834 ldi 0, %r26
835ENDPROC(ret_from_kernel_thread)
836 836
837 .import sys_execve, code 837 .import sys_execve, code
838 .export __execve, code 838ENTRY(__execve)
839__execve:
840 copy %r2, %r15 839 copy %r2, %r15
841 copy %r30, %r16 840 copy %r30, %r16
842 ldo PT_SZ_ALGN(%r30), %r30 841 ldo PT_SZ_ALGN(%r30), %r30
@@ -856,16 +855,15 @@ __execve:
856 copy %r16, %r30 855 copy %r16, %r30
857 bv %r0(%r2) 856 bv %r0(%r2)
858 nop 857 nop
858ENDPROC(__execve)
859 859
860 .align 4
861 860
862 /* 861 /*
863 * struct task_struct *_switch_to(struct task_struct *prev, 862 * struct task_struct *_switch_to(struct task_struct *prev,
864 * struct task_struct *next) 863 * struct task_struct *next)
865 * 864 *
866 * switch kernel stacks and return prev */ 865 * switch kernel stacks and return prev */
867 .export _switch_to, code 866ENTRY(_switch_to)
868_switch_to:
869 STREG %r2, -RP_OFFSET(%r30) 867 STREG %r2, -RP_OFFSET(%r30)
870 868
871 callee_save_float 869 callee_save_float
@@ -890,6 +888,7 @@ _switch_to_ret:
890 LDREG -RP_OFFSET(%r30), %r2 888 LDREG -RP_OFFSET(%r30), %r2
891 bv %r0(%r2) 889 bv %r0(%r2)
892 copy %r26, %r28 890 copy %r26, %r28
891ENDPROC(_switch_to)
893 892
894 /* 893 /*
895 * Common rfi return path for interruptions, kernel execve, and 894 * Common rfi return path for interruptions, kernel execve, and
@@ -907,8 +906,7 @@ _switch_to_ret:
907 906
908 .align 4096 907 .align 4096
909 908
910 .export syscall_exit_rfi 909ENTRY(syscall_exit_rfi)
911syscall_exit_rfi:
912 mfctl %cr30,%r16 910 mfctl %cr30,%r16
913 LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */ 911 LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */
914 ldo TASK_REGS(%r16),%r16 912 ldo TASK_REGS(%r16),%r16
@@ -978,11 +976,36 @@ intr_check_resched:
978 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */ 976 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */
979 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */ 977 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */
980 978
979 .import do_notify_resume,code
981intr_check_sig: 980intr_check_sig:
982 /* As above */ 981 /* As above */
983 mfctl %cr30,%r1 982 mfctl %cr30,%r1
984 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_SIGPENDING */ 983 LDREG TI_FLAGS(%r1),%r19
985 bb,<,n %r19, 31-TIF_SIGPENDING, intr_do_signal /* forward */ 984 ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %r20
985 and,COND(<>) %r19, %r20, %r0
986 b,n intr_restore /* skip past if we've nothing to do */
987
988 /* This check is critical to having LWS
989 * working. The IASQ is zero on the gateway
990 * page and we cannot deliver any signals until
991 * we get off the gateway page.
992 *
993 * Only do signals if we are returning to user space
994 */
995 LDREG PT_IASQ0(%r16), %r20
996 CMPIB=,n 0,%r20,intr_restore /* backward */
997 LDREG PT_IASQ1(%r16), %r20
998 CMPIB=,n 0,%r20,intr_restore /* backward */
999
1000 copy %r0, %r25 /* long in_syscall = 0 */
1001#ifdef CONFIG_64BIT
1002 ldo -16(%r30),%r29 /* Reference param save area */
1003#endif
1004
1005 BL do_notify_resume,%r2
1006 copy %r16, %r26 /* struct pt_regs *regs */
1007
1008 b,n intr_check_sig
986 1009
987intr_restore: 1010intr_restore:
988 copy %r16,%r29 1011 copy %r16,%r29
@@ -1072,35 +1095,6 @@ intr_do_preempt:
1072 b,n intr_restore /* ssm PSW_SM_I done by intr_restore */ 1095 b,n intr_restore /* ssm PSW_SM_I done by intr_restore */
1073#endif /* CONFIG_PREEMPT */ 1096#endif /* CONFIG_PREEMPT */
1074 1097
1075 .import do_signal,code
1076intr_do_signal:
1077 /*
1078 This check is critical to having LWS
1079 working. The IASQ is zero on the gateway
1080 page and we cannot deliver any signals until
1081 we get off the gateway page.
1082
1083 Only do signals if we are returning to user space
1084 */
1085 LDREG PT_IASQ0(%r16), %r20
1086 CMPIB= 0,%r20,intr_restore /* backward */
1087 nop
1088 LDREG PT_IASQ1(%r16), %r20
1089 CMPIB= 0,%r20,intr_restore /* backward */
1090 nop
1091
1092 copy %r0, %r24 /* unsigned long in_syscall */
1093 copy %r16, %r25 /* struct pt_regs *regs */
1094#ifdef CONFIG_64BIT
1095 ldo -16(%r30),%r29 /* Reference param save area */
1096#endif
1097
1098 BL do_signal,%r2
1099 copy %r0, %r26 /* sigset_t *oldset = NULL */
1100
1101 b intr_check_sig
1102 nop
1103
1104 /* 1098 /*
1105 * External interrupts. 1099 * External interrupts.
1106 */ 1100 */
@@ -1115,11 +1109,7 @@ intr_extint:
1115 mfctl %cr31,%r1 1109 mfctl %cr31,%r1
1116 copy %r30,%r17 1110 copy %r30,%r17
1117 /* FIXME! depi below has hardcoded idea of interrupt stack size (32k)*/ 1111 /* FIXME! depi below has hardcoded idea of interrupt stack size (32k)*/
1118#ifdef CONFIG_64BIT 1112 DEPI 0,31,15,%r17
1119 depdi 0,63,15,%r17
1120#else
1121 depi 0,31,15,%r17
1122#endif
1123 CMPB=,n %r1,%r17,2f 1113 CMPB=,n %r1,%r17,2f
1124 get_stack_use_cr31 1114 get_stack_use_cr31
1125 b,n 3f 1115 b,n 3f
@@ -1148,13 +1138,12 @@ intr_extint:
1148 1138
1149 b do_cpu_irq_mask 1139 b do_cpu_irq_mask
1150 ldo R%intr_return(%r2), %r2 /* return to intr_return, not here */ 1140 ldo R%intr_return(%r2), %r2 /* return to intr_return, not here */
1141ENDPROC(syscall_exit_rfi)
1151 1142
1152 1143
1153 /* Generic interruptions (illegal insn, unaligned, page fault, etc) */ 1144 /* Generic interruptions (illegal insn, unaligned, page fault, etc) */
1154 1145
1155 .export intr_save, code /* for os_hpmc */ 1146ENTRY(intr_save) /* for os_hpmc */
1156
1157intr_save:
1158 mfsp %sr7,%r16 1147 mfsp %sr7,%r16
1159 CMPIB=,n 0,%r16,1f 1148 CMPIB=,n 0,%r16,1f
1160 get_stack_use_cr30 1149 get_stack_use_cr30
@@ -1229,6 +1218,7 @@ skip_save_ior:
1229 1218
1230 b handle_interruption 1219 b handle_interruption
1231 ldo R%intr_check_sig(%r2), %r2 1220 ldo R%intr_check_sig(%r2), %r2
1221ENDPROC(intr_save)
1232 1222
1233 1223
1234 /* 1224 /*
@@ -1814,9 +1804,7 @@ dtlb_fault:
1814 LDREG PT_GR18(\regs),%r18 1804 LDREG PT_GR18(\regs),%r18
1815 .endm 1805 .endm
1816 1806
1817 .export sys_fork_wrapper 1807ENTRY(sys_fork_wrapper)
1818 .export child_return
1819sys_fork_wrapper:
1820 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 1808 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
1821 ldo TASK_REGS(%r1),%r1 1809 ldo TASK_REGS(%r1),%r1
1822 reg_save %r1 1810 reg_save %r1
@@ -1853,9 +1841,10 @@ wrapper_exit:
1853 ldi __NR_fork,%r20 1841 ldi __NR_fork,%r20
1854 bv %r0(%r2) 1842 bv %r0(%r2)
1855 STREG %r20,PT_GR20(%r1) 1843 STREG %r20,PT_GR20(%r1)
1844ENDPROC(sys_fork_wrapper)
1856 1845
1857 /* Set the return value for the child */ 1846 /* Set the return value for the child */
1858child_return: 1847ENTRY(child_return)
1859 BL schedule_tail, %r2 1848 BL schedule_tail, %r2
1860 nop 1849 nop
1861 1850
@@ -1863,10 +1852,10 @@ child_return:
1863 LDREG TASK_PT_GR19(%r1),%r2 1852 LDREG TASK_PT_GR19(%r1),%r2
1864 b wrapper_exit 1853 b wrapper_exit
1865 copy %r0,%r28 1854 copy %r0,%r28
1855ENDPROC(child_return)
1866 1856
1867 1857
1868 .export sys_clone_wrapper 1858ENTRY(sys_clone_wrapper)
1869sys_clone_wrapper:
1870 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1859 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1871 ldo TASK_REGS(%r1),%r1 /* get pt regs */ 1860 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1872 reg_save %r1 1861 reg_save %r1
@@ -1887,9 +1876,10 @@ sys_clone_wrapper:
1887 1876
1888 b wrapper_exit 1877 b wrapper_exit
1889 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2 1878 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1879ENDPROC(sys_clone_wrapper)
1880
1890 1881
1891 .export sys_vfork_wrapper 1882ENTRY(sys_vfork_wrapper)
1892sys_vfork_wrapper:
1893 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1883 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1894 ldo TASK_REGS(%r1),%r1 /* get pt regs */ 1884 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1895 reg_save %r1 1885 reg_save %r1
@@ -1910,6 +1900,7 @@ sys_vfork_wrapper:
1910 1900
1911 b wrapper_exit 1901 b wrapper_exit
1912 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2 1902 LDREG -RP_OFFSET-FRAME_SIZE(%r30),%r2
1903ENDPROC(sys_vfork_wrapper)
1913 1904
1914 1905
1915 .macro execve_wrapper execve 1906 .macro execve_wrapper execve
@@ -1946,22 +1937,19 @@ error_\execve:
1946 nop 1937 nop
1947 .endm 1938 .endm
1948 1939
1949 .export sys_execve_wrapper
1950 .import sys_execve 1940 .import sys_execve
1951 1941ENTRY(sys_execve_wrapper)
1952sys_execve_wrapper:
1953 execve_wrapper sys_execve 1942 execve_wrapper sys_execve
1943ENDPROC(sys_execve_wrapper)
1954 1944
1955#ifdef CONFIG_64BIT 1945#ifdef CONFIG_64BIT
1956 .export sys32_execve_wrapper
1957 .import sys32_execve 1946 .import sys32_execve
1958 1947ENTRY(sys32_execve_wrapper)
1959sys32_execve_wrapper:
1960 execve_wrapper sys32_execve 1948 execve_wrapper sys32_execve
1949ENDPROC(sys32_execve_wrapper)
1961#endif 1950#endif
1962 1951
1963 .export sys_rt_sigreturn_wrapper 1952ENTRY(sys_rt_sigreturn_wrapper)
1964sys_rt_sigreturn_wrapper:
1965 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 1953 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26
1966 ldo TASK_REGS(%r26),%r26 /* get pt regs */ 1954 ldo TASK_REGS(%r26),%r26 /* get pt regs */
1967 /* Don't save regs, we are going to restore them from sigcontext. */ 1955 /* Don't save regs, we are going to restore them from sigcontext. */
@@ -1989,9 +1977,9 @@ sys_rt_sigreturn_wrapper:
1989 */ 1977 */
1990 bv %r0(%r2) 1978 bv %r0(%r2)
1991 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */ 1979 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */
1980ENDPROC(sys_rt_sigreturn_wrapper)
1992 1981
1993 .export sys_sigaltstack_wrapper 1982ENTRY(sys_sigaltstack_wrapper)
1994sys_sigaltstack_wrapper:
1995 /* Get the user stack pointer */ 1983 /* Get the user stack pointer */
1996 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 1984 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1997 ldo TASK_REGS(%r1),%r24 /* get pt regs */ 1985 ldo TASK_REGS(%r1),%r24 /* get pt regs */
@@ -1999,10 +1987,10 @@ sys_sigaltstack_wrapper:
1999 STREG %r2, -RP_OFFSET(%r30) 1987 STREG %r2, -RP_OFFSET(%r30)
2000#ifdef CONFIG_64BIT 1988#ifdef CONFIG_64BIT
2001 ldo FRAME_SIZE(%r30), %r30 1989 ldo FRAME_SIZE(%r30), %r30
2002 b,l do_sigaltstack,%r2 1990 BL do_sigaltstack,%r2
2003 ldo -16(%r30),%r29 /* Reference param save area */ 1991 ldo -16(%r30),%r29 /* Reference param save area */
2004#else 1992#else
2005 bl do_sigaltstack,%r2 1993 BL do_sigaltstack,%r2
2006 ldo FRAME_SIZE(%r30), %r30 1994 ldo FRAME_SIZE(%r30), %r30
2007#endif 1995#endif
2008 1996
@@ -2010,53 +1998,26 @@ sys_sigaltstack_wrapper:
2010 LDREG -RP_OFFSET(%r30), %r2 1998 LDREG -RP_OFFSET(%r30), %r2
2011 bv %r0(%r2) 1999 bv %r0(%r2)
2012 nop 2000 nop
2001ENDPROC(sys_sigaltstack_wrapper)
2013 2002
2014#ifdef CONFIG_64BIT 2003#ifdef CONFIG_64BIT
2015 .export sys32_sigaltstack_wrapper 2004ENTRY(sys32_sigaltstack_wrapper)
2016sys32_sigaltstack_wrapper:
2017 /* Get the user stack pointer */ 2005 /* Get the user stack pointer */
2018 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24 2006 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24
2019 LDREG TASK_PT_GR30(%r24),%r24 2007 LDREG TASK_PT_GR30(%r24),%r24
2020 STREG %r2, -RP_OFFSET(%r30) 2008 STREG %r2, -RP_OFFSET(%r30)
2021 ldo FRAME_SIZE(%r30), %r30 2009 ldo FRAME_SIZE(%r30), %r30
2022 b,l do_sigaltstack32,%r2 2010 BL do_sigaltstack32,%r2
2023 ldo -16(%r30),%r29 /* Reference param save area */ 2011 ldo -16(%r30),%r29 /* Reference param save area */
2024 2012
2025 ldo -FRAME_SIZE(%r30), %r30 2013 ldo -FRAME_SIZE(%r30), %r30
2026 LDREG -RP_OFFSET(%r30), %r2 2014 LDREG -RP_OFFSET(%r30), %r2
2027 bv %r0(%r2) 2015 bv %r0(%r2)
2028 nop 2016 nop
2017ENDPROC(sys32_sigaltstack_wrapper)
2029#endif 2018#endif
2030 2019
2031 .export sys_rt_sigsuspend_wrapper 2020ENTRY(syscall_exit)
2032sys_rt_sigsuspend_wrapper:
2033 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
2034 ldo TASK_REGS(%r1),%r24
2035 reg_save %r24
2036
2037 STREG %r2, -RP_OFFSET(%r30)
2038#ifdef CONFIG_64BIT
2039 ldo FRAME_SIZE(%r30), %r30
2040 b,l sys_rt_sigsuspend,%r2
2041 ldo -16(%r30),%r29 /* Reference param save area */
2042#else
2043 bl sys_rt_sigsuspend,%r2
2044 ldo FRAME_SIZE(%r30), %r30
2045#endif
2046
2047 ldo -FRAME_SIZE(%r30), %r30
2048 LDREG -RP_OFFSET(%r30), %r2
2049
2050 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1
2051 ldo TASK_REGS(%r1),%r1
2052 reg_restore %r1
2053
2054 bv %r0(%r2)
2055 nop
2056
2057 .export syscall_exit
2058syscall_exit:
2059
2060 /* NOTE: HP-UX syscalls also come through here 2021 /* NOTE: HP-UX syscalls also come through here
2061 * after hpux_syscall_exit fixes up return 2022 * after hpux_syscall_exit fixes up return
2062 * values. */ 2023 * values. */
@@ -2119,9 +2080,35 @@ syscall_check_resched:
2119 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */ 2080 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */
2120 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */ 2081 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */
2121 2082
2083 .import do_signal,code
2122syscall_check_sig: 2084syscall_check_sig:
2123 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* get ti flags */ 2085 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
2124 bb,<,n %r19, 31-TIF_SIGPENDING, syscall_do_signal /* forward */ 2086 ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %r26
2087 and,COND(<>) %r19, %r26, %r0
2088 b,n syscall_restore /* skip past if we've nothing to do */
2089
2090syscall_do_signal:
2091 /* Save callee-save registers (for sigcontext).
2092 * FIXME: After this point the process structure should be
2093 * consistent with all the relevant state of the process
2094 * before the syscall. We need to verify this.
2095 */
2096 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2097 ldo TASK_REGS(%r1), %r26 /* struct pt_regs *regs */
2098 reg_save %r26
2099
2100#ifdef CONFIG_64BIT
2101 ldo -16(%r30),%r29 /* Reference param save area */
2102#endif
2103
2104 BL do_notify_resume,%r2
2105 ldi 1, %r25 /* long in_syscall = 1 */
2106
2107 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2108 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */
2109 reg_restore %r20
2110
2111 b,n syscall_check_sig
2125 2112
2126syscall_restore: 2113syscall_restore:
2127 /* Are we being ptraced? */ 2114 /* Are we being ptraced? */
@@ -2259,31 +2246,10 @@ syscall_do_resched:
2259#endif 2246#endif
2260 b syscall_check_bh /* if resched, we start over again */ 2247 b syscall_check_bh /* if resched, we start over again */
2261 nop 2248 nop
2249ENDPROC(syscall_exit)
2262 2250
2263 .import do_signal,code
2264syscall_do_signal:
2265 /* Save callee-save registers (for sigcontext).
2266 FIXME: After this point the process structure should be
2267 consistent with all the relevant state of the process
2268 before the syscall. We need to verify this. */
2269 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2270 ldo TASK_REGS(%r1), %r25 /* struct pt_regs *regs */
2271 reg_save %r25
2272
2273 ldi 1, %r24 /* unsigned long in_syscall */
2274
2275#ifdef CONFIG_64BIT
2276 ldo -16(%r30),%r29 /* Reference param save area */
2277#endif
2278 BL do_signal,%r2
2279 copy %r0, %r26 /* sigset_t *oldset = NULL */
2280
2281 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2282 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */
2283 reg_restore %r20
2284
2285 b,n syscall_check_sig
2286 2251
2252get_register:
2287 /* 2253 /*
2288 * get_register is used by the non access tlb miss handlers to 2254 * get_register is used by the non access tlb miss handlers to
2289 * copy the value of the general register specified in r8 into 2255 * copy the value of the general register specified in r8 into
@@ -2294,8 +2260,6 @@ syscall_do_signal:
2294 * a -1 in it, but that is OK, it just means that we will have 2260 * a -1 in it, but that is OK, it just means that we will have
2295 * to use the slow path instead). 2261 * to use the slow path instead).
2296 */ 2262 */
2297
2298get_register:
2299 blr %r8,%r0 2263 blr %r8,%r0
2300 nop 2264 nop
2301 bv %r0(%r25) /* r0 */ 2265 bv %r0(%r25) /* r0 */
@@ -2363,13 +2327,13 @@ get_register:
2363 bv %r0(%r25) /* r31 */ 2327 bv %r0(%r25) /* r31 */
2364 copy %r31,%r1 2328 copy %r31,%r1
2365 2329
2330
2331set_register:
2366 /* 2332 /*
2367 * set_register is used by the non access tlb miss handlers to 2333 * set_register is used by the non access tlb miss handlers to
2368 * copy the value of r1 into the general register specified in 2334 * copy the value of r1 into the general register specified in
2369 * r8. 2335 * r8.
2370 */ 2336 */
2371
2372set_register:
2373 blr %r8,%r0 2337 blr %r8,%r0
2374 nop 2338 nop
2375 bv %r0(%r25) /* r0 (silly, but it is a place holder) */ 2339 bv %r0(%r25) /* r0 (silly, but it is a place holder) */
@@ -2436,3 +2400,4 @@ set_register:
2436 copy %r1,%r30 2400 copy %r1,%r30
2437 bv %r0(%r25) /* r31 */ 2401 bv %r0(%r25) /* r31 */
2438 copy %r1,%r31 2402 copy %r1,%r31
2403
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 9158b707c0dd..39dc835bf89e 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pdc_lock);
74static unsigned long pdc_result[32] __attribute__ ((aligned (8))); 74static unsigned long pdc_result[32] __attribute__ ((aligned (8)));
75static unsigned long pdc_result2[32] __attribute__ ((aligned (8))); 75static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
76 76
77#ifdef __LP64__ 77#ifdef CONFIG_64BIT
78#define WIDE_FIRMWARE 0x1 78#define WIDE_FIRMWARE 0x1
79#define NARROW_FIRMWARE 0x2 79#define NARROW_FIRMWARE 0x2
80 80
@@ -94,12 +94,12 @@ int parisc_narrow_firmware __read_mostly = 1;
94 * when running a 64-bit kernel on such boxes (e.g. C200 or C360). 94 * when running a 64-bit kernel on such boxes (e.g. C200 or C360).
95 */ 95 */
96 96
97#ifdef __LP64__ 97#ifdef CONFIG_64BIT
98long real64_call(unsigned long function, ...); 98long real64_call(unsigned long function, ...);
99#endif 99#endif
100long real32_call(unsigned long function, ...); 100long real32_call(unsigned long function, ...);
101 101
102#ifdef __LP64__ 102#ifdef CONFIG_64BIT
103# define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc 103# define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
104# define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args) 104# define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args)
105#else 105#else
@@ -117,7 +117,7 @@ long real32_call(unsigned long function, ...);
117 */ 117 */
118static unsigned long f_extend(unsigned long address) 118static unsigned long f_extend(unsigned long address)
119{ 119{
120#ifdef __LP64__ 120#ifdef CONFIG_64BIT
121 if(unlikely(parisc_narrow_firmware)) { 121 if(unlikely(parisc_narrow_firmware)) {
122 if((address & 0xff000000) == 0xf0000000) 122 if((address & 0xff000000) == 0xf0000000)
123 return 0xf0f0f0f000000000UL | (u32)address; 123 return 0xf0f0f0f000000000UL | (u32)address;
@@ -139,7 +139,7 @@ static unsigned long f_extend(unsigned long address)
139 */ 139 */
140static void convert_to_wide(unsigned long *addr) 140static void convert_to_wide(unsigned long *addr)
141{ 141{
142#ifdef __LP64__ 142#ifdef CONFIG_64BIT
143 int i; 143 int i;
144 unsigned int *p = (unsigned int *)addr; 144 unsigned int *p = (unsigned int *)addr;
145 145
@@ -158,7 +158,7 @@ static void convert_to_wide(unsigned long *addr)
158 */ 158 */
159void __init set_firmware_width(void) 159void __init set_firmware_width(void)
160{ 160{
161#ifdef __LP64__ 161#ifdef CONFIG_64BIT
162 int retval; 162 int retval;
163 unsigned long flags; 163 unsigned long flags;
164 164
@@ -238,7 +238,7 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf
238 * 238 *
239 * Must be correctly formatted or expect system crash 239 * Must be correctly formatted or expect system crash
240 */ 240 */
241#ifdef __LP64__ 241#ifdef CONFIG_64BIT
242int pdc_pat_chassis_send_log(unsigned long state, unsigned long data) 242int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
243{ 243{
244 int retval = 0; 244 int retval = 0;
@@ -949,7 +949,7 @@ int pdc_tod_set(unsigned long sec, unsigned long usec)
949} 949}
950EXPORT_SYMBOL(pdc_tod_set); 950EXPORT_SYMBOL(pdc_tod_set);
951 951
952#ifdef __LP64__ 952#ifdef CONFIG_64BIT
953int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, 953int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
954 struct pdc_memory_table *tbl, unsigned long entries) 954 struct pdc_memory_table *tbl, unsigned long entries)
955{ 955{
@@ -965,7 +965,7 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
965 965
966 return retval; 966 return retval;
967} 967}
968#endif /* __LP64__ */ 968#endif /* CONFIG_64BIT */
969 969
970/* FIXME: Is this pdc used? I could not find type reference to ftc_bitmap 970/* FIXME: Is this pdc used? I could not find type reference to ftc_bitmap
971 * so I guessed at unsigned long. Someone who knows what this does, can fix 971 * so I guessed at unsigned long. Someone who knows what this does, can fix
@@ -1204,7 +1204,7 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
1204} 1204}
1205EXPORT_SYMBOL(pdc_sti_call); 1205EXPORT_SYMBOL(pdc_sti_call);
1206 1206
1207#ifdef __LP64__ 1207#ifdef CONFIG_64BIT
1208/** 1208/**
1209 * pdc_pat_cell_get_number - Returns the cell number. 1209 * pdc_pat_cell_get_number - Returns the cell number.
1210 * @cell_info: The return buffer. 1210 * @cell_info: The return buffer.
@@ -1387,7 +1387,7 @@ int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
1387 1387
1388 return retval; 1388 return retval;
1389} 1389}
1390#endif /* __LP64__ */ 1390#endif /* CONFIG_64BIT */
1391 1391
1392 1392
1393/***************** 32-bit real-mode calls ***********/ 1393/***************** 32-bit real-mode calls ***********/
@@ -1445,7 +1445,7 @@ long real32_call(unsigned long fn, ...)
1445 return real32_call_asm(&real_stack.sp, &real_stack.arg0, fn); 1445 return real32_call_asm(&real_stack.sp, &real_stack.arg0, fn);
1446} 1446}
1447 1447
1448#ifdef __LP64__ 1448#ifdef CONFIG_64BIT
1449/***************** 64-bit real-mode calls ***********/ 1449/***************** 64-bit real-mode calls ***********/
1450 1450
1451struct wide_stack { 1451struct wide_stack {
@@ -1496,5 +1496,5 @@ long real64_call(unsigned long fn, ...)
1496 return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn); 1496 return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn);
1497} 1497}
1498 1498
1499#endif /* __LP64__ */ 1499#endif /* CONFIG_64BIT */
1500 1500
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index eaad2328fea1..9676c486bb63 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -2,7 +2,7 @@
2 * License. See the file "COPYING" in the main directory of this archive 2 * License. See the file "COPYING" in the main directory of this archive
3 * for more details. 3 * for more details.
4 * 4 *
5 * Copyright (C) 1999 by Helge Deller 5 * Copyright (C) 1999-2007 by Helge Deller <deller@gmx.de>
6 * Copyright 1999 SuSE GmbH (Philipp Rumpf) 6 * Copyright 1999 SuSE GmbH (Philipp Rumpf)
7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org) 7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org)
8 * Copyright 2000 Hewlett Packard (Paul Bame, bame@puffin.external.hp.com) 8 * Copyright 2000 Hewlett Packard (Paul Bame, bame@puffin.external.hp.com)
@@ -19,16 +19,17 @@
19#include <asm/assembly.h> 19#include <asm/assembly.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21 21
22#include <linux/linkage.h>
23
22 .level LEVEL 24 .level LEVEL
23 25
24 .data 26 .data
25 27ENTRY(boot_args)
26 .export boot_args
27boot_args:
28 .word 0 /* arg0 */ 28 .word 0 /* arg0 */
29 .word 0 /* arg1 */ 29 .word 0 /* arg1 */
30 .word 0 /* arg2 */ 30 .word 0 /* arg2 */
31 .word 0 /* arg3 */ 31 .word 0 /* arg3 */
32END(boot_args)
32 33
33 .text 34 .text
34 .align 4 35 .align 4
@@ -38,10 +39,9 @@ boot_args:
38 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ 39 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */
39 .import $global$ /* forward declaration */ 40 .import $global$ /* forward declaration */
40#endif /*!CONFIG_64BIT*/ 41#endif /*!CONFIG_64BIT*/
41 .export stext
42 .export _stext,data /* Kernel want it this way! */ 42 .export _stext,data /* Kernel want it this way! */
43_stext: 43_stext:
44stext: 44ENTRY(stext)
45 .proc 45 .proc
46 .callinfo 46 .callinfo
47 47
@@ -343,6 +343,9 @@ smp_slave_stext:
343 343
344 .procend 344 .procend
345#endif /* CONFIG_SMP */ 345#endif /* CONFIG_SMP */
346
347ENDPROC(stext)
348
346#ifndef CONFIG_64BIT 349#ifndef CONFIG_64BIT
347 .data 350 .data
348 351
diff --git a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S
index c412c0adc4a9..d8baa158d8a0 100644
--- a/arch/parisc/kernel/hpmc.S
+++ b/arch/parisc/kernel/hpmc.S
@@ -46,6 +46,8 @@
46#include <asm/assembly.h> 46#include <asm/assembly.h>
47#include <asm/pdc.h> 47#include <asm/pdc.h>
48 48
49#include <linux/linkage.h>
50
49 /* 51 /*
50 * stack for os_hpmc, the HPMC handler. 52 * stack for os_hpmc, the HPMC handler.
51 * buffer for IODC procedures (for the HPMC handler). 53 * buffer for IODC procedures (for the HPMC handler).
@@ -69,17 +71,15 @@ hpmc_raddr:
69 71
70#define HPMC_PIM_DATA_SIZE 896 /* Enough to hold all architected 2.0 state */ 72#define HPMC_PIM_DATA_SIZE 896 /* Enough to hold all architected 2.0 state */
71 73
72 .export hpmc_pim_data, data
73 .align 8 74 .align 8
74hpmc_pim_data: 75ENTRY(hpmc_pim_data)
75 .block HPMC_PIM_DATA_SIZE 76 .block HPMC_PIM_DATA_SIZE
77END(hpmc_pim_data)
76 78
77 .text 79 .text
78 80
79 .export os_hpmc, code
80 .import intr_save, code 81 .import intr_save, code
81 82ENTRY(os_hpmc)
82os_hpmc:
83 83
84 /* 84 /*
85 * registers modified: 85 * registers modified:
@@ -294,11 +294,9 @@ os_hpmc_6:
294 294
295 b . 295 b .
296 nop 296 nop
297ENDPROC(os_hpmc)
297 298
298 /* this label used to compute os_hpmc checksum */ 299 /* this label used to compute os_hpmc checksum */
299 300ENTRY(os_hpmc_end)
300 .export os_hpmc_end, code
301
302os_hpmc_end:
303 301
304 nop 302 nop
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 4e847ba53180..4845a6444633 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -47,7 +47,7 @@ void __init setup_pdc(void)
47 struct pdc_system_map_mod_info module_result; 47 struct pdc_system_map_mod_info module_result;
48 struct pdc_module_path module_path; 48 struct pdc_module_path module_path;
49 struct pdc_model model; 49 struct pdc_model model;
50#ifdef __LP64__ 50#ifdef CONFIG_64BIT
51 struct pdc_pat_cell_num cell_info; 51 struct pdc_pat_cell_num cell_info;
52#endif 52#endif
53 53
@@ -73,7 +73,7 @@ void __init setup_pdc(void)
73 * clearer message. 73 * clearer message.
74 */ 74 */
75 75
76#ifdef __LP64__ 76#ifdef CONFIG_64BIT
77 status = pdc_pat_cell_get_number(&cell_info); 77 status = pdc_pat_cell_get_number(&cell_info);
78 if (status == PDC_OK) { 78 if (status == PDC_OK) {
79 pdc_type = PDC_TYPE_PAT; 79 pdc_type = PDC_TYPE_PAT;
@@ -152,7 +152,7 @@ static void __init pagezero_memconfig(void)
152 npmem_ranges = 1; 152 npmem_ranges = 1;
153} 153}
154 154
155#ifdef __LP64__ 155#ifdef CONFIG_64BIT
156 156
157/* All of the PDC PAT specific code is 64-bit only */ 157/* All of the PDC PAT specific code is 64-bit only */
158 158
@@ -408,13 +408,13 @@ static void __init sprockets_memconfig(void)
408 } 408 }
409} 409}
410 410
411#else /* !__LP64__ */ 411#else /* !CONFIG_64BIT */
412 412
413#define pat_inventory() do { } while (0) 413#define pat_inventory() do { } while (0)
414#define pat_memconfig() do { } while (0) 414#define pat_memconfig() do { } while (0)
415#define sprockets_memconfig() pagezero_memconfig() 415#define sprockets_memconfig() pagezero_memconfig()
416 416
417#endif /* !__LP64__ */ 417#endif /* !CONFIG_64BIT */
418 418
419 419
420#ifndef CONFIG_PA20 420#ifndef CONFIG_PA20
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index b39c5b9aff46..e9d09b020e86 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -336,11 +336,7 @@ unsigned int txn_alloc_data(unsigned int virt_irq)
336 336
337static inline int eirr_to_irq(unsigned long eirr) 337static inline int eirr_to_irq(unsigned long eirr)
338{ 338{
339#ifdef CONFIG_64BIT 339 int bit = fls_long(eirr);
340 int bit = fls64(eirr);
341#else
342 int bit = fls(eirr);
343#endif
344 return (BITS_PER_LONG - bit) + TIMER_IRQ; 340 return (BITS_PER_LONG - bit) + TIMER_IRQ;
345} 341}
346 342
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index f50b982b0834..fdacdd4341c9 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -46,6 +46,7 @@
46#include <linux/fs.h> 46#include <linux/fs.h>
47#include <linux/string.h> 47#include <linux/string.h>
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/bug.h>
49 50
50#include <asm/unwind.h> 51#include <asm/unwind.h>
51 52
@@ -96,7 +97,7 @@ static inline int in_local_section(struct module *me, void *loc, void *dot)
96} 97}
97 98
98 99
99#ifndef __LP64__ 100#ifndef CONFIG_64BIT
100struct got_entry { 101struct got_entry {
101 Elf32_Addr addr; 102 Elf32_Addr addr;
102}; 103};
@@ -176,7 +177,7 @@ void *module_alloc(unsigned long size)
176 return vmalloc(size); 177 return vmalloc(size);
177} 178}
178 179
179#ifndef __LP64__ 180#ifndef CONFIG_64BIT
180static inline unsigned long count_gots(const Elf_Rela *rela, unsigned long n) 181static inline unsigned long count_gots(const Elf_Rela *rela, unsigned long n)
181{ 182{
182 return 0; 183 return 0;
@@ -319,7 +320,7 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
319 return 0; 320 return 0;
320} 321}
321 322
322#ifdef __LP64__ 323#ifdef CONFIG_64BIT
323static Elf64_Word get_got(struct module *me, unsigned long value, long addend) 324static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
324{ 325{
325 unsigned int i; 326 unsigned int i;
@@ -342,9 +343,9 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
342 value); 343 value);
343 return i * sizeof(struct got_entry); 344 return i * sizeof(struct got_entry);
344} 345}
345#endif /* __LP64__ */ 346#endif /* CONFIG_64BIT */
346 347
347#ifdef __LP64__ 348#ifdef CONFIG_64BIT
348static Elf_Addr get_fdesc(struct module *me, unsigned long value) 349static Elf_Addr get_fdesc(struct module *me, unsigned long value)
349{ 350{
350 Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset; 351 Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset;
@@ -368,7 +369,7 @@ static Elf_Addr get_fdesc(struct module *me, unsigned long value)
368 fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset; 369 fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset;
369 return (Elf_Addr)fdesc; 370 return (Elf_Addr)fdesc;
370} 371}
371#endif /* __LP64__ */ 372#endif /* CONFIG_64BIT */
372 373
373enum elf_stub_type { 374enum elf_stub_type {
374 ELF_STUB_GOT, 375 ELF_STUB_GOT,
@@ -394,7 +395,7 @@ static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
394 i * sizeof(struct stub_entry); 395 i * sizeof(struct stub_entry);
395 } 396 }
396 397
397#ifndef __LP64__ 398#ifndef CONFIG_64BIT
398/* for 32-bit the stub looks like this: 399/* for 32-bit the stub looks like this:
399 * ldil L'XXX,%r1 400 * ldil L'XXX,%r1
400 * be,n R'XXX(%sr4,%r1) 401 * be,n R'XXX(%sr4,%r1)
@@ -472,7 +473,7 @@ int apply_relocate(Elf_Shdr *sechdrs,
472 return -ENOEXEC; 473 return -ENOEXEC;
473} 474}
474 475
475#ifndef __LP64__ 476#ifndef CONFIG_64BIT
476int apply_relocate_add(Elf_Shdr *sechdrs, 477int apply_relocate_add(Elf_Shdr *sechdrs,
477 const char *strtab, 478 const char *strtab,
478 unsigned int symindex, 479 unsigned int symindex,
@@ -822,7 +823,8 @@ int module_finalize(const Elf_Ehdr *hdr,
822 me->name, strtab, symhdr); 823 me->name, strtab, symhdr);
823 824
824 if(me->arch.got_count > MAX_GOTS) { 825 if(me->arch.got_count > MAX_GOTS) {
825 printk(KERN_ERR "%s: Global Offset Table overflow (used %ld, allowed %d\n", me->name, me->arch.got_count, MAX_GOTS); 826 printk(KERN_ERR "%s: Global Offset Table overflow (used %ld, allowed %d)\n",
827 me->name, me->arch.got_count, MAX_GOTS);
826 return -EINVAL; 828 return -EINVAL;
827 } 829 }
828 830
@@ -850,10 +852,11 @@ int module_finalize(const Elf_Ehdr *hdr,
850 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; 852 nsyms = newptr - (Elf_Sym *)symhdr->sh_addr;
851 DEBUGP("NEW num_symtab %lu\n", nsyms); 853 DEBUGP("NEW num_symtab %lu\n", nsyms);
852 symhdr->sh_size = nsyms * sizeof(Elf_Sym); 854 symhdr->sh_size = nsyms * sizeof(Elf_Sym);
853 return 0; 855 return module_bug_finalize(hdr, sechdrs, me);
854} 856}
855 857
856void module_arch_cleanup(struct module *mod) 858void module_arch_cleanup(struct module *mod)
857{ 859{
858 deregister_unwind_table(mod); 860 deregister_unwind_table(mod);
861 module_bug_cleanup(mod);
859} 862}
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index e81c9937d10a..90b240878520 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -27,31 +27,21 @@
27 */ 27 */
28 28
29#ifdef CONFIG_64BIT 29#ifdef CONFIG_64BIT
30#define ADDIB addib,*
31#define CMPB cmpb,*
32#define ANDCM andcm,*
33
34 .level 2.0w 30 .level 2.0w
35#else 31#else
36#define ADDIB addib,
37#define CMPB cmpb,
38#define ANDCM andcm
39
40 .level 2.0 32 .level 2.0
41#endif 33#endif
42 34
43
44#include <asm/psw.h> 35#include <asm/psw.h>
45#include <asm/assembly.h> 36#include <asm/assembly.h>
46#include <asm/pgtable.h> 37#include <asm/pgtable.h>
47#include <asm/cache.h> 38#include <asm/cache.h>
39#include <linux/linkage.h>
48 40
49 .text 41 .text
50 .align 128 42 .align 128
51 43
52 .export flush_tlb_all_local,code 44ENTRY(flush_tlb_all_local)
53
54flush_tlb_all_local:
55 .proc 45 .proc
56 .callinfo NO_CALLS 46 .callinfo NO_CALLS
57 .entry 47 .entry
@@ -200,11 +190,11 @@ fdtdone:
200 190
201 .exit 191 .exit
202 .procend 192 .procend
193ENDPROC(flush_tlb_all_local)
203 194
204 .export flush_instruction_cache_local,code
205 .import cache_info,data 195 .import cache_info,data
206 196
207flush_instruction_cache_local: 197ENTRY(flush_instruction_cache_local)
208 .proc 198 .proc
209 .callinfo NO_CALLS 199 .callinfo NO_CALLS
210 .entry 200 .entry
@@ -241,11 +231,11 @@ fisync:
241 .exit 231 .exit
242 232
243 .procend 233 .procend
234ENDPROC(flush_instruction_cache_local)
244 235
245 .export flush_data_cache_local, code
246 .import cache_info, data
247 236
248flush_data_cache_local: 237 .import cache_info, data
238ENTRY(flush_data_cache_local)
249 .proc 239 .proc
250 .callinfo NO_CALLS 240 .callinfo NO_CALLS
251 .entry 241 .entry
@@ -283,11 +273,11 @@ fdsync:
283 .exit 273 .exit
284 274
285 .procend 275 .procend
276ENDPROC(flush_data_cache_local)
286 277
287 .export copy_user_page_asm,code
288 .align 16 278 .align 16
289 279
290copy_user_page_asm: 280ENTRY(copy_user_page_asm)
291 .proc 281 .proc
292 .callinfo NO_CALLS 282 .callinfo NO_CALLS
293 .entry 283 .entry
@@ -409,6 +399,7 @@ copy_user_page_asm:
409 .exit 399 .exit
410 400
411 .procend 401 .procend
402ENDPROC(copy_user_page_asm)
412 403
413/* 404/*
414 * NOTE: Code in clear_user_page has a hard coded dependency on the 405 * NOTE: Code in clear_user_page has a hard coded dependency on the
@@ -446,9 +437,7 @@ copy_user_page_asm:
446 * lobby for such a change. 437 * lobby for such a change.
447 */ 438 */
448 439
449 .export copy_user_page_asm,code 440ENTRY(copy_user_page_asm)
450
451copy_user_page_asm:
452 .proc 441 .proc
453 .callinfo NO_CALLS 442 .callinfo NO_CALLS
454 .entry 443 .entry
@@ -534,11 +523,10 @@ copy_user_page_asm:
534 .exit 523 .exit
535 524
536 .procend 525 .procend
526ENDPROC(copy_user_page_asm)
537#endif 527#endif
538 528
539 .export __clear_user_page_asm,code 529ENTRY(__clear_user_page_asm)
540
541__clear_user_page_asm:
542 .proc 530 .proc
543 .callinfo NO_CALLS 531 .callinfo NO_CALLS
544 .entry 532 .entry
@@ -618,10 +606,9 @@ __clear_user_page_asm:
618 .exit 606 .exit
619 607
620 .procend 608 .procend
609ENDPROC(__clear_user_page_asm)
621 610
622 .export flush_kernel_dcache_page_asm 611ENTRY(flush_kernel_dcache_page_asm)
623
624flush_kernel_dcache_page_asm:
625 .proc 612 .proc
626 .callinfo NO_CALLS 613 .callinfo NO_CALLS
627 .entry 614 .entry
@@ -662,10 +649,9 @@ flush_kernel_dcache_page_asm:
662 .exit 649 .exit
663 650
664 .procend 651 .procend
652ENDPROC(flush_kernel_dcache_page_asm)
665 653
666 .export flush_user_dcache_page 654ENTRY(flush_user_dcache_page)
667
668flush_user_dcache_page:
669 .proc 655 .proc
670 .callinfo NO_CALLS 656 .callinfo NO_CALLS
671 .entry 657 .entry
@@ -706,10 +692,9 @@ flush_user_dcache_page:
706 .exit 692 .exit
707 693
708 .procend 694 .procend
695ENDPROC(flush_user_dcache_page)
709 696
710 .export flush_user_icache_page 697ENTRY(flush_user_icache_page)
711
712flush_user_icache_page:
713 .proc 698 .proc
714 .callinfo NO_CALLS 699 .callinfo NO_CALLS
715 .entry 700 .entry
@@ -750,11 +735,10 @@ flush_user_icache_page:
750 .exit 735 .exit
751 736
752 .procend 737 .procend
738ENDPROC(flush_user_icache_page)
753 739
754 740
755 .export purge_kernel_dcache_page 741ENTRY(purge_kernel_dcache_page)
756
757purge_kernel_dcache_page:
758 .proc 742 .proc
759 .callinfo NO_CALLS 743 .callinfo NO_CALLS
760 .entry 744 .entry
@@ -794,15 +778,14 @@ purge_kernel_dcache_page:
794 .exit 778 .exit
795 779
796 .procend 780 .procend
781ENDPROC(purge_kernel_dcache_page)
797 782
798#if 0 783#if 0
799 /* Currently not used, but it still is a possible alternate 784 /* Currently not used, but it still is a possible alternate
800 * solution. 785 * solution.
801 */ 786 */
802 787
803 .export flush_alias_page 788ENTRY(flush_alias_page)
804
805flush_alias_page:
806 .proc 789 .proc
807 .callinfo NO_CALLS 790 .callinfo NO_CALLS
808 .entry 791 .entry
@@ -882,10 +865,9 @@ flush_user_dcache_range_asm:
882 .exit 865 .exit
883 866
884 .procend 867 .procend
868ENDPROC(flush_alias_page)
885 869
886 .export flush_kernel_dcache_range_asm 870ENTRY(flush_kernel_dcache_range_asm)
887
888flush_kernel_dcache_range_asm:
889 .proc 871 .proc
890 .callinfo NO_CALLS 872 .callinfo NO_CALLS
891 .entry 873 .entry
@@ -905,10 +887,9 @@ flush_kernel_dcache_range_asm:
905 .exit 887 .exit
906 888
907 .procend 889 .procend
890ENDPROC(flush_kernel_dcache_range_asm)
908 891
909 .export flush_user_icache_range_asm 892ENTRY(flush_user_icache_range_asm)
910
911flush_user_icache_range_asm:
912 .proc 893 .proc
913 .callinfo NO_CALLS 894 .callinfo NO_CALLS
914 .entry 895 .entry
@@ -927,10 +908,9 @@ flush_user_icache_range_asm:
927 .exit 908 .exit
928 909
929 .procend 910 .procend
911ENDPROC(flush_user_icache_range_asm)
930 912
931 .export flush_kernel_icache_page 913ENTRY(flush_kernel_icache_page)
932
933flush_kernel_icache_page:
934 .proc 914 .proc
935 .callinfo NO_CALLS 915 .callinfo NO_CALLS
936 .entry 916 .entry
@@ -971,10 +951,9 @@ flush_kernel_icache_page:
971 .exit 951 .exit
972 952
973 .procend 953 .procend
954ENDPROC(flush_kernel_icache_page)
974 955
975 .export flush_kernel_icache_range_asm 956ENTRY(flush_kernel_icache_range_asm)
976
977flush_kernel_icache_range_asm:
978 .proc 957 .proc
979 .callinfo NO_CALLS 958 .callinfo NO_CALLS
980 .entry 959 .entry
@@ -992,14 +971,13 @@ flush_kernel_icache_range_asm:
992 nop 971 nop
993 .exit 972 .exit
994 .procend 973 .procend
974ENDPROC(flush_kernel_icache_range_asm)
995 975
996 /* align should cover use of rfi in disable_sr_hashing_asm and 976 /* align should cover use of rfi in disable_sr_hashing_asm and
997 * srdis_done. 977 * srdis_done.
998 */ 978 */
999 .align 256 979 .align 256
1000 .export disable_sr_hashing_asm,code 980ENTRY(disable_sr_hashing_asm)
1001
1002disable_sr_hashing_asm:
1003 .proc 981 .proc
1004 .callinfo NO_CALLS 982 .callinfo NO_CALLS
1005 .entry 983 .entry
@@ -1088,5 +1066,6 @@ srdis_done:
1088 .exit 1066 .exit
1089 1067
1090 .procend 1068 .procend
1069ENDPROC(disable_sr_hashing_asm)
1091 1070
1092 .end 1071 .end
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 8f6a0b312f7a..7aca704e96f0 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -7,7 +7,7 @@
7 * Copyright (C) 2001-2003 Grant Grundler <grundler with parisc-linux.org> 7 * Copyright (C) 2001-2003 Grant Grundler <grundler with parisc-linux.org>
8 * Copyright (C) 2002-2003 Matthew Wilcox <willy at parisc-linux.org> 8 * Copyright (C) 2002-2003 Matthew Wilcox <willy at parisc-linux.org>
9 * Copyright (C) 2002 Randolph Chung <tausq at parisc-linux.org> 9 * Copyright (C) 2002 Randolph Chung <tausq at parisc-linux.org>
10 * Copyright (C) 2002-2003 Helge Deller <deller with parisc-linux.org> 10 * Copyright (C) 2002-2007 Helge Deller <deller with parisc-linux.org>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(__cmpxchg_u32);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39EXPORT_SYMBOL(__atomic_hash); 39EXPORT_SYMBOL(__atomic_hash);
40#endif 40#endif
41#ifdef __LP64__ 41#ifdef CONFIG_64BIT
42EXPORT_SYMBOL(__xchg64); 42EXPORT_SYMBOL(__xchg64);
43EXPORT_SYMBOL(__cmpxchg_u64); 43EXPORT_SYMBOL(__cmpxchg_u64);
44#endif 44#endif
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(fixup_get_user_skip_2);
58EXPORT_SYMBOL(fixup_put_user_skip_1); 58EXPORT_SYMBOL(fixup_put_user_skip_1);
59EXPORT_SYMBOL(fixup_put_user_skip_2); 59EXPORT_SYMBOL(fixup_put_user_skip_2);
60 60
61#ifndef __LP64__ 61#ifndef CONFIG_64BIT
62/* Needed so insmod can set dp value */ 62/* Needed so insmod can set dp value */
63extern int $global$; 63extern int $global$;
64EXPORT_SYMBOL($global$); 64EXPORT_SYMBOL($global$);
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(__muldi3);
135asmlinkage void * __canonicalize_funcptr_for_compare(void *); 135asmlinkage void * __canonicalize_funcptr_for_compare(void *);
136EXPORT_SYMBOL(__canonicalize_funcptr_for_compare); 136EXPORT_SYMBOL(__canonicalize_funcptr_for_compare);
137 137
138#ifdef __LP64__ 138#ifdef CONFIG_64BIT
139extern void __divdi3(void); 139extern void __divdi3(void);
140extern void __udivdi3(void); 140extern void __udivdi3(void);
141extern void __umoddi3(void); 141extern void __umoddi3(void);
@@ -147,7 +147,7 @@ EXPORT_SYMBOL(__umoddi3);
147EXPORT_SYMBOL(__moddi3); 147EXPORT_SYMBOL(__moddi3);
148#endif 148#endif
149 149
150#ifndef __LP64__ 150#ifndef CONFIG_64BIT
151extern void $$dyncall(void); 151extern void $$dyncall(void);
152EXPORT_SYMBOL($$dyncall); 152EXPORT_SYMBOL($$dyncall);
153#endif 153#endif
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index a6caf1073085..0c3aecb85a5c 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -342,7 +342,7 @@ pcxl_dma_init(void)
342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, 342 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL,
343 get_order(pcxl_res_size)); 343 get_order(pcxl_res_size));
344 memset(pcxl_res_map, 0, pcxl_res_size); 344 memset(pcxl_res_map, 0, pcxl_res_size);
345 proc_gsc_root = proc_mkdir("gsc", 0); 345 proc_gsc_root = proc_mkdir("gsc", NULL);
346 if (!proc_gsc_root) 346 if (!proc_gsc_root)
347 printk(KERN_WARNING 347 printk(KERN_WARNING
348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 199887a61c76..563df0072dee 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -200,8 +200,8 @@ static void
200pcibios_link_hba_resources( struct resource *hba_res, struct resource *r) 200pcibios_link_hba_resources( struct resource *hba_res, struct resource *r)
201{ 201{
202 if (!r->parent) { 202 if (!r->parent) {
203 printk(KERN_EMERG "PCI: resource not parented! [%lx-%lx]\n", 203 printk(KERN_EMERG "PCI: resource not parented! [%p-%p]\n",
204 r->start, r->end); 204 (void*) r->start, (void*) r->end);
205 r->parent = hba_res; 205 r->parent = hba_res;
206 206
207 /* reverse link is harder *sigh* */ 207 /* reverse link is harder *sigh* */
diff --git a/arch/parisc/kernel/perf_asm.S b/arch/parisc/kernel/perf_asm.S
index 5e7bb90e7e08..43874ca3ed67 100644
--- a/arch/parisc/kernel/perf_asm.S
+++ b/arch/parisc/kernel/perf_asm.S
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <asm/assembly.h> 22#include <asm/assembly.h>
23#include <linux/linkage.h>
23 24
24#ifdef CONFIG_64BIT 25#ifdef CONFIG_64BIT
25 .level 2.0w 26 .level 2.0w
@@ -41,10 +42,8 @@
41; starting/stopping the coprocessor with the pmenb/pmdis. 42; starting/stopping the coprocessor with the pmenb/pmdis.
42; 43;
43 .text 44 .text
44 .align 32
45 45
46 .export perf_intrigue_enable_perf_counters,code 46ENTRY(perf_intrigue_enable_perf_counters)
47perf_intrigue_enable_perf_counters:
48 .proc 47 .proc
49 .callinfo frame=0,NO_CALLS 48 .callinfo frame=0,NO_CALLS
50 .entry 49 .entry
@@ -69,9 +68,9 @@ perf_intrigue_enable_perf_counters:
69 nop 68 nop
70 .exit 69 .exit
71 .procend 70 .procend
71ENDPROC(perf_intrigue_enable_perf_counters)
72 72
73 .export perf_intrigue_disable_perf_counters,code 73ENTRY(perf_intrigue_disable_perf_counters)
74perf_intrigue_disable_perf_counters:
75 .proc 74 .proc
76 .callinfo frame=0,NO_CALLS 75 .callinfo frame=0,NO_CALLS
77 .entry 76 .entry
@@ -86,6 +85,7 @@ perf_intrigue_disable_perf_counters:
86 mtctl %r26,ccr ; turn off performance coprocessor 85 mtctl %r26,ccr ; turn off performance coprocessor
87 .exit 86 .exit
88 .procend 87 .procend
88ENDPROC(perf_intrigue_disable_perf_counters)
89 89
90;*********************************************************************** 90;***********************************************************************
91;* 91;*
@@ -117,8 +117,7 @@ perf_intrigue_disable_perf_counters:
117;* 117;*
118;*********************************************************************** 118;***********************************************************************
119 119
120 .export perf_rdr_shift_in_W,code 120ENTRY(perf_rdr_shift_in_W)
121perf_rdr_shift_in_W:
122 .proc 121 .proc
123 .callinfo frame=0,NO_CALLS 122 .callinfo frame=0,NO_CALLS
124 .entry 123 .entry
@@ -550,6 +549,7 @@ perf_rdr_shift_in_W_leave:
550 .exit 549 .exit
551 MTDIAG_2 (24) ; restore DR2 550 MTDIAG_2 (24) ; restore DR2
552 .procend 551 .procend
552ENDPROC(perf_rdr_shift_in_W)
553 553
554 554
555;*********************************************************************** 555;***********************************************************************
@@ -575,8 +575,7 @@ perf_rdr_shift_in_W_leave:
575;* 575;*
576;*********************************************************************** 576;***********************************************************************
577 577
578 .export perf_rdr_shift_out_W,code 578ENTRY(perf_rdr_shift_out_W)
579perf_rdr_shift_out_W:
580 .proc 579 .proc
581 .callinfo frame=0,NO_CALLS 580 .callinfo frame=0,NO_CALLS
582 .entry 581 .entry
@@ -983,6 +982,7 @@ perf_rdr_shift_out_W_leave:
983 .exit 982 .exit
984 MTDIAG_2 (23) ; restore DR2 983 MTDIAG_2 (23) ; restore DR2
985 .procend 984 .procend
985ENDPROC(perf_rdr_shift_out_W)
986 986
987 987
988;*********************************************************************** 988;***********************************************************************
@@ -1012,8 +1012,7 @@ perf_rdr_shift_out_W_leave:
1012;* 1012;*
1013;*********************************************************************** 1013;***********************************************************************
1014 1014
1015 .export perf_rdr_shift_in_U,code 1015ENTRY(perf_rdr_shift_in_U)
1016perf_rdr_shift_in_U:
1017 .proc 1016 .proc
1018 .callinfo frame=0,NO_CALLS 1017 .callinfo frame=0,NO_CALLS
1019 .entry 1018 .entry
@@ -1343,6 +1342,7 @@ perf_rdr_shift_in_U_leave:
1343 .exit 1342 .exit
1344 MTDIAG_2 (24) ; restore DR2 1343 MTDIAG_2 (24) ; restore DR2
1345 .procend 1344 .procend
1345ENDPROC(perf_rdr_shift_in_U)
1346 1346
1347;*********************************************************************** 1347;***********************************************************************
1348;* 1348;*
@@ -1369,8 +1369,7 @@ perf_rdr_shift_in_U_leave:
1369;* 1369;*
1370;*********************************************************************** 1370;***********************************************************************
1371 1371
1372 .export perf_rdr_shift_out_U,code 1372ENTRY(perf_rdr_shift_out_U)
1373perf_rdr_shift_out_U:
1374 .proc 1373 .proc
1375 .callinfo frame=0,NO_CALLS 1374 .callinfo frame=0,NO_CALLS
1376 .entry 1375 .entry
@@ -1687,4 +1686,5 @@ perf_rdr_shift_out_U_leave:
1687 .exit 1686 .exit
1688 MTDIAG_2 (23) ; restore DR2 1687 MTDIAG_2 (23) ; restore DR2
1689 .procend 1688 .procend
1689ENDPROC(perf_rdr_shift_out_U)
1690 1690
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 2f9f9dfa66f7..0dd3847f494c 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org> 13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org> 14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
16 * Copyright (C) 2001-2002 Helge Deller <deller at parisc-linux.org> 16 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
18 * 18 *
19 * 19 *
@@ -303,7 +303,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
303 * Copy function and argument to be called from 303 * Copy function and argument to be called from
304 * ret_from_kernel_thread. 304 * ret_from_kernel_thread.
305 */ 305 */
306#ifdef __LP64__ 306#ifdef CONFIG_64BIT
307 cregs->gr[27] = pregs->gr[27]; 307 cregs->gr[27] = pregs->gr[27];
308#endif 308#endif
309 cregs->gr[26] = pregs->gr[26]; 309 cregs->gr[26] = pregs->gr[26];
@@ -355,8 +355,8 @@ asmlinkage int sys_execve(struct pt_regs *regs)
355 error = PTR_ERR(filename); 355 error = PTR_ERR(filename);
356 if (IS_ERR(filename)) 356 if (IS_ERR(filename))
357 goto out; 357 goto out;
358 error = do_execve(filename, (char __user **) regs->gr[25], 358 error = do_execve(filename, (char __user * __user *) regs->gr[25],
359 (char __user **) regs->gr[24], regs); 359 (char __user * __user *) regs->gr[24], regs);
360 if (error == 0) { 360 if (error == 0) {
361 task_lock(current); 361 task_lock(current);
362 current->ptrace &= ~PT_DTRACE; 362 current->ptrace &= ~PT_DTRACE;
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index fb81e5687e7c..7c056dcebf55 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -93,7 +93,7 @@ static int __init processor_probe(struct parisc_device *dev)
93 cpuid = boot_cpu_data.cpu_count; 93 cpuid = boot_cpu_data.cpu_count;
94 txn_addr = dev->hpa.start; /* for legacy PDC */ 94 txn_addr = dev->hpa.start; /* for legacy PDC */
95 95
96#ifdef __LP64__ 96#ifdef CONFIG_64BIT
97 if (is_pdc_pat()) { 97 if (is_pdc_pat()) {
98 ulong status; 98 ulong status;
99 unsigned long bytecnt; 99 unsigned long bytecnt;
@@ -153,8 +153,6 @@ static int __init processor_probe(struct parisc_device *dev)
153 p->cpuid = cpuid; /* save CPU id */ 153 p->cpuid = cpuid; /* save CPU id */
154 p->txn_addr = txn_addr; /* save CPU IRQ address */ 154 p->txn_addr = txn_addr; /* save CPU IRQ address */
155#ifdef CONFIG_SMP 155#ifdef CONFIG_SMP
156 spin_lock_init(&p->lock);
157
158 /* 156 /*
159 ** FIXME: review if any other initialization is clobbered 157 ** FIXME: review if any other initialization is clobbered
160 ** for boot_cpu by the above memset(). 158 ** for boot_cpu by the above memset().
@@ -311,11 +309,11 @@ int __init init_per_cpu(int cpunum)
311 } else { 309 } else {
312 printk(KERN_WARNING "WARNING: No FP CoProcessor?!" 310 printk(KERN_WARNING "WARNING: No FP CoProcessor?!"
313 " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n" 311 " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n"
314#ifdef __LP64__ 312#ifdef CONFIG_64BIT
315 "Halting Machine - FP required\n" 313 "Halting Machine - FP required\n"
316#endif 314#endif
317 , coproc_cfg.ccr_functional); 315 , coproc_cfg.ccr_functional);
318#ifdef __LP64__ 316#ifdef CONFIG_64BIT
319 mdelay(100); /* previous chars get pushed to console */ 317 mdelay(100); /* previous chars get pushed to console */
320 panic("FP CoProc not reported"); 318 panic("FP CoProc not reported");
321#endif 319#endif
@@ -339,9 +337,6 @@ show_cpuinfo (struct seq_file *m, void *v)
339#ifdef CONFIG_SMP 337#ifdef CONFIG_SMP
340 if (0 == cpu_data[n].hpa) 338 if (0 == cpu_data[n].hpa)
341 continue; 339 continue;
342#ifdef ENTRY_SYS_CPUS
343#error iCOD support wants to show CPU state here
344#endif
345#endif 340#endif
346 seq_printf(m, "processor\t: %d\n" 341 seq_printf(m, "processor\t: %d\n"
347 "cpu family\t: PA-RISC %s\n", 342 "cpu family\t: PA-RISC %s\n",
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 3f28de974556..0d0d617b6f21 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -36,7 +36,7 @@
36#define DBG(x...) 36#define DBG(x...)
37#endif 37#endif
38 38
39#ifdef __LP64__ 39#ifdef CONFIG_64BIT
40 40
41/* This function is needed to translate 32 bit pt_regs offsets in to 41/* This function is needed to translate 32 bit pt_regs offsets in to
42 * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel 42 * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel
@@ -90,7 +90,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
90 case PTRACE_PEEKDATA: { 90 case PTRACE_PEEKDATA: {
91 int copied; 91 int copied;
92 92
93#ifdef __LP64__ 93#ifdef CONFIG_64BIT
94 if (__is_compat_task(child)) { 94 if (__is_compat_task(child)) {
95 unsigned int tmp; 95 unsigned int tmp;
96 96
@@ -122,7 +122,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
122 case PTRACE_POKETEXT: /* write the word at location addr. */ 122 case PTRACE_POKETEXT: /* write the word at location addr. */
123 case PTRACE_POKEDATA: 123 case PTRACE_POKEDATA:
124 ret = 0; 124 ret = 0;
125#ifdef __LP64__ 125#ifdef CONFIG_64BIT
126 if (__is_compat_task(child)) { 126 if (__is_compat_task(child)) {
127 unsigned int tmp = (unsigned int)data; 127 unsigned int tmp = (unsigned int)data;
128 DBG("sys_ptrace(POKE%s, %d, %lx, %lx)\n", 128 DBG("sys_ptrace(POKE%s, %d, %lx, %lx)\n",
@@ -145,7 +145,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
145 processes, the kernel saves all regs on a syscall. */ 145 processes, the kernel saves all regs on a syscall. */
146 case PTRACE_PEEKUSR: { 146 case PTRACE_PEEKUSR: {
147 ret = -EIO; 147 ret = -EIO;
148#ifdef __LP64__ 148#ifdef CONFIG_64BIT
149 if (__is_compat_task(child)) { 149 if (__is_compat_task(child)) {
150 unsigned int tmp; 150 unsigned int tmp;
151 151
@@ -204,7 +204,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
204 ret = 0; 204 ret = 0;
205 goto out_tsk; 205 goto out_tsk;
206 } 206 }
207#ifdef __LP64__ 207#ifdef CONFIG_64BIT
208 if (__is_compat_task(child)) { 208 if (__is_compat_task(child)) {
209 if (addr & (sizeof(int)-1)) 209 if (addr & (sizeof(int)-1))
210 goto out_tsk; 210 goto out_tsk;
diff --git a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
index 789061f6ceb4..7a92695d95a6 100644
--- a/arch/parisc/kernel/real2.S
+++ b/arch/parisc/kernel/real2.S
@@ -11,6 +11,8 @@
11#include <asm/psw.h> 11#include <asm/psw.h>
12#include <asm/assembly.h> 12#include <asm/assembly.h>
13 13
14#include <linux/linkage.h>
15
14 .section .bss 16 .section .bss
15 .export real_stack 17 .export real_stack
16 .export real32_stack 18 .export real32_stack
@@ -39,8 +41,6 @@ save_cr_end:
39 41
40 .text 42 .text
41 43
42 .export real32_call_asm
43
44 /* unsigned long real32_call_asm(unsigned int *sp, 44 /* unsigned long real32_call_asm(unsigned int *sp,
45 * unsigned int *arg0p, 45 * unsigned int *arg0p,
46 * unsigned int iodc_fn) 46 * unsigned int iodc_fn)
@@ -49,7 +49,7 @@ save_cr_end:
49 * iodc_fn is the IODC function to call 49 * iodc_fn is the IODC function to call
50 */ 50 */
51 51
52real32_call_asm: 52ENTRY(real32_call_asm)
53 STREG %rp, -RP_OFFSET(%sp) /* save RP */ 53 STREG %rp, -RP_OFFSET(%sp) /* save RP */
54#ifdef CONFIG_64BIT 54#ifdef CONFIG_64BIT
55 callee_save 55 callee_save
@@ -107,6 +107,7 @@ ric_ret:
107 LDREG -RP_OFFSET(%sp), %rp /* restore RP */ 107 LDREG -RP_OFFSET(%sp), %rp /* restore RP */
108 bv 0(%rp) 108 bv 0(%rp)
109 nop 109 nop
110ENDPROC(real32_call_asm)
110 111
111 112
112# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where) 113# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where)
@@ -218,7 +219,6 @@ rfi_r2v_1:
218/************************ 64-bit real-mode calls ***********************/ 219/************************ 64-bit real-mode calls ***********************/
219/* This is only usable in wide kernels right now and will probably stay so */ 220/* This is only usable in wide kernels right now and will probably stay so */
220 .text 221 .text
221 .export real64_call_asm
222 /* unsigned long real64_call_asm(unsigned long *sp, 222 /* unsigned long real64_call_asm(unsigned long *sp,
223 * unsigned long *arg0p, 223 * unsigned long *arg0p,
224 * unsigned long fn) 224 * unsigned long fn)
@@ -226,7 +226,7 @@ rfi_r2v_1:
226 * arg0p points to where saved arg values may be found 226 * arg0p points to where saved arg values may be found
227 * iodc_fn is the IODC function to call 227 * iodc_fn is the IODC function to call
228 */ 228 */
229real64_call_asm: 229ENTRY(real64_call_asm)
230 std %rp, -0x10(%sp) /* save RP */ 230 std %rp, -0x10(%sp) /* save RP */
231 std %sp, -8(%arg0) /* save SP on real-mode stack */ 231 std %sp, -8(%arg0) /* save SP on real-mode stack */
232 copy %arg0, %sp /* adopt the real-mode SP */ 232 copy %arg0, %sp /* adopt the real-mode SP */
@@ -272,19 +272,21 @@ r64_ret:
272 ldd -0x10(%sp), %rp /* restore RP */ 272 ldd -0x10(%sp), %rp /* restore RP */
273 bv 0(%rp) 273 bv 0(%rp)
274 nop 274 nop
275ENDPROC(real64_call_asm)
275 276
276#endif 277#endif
277 278
278 .export __canonicalize_funcptr_for_compare
279 .text 279 .text
280 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html 280 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html
281 ** GCC 3.3 and later has a new function in libgcc.a for 281 ** GCC 3.3 and later has a new function in libgcc.a for
282 ** comparing function pointers. 282 ** comparing function pointers.
283 */ 283 */
284__canonicalize_funcptr_for_compare: 284ENTRY(__canonicalize_funcptr_for_compare)
285#ifdef CONFIG_64BIT 285#ifdef CONFIG_64BIT
286 bve (%r2) 286 bve (%r2)
287#else 287#else
288 bv %r0(%r2) 288 bv %r0(%r2)
289#endif 289#endif
290 copy %r26,%r28 290 copy %r26,%r28
291ENDPROC(__canonicalize_funcptr_for_compare)
292
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 74b3686dd1e0..bd2116e03f34 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -120,13 +120,13 @@ extern void collect_boot_cpu_data(void);
120 120
121void __init setup_arch(char **cmdline_p) 121void __init setup_arch(char **cmdline_p)
122{ 122{
123#ifdef __LP64__ 123#ifdef CONFIG_64BIT
124 extern int parisc_narrow_firmware; 124 extern int parisc_narrow_firmware;
125#endif 125#endif
126 126
127 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ 127 init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */
128 128
129#ifdef __LP64__ 129#ifdef CONFIG_64BIT
130 printk(KERN_INFO "The 64-bit Kernel has started...\n"); 130 printk(KERN_INFO "The 64-bit Kernel has started...\n");
131#else 131#else
132 printk(KERN_INFO "The 32-bit Kernel has started...\n"); 132 printk(KERN_INFO "The 32-bit Kernel has started...\n");
@@ -134,7 +134,7 @@ void __init setup_arch(char **cmdline_p)
134 134
135 pdc_console_init(); 135 pdc_console_init();
136 136
137#ifdef __LP64__ 137#ifdef CONFIG_64BIT
138 if(parisc_narrow_firmware) { 138 if(parisc_narrow_firmware) {
139 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n"); 139 printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
140 } 140 }
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index ee6653edeb7a..9784e405f849 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -59,58 +59,13 @@
59 * this. */ 59 * this. */
60#define A(__x) ((unsigned long)(__x)) 60#define A(__x) ((unsigned long)(__x))
61 61
62int do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall);
63
64/* 62/*
65 * Atomically swap in the new signal mask, and wait for a signal. 63 * Atomically swap in the new signal mask, and wait for a signal.
66 */ 64 */
67#ifdef __LP64__ 65#ifdef CONFIG_64BIT
68#include "sys32.h" 66#include "sys32.h"
69#endif 67#endif
70 68
71asmlinkage int
72sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
73{
74 sigset_t saveset, newset;
75#ifdef __LP64__
76 compat_sigset_t newset32;
77
78 if (is_compat_task()) {
79 /* XXX: Don't preclude handling different sized sigset_t's. */
80 if (sigsetsize != sizeof(compat_sigset_t))
81 return -EINVAL;
82 if (copy_from_user(&newset32, (compat_sigset_t __user *)unewset, sizeof(newset32)))
83 return -EFAULT;
84 sigset_32to64(&newset,&newset32);
85
86 } else
87#endif
88 {
89 /* XXX: Don't preclude handling different sized sigset_t's. */
90 if (sigsetsize != sizeof(sigset_t))
91 return -EINVAL;
92
93 if (copy_from_user(&newset, unewset, sizeof(newset)))
94 return -EFAULT;
95 }
96
97 sigdelsetmask(&newset, ~_BLOCKABLE);
98
99 spin_lock_irq(&current->sighand->siglock);
100 saveset = current->blocked;
101 current->blocked = newset;
102 recalc_sigpending();
103 spin_unlock_irq(&current->sighand->siglock);
104
105 regs->gr[28] = -EINTR;
106 while (1) {
107 current->state = TASK_INTERRUPTIBLE;
108 schedule();
109 if (do_signal(&saveset, regs, 1))
110 return -EINTR;
111 }
112}
113
114/* 69/*
115 * Do a signal return - restore sigcontext. 70 * Do a signal return - restore sigcontext.
116 */ 71 */
@@ -148,7 +103,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
148 sigset_t set; 103 sigset_t set;
149 unsigned long usp = (regs->gr[30] & ~(0x01UL)); 104 unsigned long usp = (regs->gr[30] & ~(0x01UL));
150 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE; 105 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
151#ifdef __LP64__ 106#ifdef CONFIG_64BIT
152 compat_sigset_t compat_set; 107 compat_sigset_t compat_set;
153 struct compat_rt_sigframe __user * compat_frame; 108 struct compat_rt_sigframe __user * compat_frame;
154 109
@@ -162,7 +117,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
162 (usp - sigframe_size); 117 (usp - sigframe_size);
163 DBG(2,"sys_rt_sigreturn: frame is %p\n", frame); 118 DBG(2,"sys_rt_sigreturn: frame is %p\n", frame);
164 119
165#ifdef __LP64__ 120#ifdef CONFIG_64BIT
166 compat_frame = (struct compat_rt_sigframe __user *)frame; 121 compat_frame = (struct compat_rt_sigframe __user *)frame;
167 122
168 if (is_compat_task()) { 123 if (is_compat_task()) {
@@ -184,7 +139,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
184 spin_unlock_irq(&current->sighand->siglock); 139 spin_unlock_irq(&current->sighand->siglock);
185 140
186 /* Good thing we saved the old gr[30], eh? */ 141 /* Good thing we saved the old gr[30], eh? */
187#ifdef __LP64__ 142#ifdef CONFIG_64BIT
188 if (is_compat_task()) { 143 if (is_compat_task()) {
189 DBG(1,"sys_rt_sigreturn: compat_frame->uc.uc_mcontext 0x%p\n", 144 DBG(1,"sys_rt_sigreturn: compat_frame->uc.uc_mcontext 0x%p\n",
190 &compat_frame->uc.uc_mcontext); 145 &compat_frame->uc.uc_mcontext);
@@ -296,7 +251,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
296 unsigned long rp, usp; 251 unsigned long rp, usp;
297 unsigned long haddr, sigframe_size; 252 unsigned long haddr, sigframe_size;
298 int err = 0; 253 int err = 0;
299#ifdef __LP64__ 254#ifdef CONFIG_64BIT
300 compat_int_t compat_val; 255 compat_int_t compat_val;
301 struct compat_rt_sigframe __user * compat_frame; 256 struct compat_rt_sigframe __user * compat_frame;
302 compat_sigset_t compat_set; 257 compat_sigset_t compat_set;
@@ -310,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
310 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info); 265 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info);
311 266
312 267
313#ifdef __LP64__ 268#ifdef CONFIG_64BIT
314 269
315 compat_frame = (struct compat_rt_sigframe __user *)frame; 270 compat_frame = (struct compat_rt_sigframe __user *)frame;
316 271
@@ -390,7 +345,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
390 345
391 haddr = A(ka->sa.sa_handler); 346 haddr = A(ka->sa.sa_handler);
392 /* The sa_handler may be a pointer to a function descriptor */ 347 /* The sa_handler may be a pointer to a function descriptor */
393#ifdef __LP64__ 348#ifdef CONFIG_64BIT
394 if (is_compat_task()) { 349 if (is_compat_task()) {
395#endif 350#endif
396 if (haddr & PA_PLABEL_FDESC) { 351 if (haddr & PA_PLABEL_FDESC) {
@@ -405,7 +360,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
405 haddr = fdesc.addr; 360 haddr = fdesc.addr;
406 regs->gr[19] = fdesc.gp; 361 regs->gr[19] = fdesc.gp;
407 } 362 }
408#ifdef __LP64__ 363#ifdef CONFIG_64BIT
409 } else { 364 } else {
410 Elf64_Fdesc fdesc; 365 Elf64_Fdesc fdesc;
411 Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3); 366 Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3);
@@ -425,19 +380,19 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
425 /* The syscall return path will create IAOQ values from r31. 380 /* The syscall return path will create IAOQ values from r31.
426 */ 381 */
427 sigframe_size = PARISC_RT_SIGFRAME_SIZE; 382 sigframe_size = PARISC_RT_SIGFRAME_SIZE;
428#ifdef __LP64__ 383#ifdef CONFIG_64BIT
429 if (is_compat_task()) 384 if (is_compat_task())
430 sigframe_size = PARISC_RT_SIGFRAME_SIZE32; 385 sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
431#endif 386#endif
432 if (in_syscall) { 387 if (in_syscall) {
433 regs->gr[31] = haddr; 388 regs->gr[31] = haddr;
434#ifdef __LP64__ 389#ifdef CONFIG_64BIT
435 if (!test_thread_flag(TIF_32BIT)) 390 if (!test_thread_flag(TIF_32BIT))
436 sigframe_size |= 1; 391 sigframe_size |= 1;
437#endif 392#endif
438 } else { 393 } else {
439 unsigned long psw = USER_PSW; 394 unsigned long psw = USER_PSW;
440#ifdef __LP64__ 395#ifdef CONFIG_64BIT
441 if (!test_thread_flag(TIF_32BIT)) 396 if (!test_thread_flag(TIF_32BIT))
442 psw |= PSW_W; 397 psw |= PSW_W;
443#endif 398#endif
@@ -462,7 +417,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
462 regs->gr[2] = rp; /* userland return pointer */ 417 regs->gr[2] = rp; /* userland return pointer */
463 regs->gr[26] = sig; /* signal number */ 418 regs->gr[26] = sig; /* signal number */
464 419
465#ifdef __LP64__ 420#ifdef CONFIG_64BIT
466 if (is_compat_task()) { 421 if (is_compat_task()) {
467 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */ 422 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */
468 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */ 423 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */
@@ -516,6 +471,97 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
516 return 1; 471 return 1;
517} 472}
518 473
474static inline void
475syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
476{
477 /* Check the return code */
478 switch (regs->gr[28]) {
479 case -ERESTART_RESTARTBLOCK:
480 current_thread_info()->restart_block.fn =
481 do_no_restart_syscall;
482 case -ERESTARTNOHAND:
483 DBG(1,"ERESTARTNOHAND: returning -EINTR\n");
484 regs->gr[28] = -EINTR;
485 break;
486
487 case -ERESTARTSYS:
488 if (!(ka->sa.sa_flags & SA_RESTART)) {
489 DBG(1,"ERESTARTSYS: putting -EINTR\n");
490 regs->gr[28] = -EINTR;
491 break;
492 }
493 /* fallthrough */
494 case -ERESTARTNOINTR:
495 /* A syscall is just a branch, so all
496 * we have to do is fiddle the return pointer.
497 */
498 regs->gr[31] -= 8; /* delayed branching */
499 /* Preserve original r28. */
500 regs->gr[28] = regs->orig_r28;
501 break;
502 }
503}
504
505static inline void
506insert_restart_trampoline(struct pt_regs *regs)
507{
508 switch(regs->gr[28]) {
509 case -ERESTART_RESTARTBLOCK: {
510 /* Restart the system call - no handlers present */
511 unsigned int *usp = (unsigned int *)regs->gr[30];
512
513 /* Setup a trampoline to restart the syscall
514 * with __NR_restart_syscall
515 *
516 * 0: <return address (orig r31)>
517 * 4: <2nd half for 64-bit>
518 * 8: ldw 0(%sp), %r31
519 * 12: be 0x100(%sr2, %r0)
520 * 16: ldi __NR_restart_syscall, %r20
521 */
522#ifdef CONFIG_64BIT
523 put_user(regs->gr[31] >> 32, &usp[0]);
524 put_user(regs->gr[31] & 0xffffffff, &usp[1]);
525 put_user(0x0fc010df, &usp[2]);
526#else
527 put_user(regs->gr[31], &usp[0]);
528 put_user(0x0fc0109f, &usp[2]);
529#endif
530 put_user(0xe0008200, &usp[3]);
531 put_user(0x34140000, &usp[4]);
532
533 /* Stack is 64-byte aligned, and we only need
534 * to flush 1 cache line.
535 * Flushing one cacheline is cheap.
536 * "sync" on bigger (> 4 way) boxes is not.
537 */
538 flush_icache_range(regs->gr[30], regs->gr[30] + 4);
539
540 regs->gr[31] = regs->gr[30] + 8;
541 /* Preserve original r28. */
542 regs->gr[28] = regs->orig_r28;
543
544 return;
545 }
546 case -ERESTARTNOHAND:
547 case -ERESTARTSYS:
548 case -ERESTARTNOINTR: {
549 /* Hooray for delayed branching. We don't
550 * have to restore %r20 (the system call
551 * number) because it gets loaded in the delay
552 * slot of the branch external instruction.
553 */
554 regs->gr[31] -= 8;
555 /* Preserve original r28. */
556 regs->gr[28] = regs->orig_r28;
557
558 return;
559 }
560 default:
561 break;
562 }
563}
564
519/* 565/*
520 * Note that 'init' is a special process: it doesn't get signals it doesn't 566 * Note that 'init' is a special process: it doesn't get signals it doesn't
521 * want to handle. Thus you cannot kill init even with a SIGKILL even by 567 * want to handle. Thus you cannot kill init even with a SIGKILL even by
@@ -527,13 +573,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
527 * registers). As noted below, the syscall number gets restored for 573 * registers). As noted below, the syscall number gets restored for
528 * us due to the magic of delayed branching. 574 * us due to the magic of delayed branching.
529 */ 575 */
530 576asmlinkage void
531asmlinkage int 577do_signal(struct pt_regs *regs, long in_syscall)
532do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
533{ 578{
534 siginfo_t info; 579 siginfo_t info;
535 struct k_sigaction ka; 580 struct k_sigaction ka;
536 int signr; 581 int signr;
582 sigset_t *oldset;
537 583
538 DBG(1,"\ndo_signal: oldset=0x%p, regs=0x%p, sr7 %#lx, in_syscall=%d\n", 584 DBG(1,"\ndo_signal: oldset=0x%p, regs=0x%p, sr7 %#lx, in_syscall=%d\n",
539 oldset, regs, regs->sr[7], in_syscall); 585 oldset, regs, regs->sr[7], in_syscall);
@@ -543,7 +589,9 @@ do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
543 we would be called in that case, but for some reason we 589 we would be called in that case, but for some reason we
544 are. */ 590 are. */
545 591
546 if (!oldset) 592 if (test_thread_flag(TIF_RESTORE_SIGMASK))
593 oldset = &current->saved_sigmask;
594 else
547 oldset = &current->blocked; 595 oldset = &current->blocked;
548 596
549 DBG(1,"do_signal: oldset %08lx / %08lx\n", 597 DBG(1,"do_signal: oldset %08lx / %08lx\n",
@@ -560,98 +608,41 @@ do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
560 break; 608 break;
561 609
562 /* Restart a system call if necessary. */ 610 /* Restart a system call if necessary. */
563 if (in_syscall) { 611 if (in_syscall)
564 /* Check the return code */ 612 syscall_restart(regs, &ka);
565 switch (regs->gr[28]) { 613
566 case -ERESTART_RESTARTBLOCK:
567 current_thread_info()->restart_block.fn = do_no_restart_syscall;
568 case -ERESTARTNOHAND:
569 DBG(1,"ERESTARTNOHAND: returning -EINTR\n");
570 regs->gr[28] = -EINTR;
571 break;
572
573 case -ERESTARTSYS:
574 if (!(ka.sa.sa_flags & SA_RESTART)) {
575 DBG(1,"ERESTARTSYS: putting -EINTR\n");
576 regs->gr[28] = -EINTR;
577 break;
578 }
579 /* fallthrough */
580 case -ERESTARTNOINTR:
581 /* A syscall is just a branch, so all
582 we have to do is fiddle the return pointer. */
583 regs->gr[31] -= 8; /* delayed branching */
584 /* Preserve original r28. */
585 regs->gr[28] = regs->orig_r28;
586 break;
587 }
588 }
589 /* Whee! Actually deliver the signal. If the 614 /* Whee! Actually deliver the signal. If the
590 delivery failed, we need to continue to iterate in 615 delivery failed, we need to continue to iterate in
591 this loop so we can deliver the SIGSEGV... */ 616 this loop so we can deliver the SIGSEGV... */
592 if (handle_signal(signr, &info, &ka, oldset, regs, in_syscall)) { 617 if (handle_signal(signr, &info, &ka, oldset,
618 regs, in_syscall)) {
593 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", 619 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n",
594 regs->gr[28]); 620 regs->gr[28]);
595 return 1; 621 if (test_thread_flag(TIF_RESTORE_SIGMASK))
622 clear_thread_flag(TIF_RESTORE_SIGMASK);
623 return;
596 } 624 }
597 } 625 }
598 /* end of while(1) looping forever if we can't force a signal */ 626 /* end of while(1) looping forever if we can't force a signal */
599 627
600 /* Did we come from a system call? */ 628 /* Did we come from a system call? */
601 if (in_syscall) { 629 if (in_syscall)
602 /* Restart the system call - no handlers present */ 630 insert_restart_trampoline(regs);
603 if (regs->gr[28] == -ERESTART_RESTARTBLOCK) {
604 unsigned int *usp = (unsigned int *)regs->gr[30];
605
606 /* Setup a trampoline to restart the syscall
607 * with __NR_restart_syscall
608 *
609 * 0: <return address (orig r31)>
610 * 4: <2nd half for 64-bit>
611 * 8: ldw 0(%sp), %r31
612 * 12: be 0x100(%sr2, %r0)
613 * 16: ldi __NR_restart_syscall, %r20
614 */
615#ifndef __LP64__
616 put_user(regs->gr[31], &usp[0]);
617 put_user(0x0fc0109f, &usp[2]);
618#else
619 put_user(regs->gr[31] >> 32, &usp[0]);
620 put_user(regs->gr[31] & 0xffffffff, &usp[1]);
621 put_user(0x0fc010df, &usp[2]);
622#endif
623 put_user(0xe0008200, &usp[3]);
624 put_user(0x34140000, &usp[4]);
625
626 /* Stack is 64-byte aligned, and we only need
627 * to flush 1 cache line.
628 * Flushing one cacheline is cheap.
629 * "sync" on bigger (> 4 way) boxes is not.
630 */
631 asm("fdc %%r0(%%sr3, %0)\n"
632 "sync\n"
633 "fic %%r0(%%sr3, %0)\n"
634 "sync\n"
635 : : "r"(regs->gr[30]));
636
637 regs->gr[31] = regs->gr[30] + 8;
638 /* Preserve original r28. */
639 regs->gr[28] = regs->orig_r28;
640 } else if (regs->gr[28] == -ERESTARTNOHAND ||
641 regs->gr[28] == -ERESTARTSYS ||
642 regs->gr[28] == -ERESTARTNOINTR) {
643 /* Hooray for delayed branching. We don't
644 have to restore %r20 (the system call
645 number) because it gets loaded in the delay
646 slot of the branch external instruction. */
647 regs->gr[31] -= 8;
648 /* Preserve original r28. */
649 regs->gr[28] = regs->orig_r28;
650 }
651 }
652 631
653 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n", 632 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n",
654 regs->gr[28]); 633 regs->gr[28]);
655 634
656 return 0; 635 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
636 clear_thread_flag(TIF_RESTORE_SIGMASK);
637 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
638 }
639
640 return;
641}
642
643void do_notify_resume(struct pt_regs *regs, long in_syscall)
644{
645 if (test_thread_flag(TIF_SIGPENDING) ||
646 test_thread_flag(TIF_RESTORE_SIGMASK))
647 do_signal(regs, in_syscall);
657} 648}
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index a6b4231cafa1..1c1a37f73053 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -1,6 +1,8 @@
1/* Signal support for 32-bit kernel builds 1/* Signal support for 32-bit kernel builds
2 * 2 *
3 * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org> 3 * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org>
4 * Copyright (C) 2006 Kyle McMartin <kyle at parisc-linux.org>
5 *
4 * Code was mostly borrowed from kernel/signal.c. 6 * Code was mostly borrowed from kernel/signal.c.
5 * See kernel/signal.c for additional Copyrights. 7 * See kernel/signal.c for additional Copyrights.
6 * 8 *
@@ -401,7 +403,7 @@ setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __
401int 403int
402copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from) 404copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
403{ 405{
404 unsigned long tmp; 406 compat_uptr_t addr;
405 int err; 407 int err;
406 408
407 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) 409 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t)))
@@ -424,8 +426,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
424 err |= __get_user(to->si_uid, &from->si_uid); 426 err |= __get_user(to->si_uid, &from->si_uid);
425 break; 427 break;
426 case __SI_FAULT >> 16: 428 case __SI_FAULT >> 16:
427 err |= __get_user(tmp, &from->si_addr); 429 err |= __get_user(addr, &from->si_addr);
428 to->si_addr = (void __user *) tmp; 430 to->si_addr = compat_ptr(addr);
429 break; 431 break;
430 case __SI_POLL >> 16: 432 case __SI_POLL >> 16:
431 err |= __get_user(to->si_band, &from->si_band); 433 err |= __get_user(to->si_band, &from->si_band);
@@ -445,7 +447,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
445int 447int
446copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from) 448copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
447{ 449{
448 unsigned int addr; 450 compat_uptr_t addr;
451 compat_int_t val;
449 int err; 452 int err;
450 453
451 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) 454 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
@@ -474,8 +477,8 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
474 err |= __put_user(from->si_uid, &to->si_uid); 477 err |= __put_user(from->si_uid, &to->si_uid);
475 break; 478 break;
476 case __SI_FAULT >> 16: 479 case __SI_FAULT >> 16:
477 /* avoid type-checking warnings by copying _pad[0] in lieu of si_addr... */ 480 addr = ptr_to_compat(from->si_addr);
478 err |= __put_user(from->_sifields._pad[0], &to->si_addr); 481 err |= __put_user(addr, &to->si_addr);
479 break; 482 break;
480 case __SI_POLL >> 16: 483 case __SI_POLL >> 16:
481 err |= __put_user(from->si_band, &to->si_band); 484 err |= __put_user(from->si_band, &to->si_band);
@@ -484,17 +487,36 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
484 case __SI_TIMER >> 16: 487 case __SI_TIMER >> 16:
485 err |= __put_user(from->si_tid, &to->si_tid); 488 err |= __put_user(from->si_tid, &to->si_tid);
486 err |= __put_user(from->si_overrun, &to->si_overrun); 489 err |= __put_user(from->si_overrun, &to->si_overrun);
487 addr = (unsigned long) from->si_ptr; 490 val = (compat_int_t)from->si_int;
488 err |= __put_user(addr, &to->si_ptr); 491 err |= __put_user(val, &to->si_int);
489 break; 492 break;
490 case __SI_RT >> 16: /* Not generated by the kernel as of now. */ 493 case __SI_RT >> 16: /* Not generated by the kernel as of now. */
491 case __SI_MESGQ >> 16: 494 case __SI_MESGQ >> 16:
492 err |= __put_user(from->si_uid, &to->si_uid); 495 err |= __put_user(from->si_uid, &to->si_uid);
493 err |= __put_user(from->si_pid, &to->si_pid); 496 err |= __put_user(from->si_pid, &to->si_pid);
494 addr = (unsigned long) from->si_ptr; 497 val = (compat_int_t)from->si_int;
495 err |= __put_user(addr, &to->si_ptr); 498 err |= __put_user(val, &to->si_int);
496 break; 499 break;
497 } 500 }
498 } 501 }
499 return err; 502 return err;
500} 503}
504
505asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
506 struct compat_siginfo __user *uinfo)
507{
508 siginfo_t info;
509
510 if (copy_siginfo_from_user32(&info, uinfo))
511 return -EFAULT;
512
513 /* Not even root can pretend to send signals from the kernel.
514 Nor can they impersonate a kill(), which adds source info. */
515 if (info.si_code >= 0)
516 return -EPERM;
517 info.si_signo = sig;
518
519 /* POSIX.1b doesn't mention process groups. */
520 return kill_proc_info(sig, &info, pid);
521}
522
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 12cc019307ad..6ba9257fdb7f 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -16,9 +16,6 @@
16** the Free Software Foundation; either version 2 of the License, or 16** the Free Software Foundation; either version 2 of the License, or
17** (at your option) any later version. 17** (at your option) any later version.
18*/ 18*/
19#undef ENTRY_SYS_CPUS /* syscall support for iCOD-like functionality */
20
21
22#include <linux/types.h> 19#include <linux/types.h>
23#include <linux/spinlock.h> 20#include <linux/spinlock.h>
24#include <linux/slab.h> 21#include <linux/slab.h>
@@ -51,7 +48,15 @@
51#include <asm/unistd.h> 48#include <asm/unistd.h>
52#include <asm/cacheflush.h> 49#include <asm/cacheflush.h>
53 50
54#define kDEBUG 0 51#undef DEBUG_SMP
52#ifdef DEBUG_SMP
53static int smp_debug_lvl = 0;
54#define smp_debug(lvl, printargs...) \
55 if (lvl >= smp_debug_lvl) \
56 printk(printargs);
57#else
58#define smp_debug(lvl, ...)
59#endif /* DEBUG_SMP */
55 60
56DEFINE_SPINLOCK(smp_lock); 61DEFINE_SPINLOCK(smp_lock);
57 62
@@ -76,6 +81,7 @@ cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CP
76EXPORT_SYMBOL(cpu_online_map); 81EXPORT_SYMBOL(cpu_online_map);
77EXPORT_SYMBOL(cpu_possible_map); 82EXPORT_SYMBOL(cpu_possible_map);
78 83
84DEFINE_PER_CPU(spinlock_t, ipi_lock) = SPIN_LOCK_UNLOCKED;
79 85
80struct smp_call_struct { 86struct smp_call_struct {
81 void (*func) (void *info); 87 void (*func) (void *info);
@@ -107,13 +113,6 @@ enum ipi_message_type {
107static void 113static void
108ipi_init(int cpuid) 114ipi_init(int cpuid)
109{ 115{
110
111 /* If CPU is present ... */
112#ifdef ENTRY_SYS_CPUS
113 /* *and* running (not stopped) ... */
114#error iCOD support wants state checked here.
115#endif
116
117#error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region 116#error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region
118 117
119 if(cpu_online(cpuid) ) 118 if(cpu_online(cpuid) )
@@ -133,23 +132,12 @@ ipi_init(int cpuid)
133static void 132static void
134halt_processor(void) 133halt_processor(void)
135{ 134{
136#ifdef ENTRY_SYS_CPUS
137#error halt_processor() needs rework
138/*
139** o migrate I/O interrupts off this CPU.
140** o leave IPI enabled - __cli() will disable IPI.
141** o leave CPU in online map - just change the state
142*/
143 cpu_data[this_cpu].state = STATE_STOPPED;
144 mark_bh(IPI_BH);
145#else
146 /* REVISIT : redirect I/O Interrupts to another CPU? */ 135 /* REVISIT : redirect I/O Interrupts to another CPU? */
147 /* REVISIT : does PM *know* this CPU isn't available? */ 136 /* REVISIT : does PM *know* this CPU isn't available? */
148 cpu_clear(smp_processor_id(), cpu_online_map); 137 cpu_clear(smp_processor_id(), cpu_online_map);
149 local_irq_disable(); 138 local_irq_disable();
150 for (;;) 139 for (;;)
151 ; 140 ;
152#endif
153} 141}
154 142
155 143
@@ -167,10 +155,11 @@ ipi_interrupt(int irq, void *dev_id)
167 mb(); /* Order interrupt and bit testing. */ 155 mb(); /* Order interrupt and bit testing. */
168 156
169 for (;;) { 157 for (;;) {
170 spin_lock_irqsave(&(p->lock),flags); 158 spinlock_t *lock = &per_cpu(ipi_lock, this_cpu);
159 spin_lock_irqsave(lock, flags);
171 ops = p->pending_ipi; 160 ops = p->pending_ipi;
172 p->pending_ipi = 0; 161 p->pending_ipi = 0;
173 spin_unlock_irqrestore(&(p->lock),flags); 162 spin_unlock_irqrestore(lock, flags);
174 163
175 mb(); /* Order bit clearing and data access. */ 164 mb(); /* Order bit clearing and data access. */
176 165
@@ -184,15 +173,11 @@ ipi_interrupt(int irq, void *dev_id)
184 173
185 switch (which) { 174 switch (which) {
186 case IPI_NOP: 175 case IPI_NOP:
187#if (kDEBUG>=100) 176 smp_debug(100, KERN_DEBUG "CPU%d IPI_NOP\n", this_cpu);
188 printk(KERN_DEBUG "CPU%d IPI_NOP\n",this_cpu);
189#endif /* kDEBUG */
190 break; 177 break;
191 178
192 case IPI_RESCHEDULE: 179 case IPI_RESCHEDULE:
193#if (kDEBUG>=100) 180 smp_debug(100, KERN_DEBUG "CPU%d IPI_RESCHEDULE\n", this_cpu);
194 printk(KERN_DEBUG "CPU%d IPI_RESCHEDULE\n",this_cpu);
195#endif /* kDEBUG */
196 /* 181 /*
197 * Reschedule callback. Everything to be 182 * Reschedule callback. Everything to be
198 * done is done by the interrupt return path. 183 * done is done by the interrupt return path.
@@ -200,9 +185,7 @@ ipi_interrupt(int irq, void *dev_id)
200 break; 185 break;
201 186
202 case IPI_CALL_FUNC: 187 case IPI_CALL_FUNC:
203#if (kDEBUG>=100) 188 smp_debug(100, KERN_DEBUG "CPU%d IPI_CALL_FUNC\n", this_cpu);
204 printk(KERN_DEBUG "CPU%d IPI_CALL_FUNC\n",this_cpu);
205#endif /* kDEBUG */
206 { 189 {
207 volatile struct smp_call_struct *data; 190 volatile struct smp_call_struct *data;
208 void (*func)(void *info); 191 void (*func)(void *info);
@@ -233,28 +216,16 @@ ipi_interrupt(int irq, void *dev_id)
233 break; 216 break;
234 217
235 case IPI_CPU_START: 218 case IPI_CPU_START:
236#if (kDEBUG>=100) 219 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_START\n", this_cpu);
237 printk(KERN_DEBUG "CPU%d IPI_CPU_START\n",this_cpu);
238#endif /* kDEBUG */
239#ifdef ENTRY_SYS_CPUS
240 p->state = STATE_RUNNING;
241#endif
242 break; 220 break;
243 221
244 case IPI_CPU_STOP: 222 case IPI_CPU_STOP:
245#if (kDEBUG>=100) 223 smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_STOP\n", this_cpu);
246 printk(KERN_DEBUG "CPU%d IPI_CPU_STOP\n",this_cpu);
247#endif /* kDEBUG */
248#ifdef ENTRY_SYS_CPUS
249#else
250 halt_processor(); 224 halt_processor();
251#endif
252 break; 225 break;
253 226
254 case IPI_CPU_TEST: 227 case IPI_CPU_TEST:
255#if (kDEBUG>=100) 228 smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);
256 printk(KERN_DEBUG "CPU%d is alive!\n",this_cpu);
257#endif /* kDEBUG */
258 break; 229 break;
259 230
260 default: 231 default:
@@ -275,12 +246,13 @@ static inline void
275ipi_send(int cpu, enum ipi_message_type op) 246ipi_send(int cpu, enum ipi_message_type op)
276{ 247{
277 struct cpuinfo_parisc *p = &cpu_data[cpu]; 248 struct cpuinfo_parisc *p = &cpu_data[cpu];
249 spinlock_t *lock = &per_cpu(ipi_lock, cpu);
278 unsigned long flags; 250 unsigned long flags;
279 251
280 spin_lock_irqsave(&(p->lock),flags); 252 spin_lock_irqsave(lock, flags);
281 p->pending_ipi |= 1 << op; 253 p->pending_ipi |= 1 << op;
282 gsc_writel(IPI_IRQ - CPU_IRQ_BASE, cpu_data[cpu].hpa); 254 gsc_writel(IPI_IRQ - CPU_IRQ_BASE, cpu_data[cpu].hpa);
283 spin_unlock_irqrestore(&(p->lock),flags); 255 spin_unlock_irqrestore(lock, flags);
284} 256}
285 257
286 258
@@ -560,13 +532,8 @@ int __init smp_boot_one_cpu(int cpuid)
560 532
561alive: 533alive:
562 /* Remember the Slave data */ 534 /* Remember the Slave data */
563#if (kDEBUG>=100) 535 smp_debug(100, KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
564 printk(KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
565 cpuid, timeout * 100); 536 cpuid, timeout * 100);
566#endif /* kDEBUG */
567#ifdef ENTRY_SYS_CPUS
568 cpu_data[cpuid].state = STATE_RUNNING;
569#endif
570 return 0; 537 return 0;
571} 538}
572 539
@@ -574,10 +541,6 @@ void __devinit smp_prepare_boot_cpu(void)
574{ 541{
575 int bootstrap_processor=cpu_data[0].cpuid; /* CPU ID of BSP */ 542 int bootstrap_processor=cpu_data[0].cpuid; /* CPU ID of BSP */
576 543
577#ifdef ENTRY_SYS_CPUS
578 cpu_data[0].state = STATE_RUNNING;
579#endif
580
581 /* Setup BSP mappings */ 544 /* Setup BSP mappings */
582 printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor); 545 printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
583 546
@@ -616,101 +579,6 @@ int __cpuinit __cpu_up(unsigned int cpu)
616 return cpu_online(cpu) ? 0 : -ENOSYS; 579 return cpu_online(cpu) ? 0 : -ENOSYS;
617} 580}
618 581
619
620
621#ifdef ENTRY_SYS_CPUS
622/* Code goes along with:
623** entry.s: ENTRY_NAME(sys_cpus) / * 215, for cpu stat * /
624*/
625int sys_cpus(int argc, char **argv)
626{
627 int i,j=0;
628 extern int current_pid(int cpu);
629
630 if( argc > 2 ) {
631 printk("sys_cpus:Only one argument supported\n");
632 return (-1);
633 }
634 if ( argc == 1 ){
635
636#ifdef DUMP_MORE_STATE
637 for_each_online_cpu(i) {
638 int cpus_per_line = 4;
639
640 if (j++ % cpus_per_line)
641 printk(" %3d",i);
642 else
643 printk("\n %3d",i);
644 }
645 printk("\n");
646#else
647 printk("\n 0\n");
648#endif
649 } else if((argc==2) && !(strcmp(argv[1],"-l"))) {
650 printk("\nCPUSTATE TASK CPUNUM CPUID HARDCPU(HPA)\n");
651#ifdef DUMP_MORE_STATE
652 for_each_online_cpu(i) {
653 if (cpu_data[i].cpuid != NO_PROC_ID) {
654 switch(cpu_data[i].state) {
655 case STATE_RENDEZVOUS:
656 printk("RENDEZVS ");
657 break;
658 case STATE_RUNNING:
659 printk((current_pid(i)!=0) ? "RUNNING " : "IDLING ");
660 break;
661 case STATE_STOPPED:
662 printk("STOPPED ");
663 break;
664 case STATE_HALTED:
665 printk("HALTED ");
666 break;
667 default:
668 printk("%08x?", cpu_data[i].state);
669 break;
670 }
671 if(cpu_online(i)) {
672 printk(" %4d",current_pid(i));
673 }
674 printk(" %6d",cpu_number_map(i));
675 printk(" %5d",i);
676 printk(" 0x%lx\n",cpu_data[i].hpa);
677 }
678 }
679#else
680 printk("\n%s %4d 0 0 --------",
681 (current->pid)?"RUNNING ": "IDLING ",current->pid);
682#endif
683 } else if ((argc==2) && !(strcmp(argv[1],"-s"))) {
684#ifdef DUMP_MORE_STATE
685 printk("\nCPUSTATE CPUID\n");
686 for_each_online_cpu(i) {
687 if (cpu_data[i].cpuid != NO_PROC_ID) {
688 switch(cpu_data[i].state) {
689 case STATE_RENDEZVOUS:
690 printk("RENDEZVS");break;
691 case STATE_RUNNING:
692 printk((current_pid(i)!=0) ? "RUNNING " : "IDLING");
693 break;
694 case STATE_STOPPED:
695 printk("STOPPED ");break;
696 case STATE_HALTED:
697 printk("HALTED ");break;
698 default:
699 }
700 printk(" %5d\n",i);
701 }
702 }
703#else
704 printk("\n%s CPU0",(current->pid==0)?"RUNNING ":"IDLING ");
705#endif
706 } else {
707 printk("sys_cpus:Unknown request\n");
708 return (-1);
709 }
710 return 0;
711}
712#endif /* ENTRY_SYS_CPUS */
713
714#ifdef CONFIG_PROC_FS 582#ifdef CONFIG_PROC_FS
715int __init 583int __init
716setup_profiling_timer(unsigned int multiplier) 584setup_profiling_timer(unsigned int multiplier)
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index a05800429304..10859f53e94f 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -12,27 +12,23 @@
12#include <asm/errno.h> 12#include <asm/errno.h>
13#include <asm/psw.h> 13#include <asm/psw.h>
14#include <asm/thread_info.h> 14#include <asm/thread_info.h>
15
16#include <asm/assembly.h> 15#include <asm/assembly.h>
17#include <asm/processor.h> 16#include <asm/processor.h>
18 17
18#include <linux/linkage.h>
19
19 /* We fill the empty parts of the gateway page with 20 /* We fill the empty parts of the gateway page with
20 * something that will kill the kernel or a 21 * something that will kill the kernel or a
21 * userspace application. 22 * userspace application.
22 */ 23 */
23#define KILL_INSN break 0,0 24#define KILL_INSN break 0,0
24 25
25#ifdef CONFIG_64BIT 26 .level LEVEL
26 .level 2.0w
27#else
28 .level 1.1
29#endif
30 27
31 .text 28 .text
32 29
33 .import syscall_exit,code 30 .import syscall_exit,code
34 .import syscall_exit_rfi,code 31 .import syscall_exit_rfi,code
35 .export linux_gateway_page
36 32
37 /* Linux gateway page is aliased to virtual page 0 in the kernel 33 /* Linux gateway page is aliased to virtual page 0 in the kernel
38 * address space. Since it is a gateway page it cannot be 34 * address space. Since it is a gateway page it cannot be
@@ -43,7 +39,7 @@
43 */ 39 */
44 40
45 .align ASM_PAGE_SIZE 41 .align ASM_PAGE_SIZE
46linux_gateway_page: 42ENTRY(linux_gateway_page)
47 43
48 /* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */ 44 /* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */
49 .rept 44 45 .rept 44
@@ -595,73 +591,43 @@ cas_action:
595 the other for the store. Either return -EFAULT. 591 the other for the store. Either return -EFAULT.
596 Each of the entries must be relocated. */ 592 Each of the entries must be relocated. */
597 .section __ex_table,"aw" 593 .section __ex_table,"aw"
598#ifdef CONFIG_64BIT 594 ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page)
599 /* Pad the address calculation */ 595 ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page)
600 .word 0,(2b - linux_gateway_page)
601 .word 0,(3b - linux_gateway_page)
602#else
603 .word (2b - linux_gateway_page)
604 .word (3b - linux_gateway_page)
605#endif
606 .previous 596 .previous
607 597
608 .section __ex_table,"aw"
609#ifdef CONFIG_64BIT
610 /* Pad the address calculation */
611 .word 0,(1b - linux_gateway_page)
612 .word 0,(3b - linux_gateway_page)
613#else
614 .word (1b - linux_gateway_page)
615 .word (3b - linux_gateway_page)
616#endif
617 .previous
618
619end_compare_and_swap:
620 598
621 /* Make sure nothing else is placed on this page */ 599 /* Make sure nothing else is placed on this page */
622 .align ASM_PAGE_SIZE 600 .align ASM_PAGE_SIZE
623 .export end_linux_gateway_page 601END(linux_gateway_page)
624end_linux_gateway_page: 602ENTRY(end_linux_gateway_page)
625 603
626 /* Relocate symbols assuming linux_gateway_page is mapped 604 /* Relocate symbols assuming linux_gateway_page is mapped
627 to virtual address 0x0 */ 605 to virtual address 0x0 */
628#ifdef CONFIG_64BIT 606
629 /* FIXME: The code will always be on the gateay page 607#define LWS_ENTRY(_name_) ASM_ULONG_INSN (lws_##_name_ - linux_gateway_page)
630 and thus it will be on the first 4k, the
631 assembler seems to think that the final
632 subtraction result is only a word in
633 length, so we pad the value.
634 */
635#define LWS_ENTRY(_name_) .word 0,(lws_##_name_ - linux_gateway_page)
636#else
637#define LWS_ENTRY(_name_) .word (lws_##_name_ - linux_gateway_page)
638#endif
639 608
640 .section .rodata,"a" 609 .section .rodata,"a"
641 610
642 .align ASM_PAGE_SIZE 611 .align ASM_PAGE_SIZE
643 /* Light-weight-syscall table */ 612 /* Light-weight-syscall table */
644 /* Start of lws table. */ 613 /* Start of lws table. */
645 .export lws_table 614ENTRY(lws_table)
646.Llws_table:
647lws_table:
648 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ 615 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */
649 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ 616 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */
617END(lws_table)
650 /* End of lws table */ 618 /* End of lws table */
651 619
652 .align ASM_PAGE_SIZE 620 .align ASM_PAGE_SIZE
653 .export sys_call_table 621ENTRY(sys_call_table)
654.Lsys_call_table:
655sys_call_table:
656#include "syscall_table.S" 622#include "syscall_table.S"
623END(sys_call_table)
657 624
658#ifdef CONFIG_64BIT 625#ifdef CONFIG_64BIT
659 .align ASM_PAGE_SIZE 626 .align ASM_PAGE_SIZE
660 .export sys_call_table64 627ENTRY(sys_call_table64)
661.Lsys_call_table64:
662sys_call_table64:
663#define SYSCALL_TABLE_64BIT 628#define SYSCALL_TABLE_64BIT
664#include "syscall_table.S" 629#include "syscall_table.S"
630END(sys_call_table64)
665#endif 631#endif
666 632
667#ifdef CONFIG_SMP 633#ifdef CONFIG_SMP
@@ -671,9 +637,7 @@ sys_call_table64:
671 */ 637 */
672 .section .data 638 .section .data
673 .align 4096 639 .align 4096
674 .export lws_lock_start 640ENTRY(lws_lock_start)
675.Llws_lock_start:
676lws_lock_start:
677 /* lws locks */ 641 /* lws locks */
678 .align 16 642 .align 16
679 .rept 16 643 .rept 16
@@ -683,6 +647,7 @@ lws_lock_start:
683 .word 0 647 .word 0
684 .word 0 648 .word 0
685 .endr 649 .endr
650END(lws_lock_start)
686 .previous 651 .previous
687#endif 652#endif
688/* CONFIG_SMP for lws_lock_start */ 653/* CONFIG_SMP for lws_lock_start */
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index be8eb9a0d24a..8bf87e5d9c37 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -10,7 +10,7 @@
10 * Copyright (C) 2000 Grant Grundler <grundler at parisc-linux.org> 10 * Copyright (C) 2000 Grant Grundler <grundler at parisc-linux.org>
11 * Copyright (C) 2001 Richard Hirst <rhirst with parisc-linux.org> 11 * Copyright (C) 2001 Richard Hirst <rhirst with parisc-linux.org>
12 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 12 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
13 * Copyright (C) 2001 Helge Deller <deller at parisc-linux.org> 13 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
14 * Copyright (C) 2000-2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 14 * Copyright (C) 2000-2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
15 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 15 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
16 * Copyright (C) 2005-2006 Kyle McMartin <kyle at parisc-linux.org> 16 * Copyright (C) 2005-2006 Kyle McMartin <kyle at parisc-linux.org>
@@ -282,8 +282,8 @@
282 * to worry about faulting trying to copy in a larger 64-bit 282 * to worry about faulting trying to copy in a larger 64-bit
283 * struct from a 32-bit user-space app. 283 * struct from a 32-bit user-space app.
284 */ 284 */
285 ENTRY_SAME(rt_sigqueueinfo) 285 ENTRY_COMP(rt_sigqueueinfo)
286 ENTRY_SAME(rt_sigsuspend_wrapper) /* not really SAME -- see the code */ 286 ENTRY_COMP(rt_sigsuspend)
287 ENTRY_SAME(chown) /* 180 */ 287 ENTRY_SAME(chown) /* 180 */
288 /* setsockopt() used by iptables: SO_SET_REPLACE/SO_SET_ADD_COUNTERS */ 288 /* setsockopt() used by iptables: SO_SET_REPLACE/SO_SET_ADD_COUNTERS */
289 ENTRY_COMP(setsockopt) 289 ENTRY_COMP(setsockopt)
@@ -377,9 +377,9 @@
377 ENTRY_SAME(inotify_init) 377 ENTRY_SAME(inotify_init)
378 ENTRY_SAME(inotify_add_watch) /* 270 */ 378 ENTRY_SAME(inotify_add_watch) /* 270 */
379 ENTRY_SAME(inotify_rm_watch) 379 ENTRY_SAME(inotify_rm_watch)
380 ENTRY_SAME(ni_syscall) /* 271 ENTRY_COMP(pselect6) */
381 ENTRY_SAME(ni_syscall) /* 272 ENTRY_COMP(ppoll) */
382 ENTRY_SAME(migrate_pages) 380 ENTRY_SAME(migrate_pages)
381 ENTRY_COMP(pselect6)
382 ENTRY_COMP(ppoll)
383 ENTRY_COMP(openat) /* 275 */ 383 ENTRY_COMP(openat) /* 275 */
384 ENTRY_SAME(mkdirat) 384 ENTRY_SAME(mkdirat)
385 ENTRY_SAME(mknodat) 385 ENTRY_SAME(mknodat)
@@ -399,5 +399,11 @@
399 ENTRY_SAME(splice) 399 ENTRY_SAME(splice)
400 ENTRY_OURS(sync_file_range) 400 ENTRY_OURS(sync_file_range)
401 ENTRY_SAME(tee) 401 ENTRY_SAME(tee)
402 ENTRY_COMP(vmsplice)
403 ENTRY_COMP(move_pages) /* 295 */
404 ENTRY_SAME(getcpu)
405 ENTRY_SAME(epoll_pwait)
406 ENTRY_COMP(statfs64)
407 ENTRY_COMP(fstatfs64)
402 /* Nothing yet */ 408 /* Nothing yet */
403 409
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 5f1b51af06a9..d1db8e518654 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/smp.h> 23#include <linux/smp.h>
24#include <linux/profile.h> 24#include <linux/profile.h>
25#include <linux/clocksource.h>
25 26
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/io.h> 28#include <asm/io.h>
@@ -98,7 +99,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
98 * cycles after the IT fires. But it's arbitrary how much time passes 99 * cycles after the IT fires. But it's arbitrary how much time passes
99 * before we call it "late". I've picked one second. 100 * before we call it "late". I've picked one second.
100 */ 101 */
101 if (ticks_elapsed > HZ) { 102 if (unlikely(ticks_elapsed > HZ)) {
102 /* Scenario 3: very long delay? bad in any case */ 103 /* Scenario 3: very long delay? bad in any case */
103 printk (KERN_CRIT "timer_interrupt(CPU %d): delayed!" 104 printk (KERN_CRIT "timer_interrupt(CPU %d): delayed!"
104 " cycles %lX rem %lX " 105 " cycles %lX rem %lX "
@@ -147,10 +148,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
147 write_sequnlock(&xtime_lock); 148 write_sequnlock(&xtime_lock);
148 } 149 }
149 150
150 /* check soft power switch status */
151 if (cpu == 0 && !atomic_read(&power_tasklet.count))
152 tasklet_schedule(&power_tasklet);
153
154 return IRQ_HANDLED; 151 return IRQ_HANDLED;
155} 152}
156 153
@@ -172,121 +169,41 @@ unsigned long profile_pc(struct pt_regs *regs)
172EXPORT_SYMBOL(profile_pc); 169EXPORT_SYMBOL(profile_pc);
173 170
174 171
175/* 172/* clock source code */
176 * Return the number of micro-seconds that elapsed since the last
177 * update to wall time (aka xtime). The xtime_lock
178 * must be at least read-locked when calling this routine.
179 */
180static inline unsigned long gettimeoffset (void)
181{
182#ifndef CONFIG_SMP
183 /*
184 * FIXME: This won't work on smp because jiffies are updated by cpu 0.
185 * Once parisc-linux learns the cr16 difference between processors,
186 * this could be made to work.
187 */
188 unsigned long now;
189 unsigned long prev_tick;
190 unsigned long next_tick;
191 unsigned long elapsed_cycles;
192 unsigned long usec;
193 unsigned long cpuid = smp_processor_id();
194 unsigned long cpt = clocktick;
195
196 next_tick = cpu_data[cpuid].it_value;
197 now = mfctl(16); /* Read the hardware interval timer. */
198 173
199 prev_tick = next_tick - cpt; 174static cycle_t read_cr16(void)
175{
176 return get_cycles();
177}
200 178
201 /* Assume Scenario 1: "now" is later than prev_tick. */ 179static int cr16_update_callback(void);
202 elapsed_cycles = now - prev_tick;
203 180
204/* aproximate HZ with shifts. Intended math is "(elapsed/clocktick) > HZ" */ 181static struct clocksource clocksource_cr16 = {
205#if HZ == 1000 182 .name = "cr16",
206 if (elapsed_cycles > (cpt << 10) ) 183 .rating = 300,
207#elif HZ == 250 184 .read = read_cr16,
208 if (elapsed_cycles > (cpt << 8) ) 185 .mask = CLOCKSOURCE_MASK(BITS_PER_LONG),
209#elif HZ == 100 186 .mult = 0, /* to be set */
210 if (elapsed_cycles > (cpt << 7) ) 187 .shift = 22,
211#else 188 .update_callback = cr16_update_callback,
212#warn WTF is HZ set to anyway? 189 .is_continuous = 1,
213 if (elapsed_cycles > (HZ * cpt) ) 190};
214#endif
215 {
216 /* Scenario 3: clock ticks are missing. */
217 printk (KERN_CRIT "gettimeoffset(CPU %ld): missing %ld ticks!"
218 " cycles %lX prev/now/next %lX/%lX/%lX clock %lX\n",
219 cpuid, elapsed_cycles / cpt,
220 elapsed_cycles, prev_tick, now, next_tick, cpt);
221 }
222 191
223 /* FIXME: Can we improve the precision? Not with PAGE0. */ 192static int cr16_update_callback(void)
224 usec = (elapsed_cycles * 10000) / PAGE0->mem_10msec;
225 return usec;
226#else
227 return 0;
228#endif
229}
230
231void
232do_gettimeofday (struct timeval *tv)
233{ 193{
234 unsigned long flags, seq, usec, sec; 194 int change = 0;
235 195
236 /* Hold xtime_lock and adjust timeval. */ 196 /* since the cr16 cycle counters are not syncronized across CPUs,
237 do { 197 we'll check if we should switch to a safe clocksource: */
238 seq = read_seqbegin_irqsave(&xtime_lock, flags); 198 if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) {
239 usec = gettimeoffset(); 199 clocksource_cr16.rating = 0;
240 sec = xtime.tv_sec; 200 clocksource_reselect();
241 usec += (xtime.tv_nsec / 1000); 201 change = 1;
242 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
243
244 /* Move adjusted usec's into sec's. */
245 while (usec >= USEC_PER_SEC) {
246 usec -= USEC_PER_SEC;
247 ++sec;
248 } 202 }
249 203
250 /* Return adjusted result. */ 204 return change;
251 tv->tv_sec = sec;
252 tv->tv_usec = usec;
253} 205}
254 206
255EXPORT_SYMBOL(do_gettimeofday);
256
257int
258do_settimeofday (struct timespec *tv)
259{
260 time_t wtm_sec, sec = tv->tv_sec;
261 long wtm_nsec, nsec = tv->tv_nsec;
262
263 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
264 return -EINVAL;
265
266 write_seqlock_irq(&xtime_lock);
267 {
268 /*
269 * This is revolting. We need to set "xtime"
270 * correctly. However, the value in this location is
271 * the value at the most recent update of wall time.
272 * Discover what correction gettimeofday would have
273 * done, and then undo it!
274 */
275 nsec -= gettimeoffset() * 1000;
276
277 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
278 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
279
280 set_normalized_timespec(&xtime, sec, nsec);
281 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
282
283 ntp_clear();
284 }
285 write_sequnlock_irq(&xtime_lock);
286 clock_was_set();
287 return 0;
288}
289EXPORT_SYMBOL(do_settimeofday);
290 207
291void __init start_cpu_itimer(void) 208void __init start_cpu_itimer(void)
292{ 209{
@@ -301,11 +218,18 @@ void __init start_cpu_itimer(void)
301void __init time_init(void) 218void __init time_init(void)
302{ 219{
303 static struct pdc_tod tod_data; 220 static struct pdc_tod tod_data;
221 unsigned long current_cr16_khz;
304 222
305 clocktick = (100 * PAGE0->mem_10msec) / HZ; 223 clocktick = (100 * PAGE0->mem_10msec) / HZ;
306 224
307 start_cpu_itimer(); /* get CPU 0 started */ 225 start_cpu_itimer(); /* get CPU 0 started */
308 226
227 /* register at clocksource framework */
228 current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */
229 clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz,
230 clocksource_cr16.shift);
231 clocksource_register(&clocksource_cr16);
232
309 if (pdc_tod_read(&tod_data) == 0) { 233 if (pdc_tod_read(&tod_data) == 0) {
310 unsigned long flags; 234 unsigned long flags;
311 235
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 65cd6ca32fed..55bc1471967d 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/kallsyms.h> 28#include <linux/kallsyms.h>
29#include <linux/bug.h>
29 30
30#include <asm/assembly.h> 31#include <asm/assembly.h>
31#include <asm/system.h> 32#include <asm/system.h>
@@ -39,6 +40,8 @@
39#include <asm/pdc.h> 40#include <asm/pdc.h>
40#include <asm/pdc_chassis.h> 41#include <asm/pdc_chassis.h>
41#include <asm/unwind.h> 42#include <asm/unwind.h>
43#include <asm/tlbflush.h>
44#include <asm/cacheflush.h>
42 45
43#include "../math-emu/math-emu.h" /* for handle_fpe() */ 46#include "../math-emu/math-emu.h" /* for handle_fpe() */
44 47
@@ -49,7 +52,7 @@
49DEFINE_SPINLOCK(pa_dbit_lock); 52DEFINE_SPINLOCK(pa_dbit_lock);
50#endif 53#endif
51 54
52int printbinary(char *buf, unsigned long x, int nbits) 55static int printbinary(char *buf, unsigned long x, int nbits)
53{ 56{
54 unsigned long mask = 1UL << (nbits - 1); 57 unsigned long mask = 1UL << (nbits - 1);
55 while (mask != 0) { 58 while (mask != 0) {
@@ -61,7 +64,7 @@ int printbinary(char *buf, unsigned long x, int nbits)
61 return nbits; 64 return nbits;
62} 65}
63 66
64#ifdef __LP64__ 67#ifdef CONFIG_64BIT
65#define RFMT "%016lx" 68#define RFMT "%016lx"
66#else 69#else
67#define RFMT "%08lx" 70#define RFMT "%08lx"
@@ -160,13 +163,13 @@ static void do_show_stack(struct unwind_frame_info *info)
160{ 163{
161 int i = 1; 164 int i = 1;
162 165
163 printk("Backtrace:\n"); 166 printk(KERN_CRIT "Backtrace:\n");
164 while (i <= 16) { 167 while (i <= 16) {
165 if (unwind_once(info) < 0 || info->ip == 0) 168 if (unwind_once(info) < 0 || info->ip == 0)
166 break; 169 break;
167 170
168 if (__kernel_text_address(info->ip)) { 171 if (__kernel_text_address(info->ip)) {
169 printk(" [<" RFMT ">] ", info->ip); 172 printk("%s [<" RFMT ">] ", (i&0x3)==1 ? KERN_CRIT : "", info->ip);
170#ifdef CONFIG_KALLSYMS 173#ifdef CONFIG_KALLSYMS
171 print_symbol("%s\n", info->ip); 174 print_symbol("%s\n", info->ip);
172#else 175#else
@@ -185,18 +188,19 @@ void show_stack(struct task_struct *task, unsigned long *s)
185 188
186 if (!task) { 189 if (!task) {
187 unsigned long sp; 190 unsigned long sp;
188 struct pt_regs *r;
189 191
190HERE: 192HERE:
191 asm volatile ("copy %%r30, %0" : "=r"(sp)); 193 asm volatile ("copy %%r30, %0" : "=r"(sp));
192 r = kzalloc(sizeof(struct pt_regs), GFP_KERNEL); 194 {
193 if (!r) 195 struct pt_regs r;
194 return; 196
195 r->iaoq[0] = (unsigned long)&&HERE; 197 memset(&r, 0, sizeof(struct pt_regs));
196 r->gr[2] = (unsigned long)__builtin_return_address(0); 198 r.iaoq[0] = (unsigned long)&&HERE;
197 r->gr[30] = sp; 199 r.gr[2] = (unsigned long)__builtin_return_address(0);
198 unwind_frame_init(&info, current, r); 200 r.gr[30] = sp;
199 kfree(r); 201
202 unwind_frame_init(&info, current, &r);
203 }
200 } else { 204 } else {
201 unwind_frame_init_from_blocked_task(&info, task); 205 unwind_frame_init_from_blocked_task(&info, task);
202 } 206 }
@@ -204,6 +208,11 @@ HERE:
204 do_show_stack(&info); 208 do_show_stack(&info);
205} 209}
206 210
211int is_valid_bugaddr(unsigned long iaoq)
212{
213 return 1;
214}
215
207void die_if_kernel(char *str, struct pt_regs *regs, long err) 216void die_if_kernel(char *str, struct pt_regs *regs, long err)
208{ 217{
209 if (user_mode(regs)) { 218 if (user_mode(regs)) {
@@ -222,15 +231,15 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
222 oops_in_progress = 1; 231 oops_in_progress = 1;
223 232
224 /* Amuse the user in a SPARC fashion */ 233 /* Amuse the user in a SPARC fashion */
225 printk( 234 if (err) printk(
226" _______________________________ \n" 235KERN_CRIT " _______________________________ \n"
227" < Your System ate a SPARC! Gah! >\n" 236KERN_CRIT " < Your System ate a SPARC! Gah! >\n"
228" ------------------------------- \n" 237KERN_CRIT " ------------------------------- \n"
229" \\ ^__^\n" 238KERN_CRIT " \\ ^__^\n"
230" \\ (xx)\\_______\n" 239KERN_CRIT " \\ (xx)\\_______\n"
231" (__)\\ )\\/\\\n" 240KERN_CRIT " (__)\\ )\\/\\\n"
232" U ||----w |\n" 241KERN_CRIT " U ||----w |\n"
233" || ||\n"); 242KERN_CRIT " || ||\n");
234 243
235 /* unlock the pdc lock if necessary */ 244 /* unlock the pdc lock if necessary */
236 pdc_emergency_unlock(); 245 pdc_emergency_unlock();
@@ -242,9 +251,20 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
242 if (!console_drivers) 251 if (!console_drivers)
243 pdc_console_restart(); 252 pdc_console_restart();
244 253
245 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n", 254 if (err)
246 current->comm, current->pid, str, err); 255 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
256 current->comm, current->pid, str, err);
257
258 /* Wot's wrong wif bein' racy? */
259 if (current->thread.flags & PARISC_KERNEL_DEATH) {
260 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__);
261 local_irq_enable();
262 while (1);
263 }
264 current->thread.flags |= PARISC_KERNEL_DEATH;
265
247 show_regs(regs); 266 show_regs(regs);
267 dump_stack();
248 268
249 if (in_interrupt()) 269 if (in_interrupt())
250 panic("Fatal exception in interrupt"); 270 panic("Fatal exception in interrupt");
@@ -255,14 +275,6 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
255 panic("Fatal exception"); 275 panic("Fatal exception");
256 } 276 }
257 277
258 /* Wot's wrong wif bein' racy? */
259 if (current->thread.flags & PARISC_KERNEL_DEATH) {
260 printk(KERN_CRIT "%s() recursion detected.\n", __FUNCTION__);
261 local_irq_enable();
262 while (1);
263 }
264
265 current->thread.flags |= PARISC_KERNEL_DEATH;
266 do_exit(SIGSEGV); 278 do_exit(SIGSEGV);
267} 279}
268 280
@@ -273,61 +285,45 @@ int syscall_ipi(int (*syscall) (struct pt_regs *), struct pt_regs *regs)
273 285
274/* gdb uses break 4,8 */ 286/* gdb uses break 4,8 */
275#define GDB_BREAK_INSN 0x10004 287#define GDB_BREAK_INSN 0x10004
276void handle_gdb_break(struct pt_regs *regs, int wot) 288static void handle_gdb_break(struct pt_regs *regs, int wot)
277{ 289{
278 struct siginfo si; 290 struct siginfo si;
279 291
280 si.si_code = wot;
281 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
282 si.si_signo = SIGTRAP; 292 si.si_signo = SIGTRAP;
283 si.si_errno = 0; 293 si.si_errno = 0;
294 si.si_code = wot;
295 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
284 force_sig_info(SIGTRAP, &si, current); 296 force_sig_info(SIGTRAP, &si, current);
285} 297}
286 298
287void handle_break(unsigned iir, struct pt_regs *regs) 299static void handle_break(struct pt_regs *regs)
288{ 300{
289 struct siginfo si; 301 unsigned iir = regs->iir;
290 302
291 switch(iir) { 303 if (unlikely(iir == PARISC_BUG_BREAK_INSN && !user_mode(regs))) {
292 case 0x00: 304 /* check if a BUG() or WARN() trapped here. */
293#ifdef PRINT_USER_FAULTS 305 enum bug_trap_type tt;
294 printk(KERN_DEBUG "break 0,0: pid=%d command='%s'\n", 306 tt = report_bug(regs->iaoq[0] & ~3);
295 current->pid, current->comm); 307 if (tt == BUG_TRAP_TYPE_WARN) {
296#endif 308 regs->iaoq[0] += 4;
297 die_if_kernel("Breakpoint", regs, 0); 309 regs->iaoq[1] += 4;
298#ifdef PRINT_USER_FAULTS 310 return; /* return to next instruction when WARN_ON(). */
299 show_regs(regs); 311 }
300#endif 312 die_if_kernel("Unknown kernel breakpoint", regs,
301 si.si_code = TRAP_BRKPT; 313 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);
302 si.si_addr = (void __user *) (regs->iaoq[0] & ~3); 314 }
303 si.si_signo = SIGTRAP;
304 force_sig_info(SIGTRAP, &si, current);
305 break;
306
307 case GDB_BREAK_INSN:
308 die_if_kernel("Breakpoint", regs, 0);
309 handle_gdb_break(regs, TRAP_BRKPT);
310 break;
311 315
312 default:
313#ifdef PRINT_USER_FAULTS 316#ifdef PRINT_USER_FAULTS
314 printk(KERN_DEBUG "break %#08x: pid=%d command='%s'\n", 317 if (unlikely(iir != GDB_BREAK_INSN)) {
315 iir, current->pid, current->comm); 318 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
319 iir & 31, (iir>>13) & ((1<<13)-1),
320 current->pid, current->comm);
316 show_regs(regs); 321 show_regs(regs);
317#endif
318 si.si_signo = SIGTRAP;
319 si.si_code = TRAP_BRKPT;
320 si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
321 force_sig_info(SIGTRAP, &si, current);
322 return;
323 } 322 }
324} 323#endif
325
326 324
327int handle_toc(void) 325 /* send standard GDB signal */
328{ 326 handle_gdb_break(regs, TRAP_BRKPT);
329 printk(KERN_CRIT "TOC call.\n");
330 return 0;
331} 327}
332 328
333static void default_trap(int code, struct pt_regs *regs) 329static void default_trap(int code, struct pt_regs *regs)
@@ -336,7 +332,7 @@ static void default_trap(int code, struct pt_regs *regs)
336 show_regs(regs); 332 show_regs(regs);
337} 333}
338 334
339void (*cpu_lpmc) (int code, struct pt_regs *regs) = default_trap; 335void (*cpu_lpmc) (int code, struct pt_regs *regs) __read_mostly = default_trap;
340 336
341 337
342void transfer_pim_to_trap_frame(struct pt_regs *regs) 338void transfer_pim_to_trap_frame(struct pt_regs *regs)
@@ -554,7 +550,8 @@ void handle_interruption(int code, struct pt_regs *regs)
554 /* Low-priority machine check */ 550 /* Low-priority machine check */
555 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_LPMC); 551 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_LPMC);
556 552
557 flush_all_caches(); 553 flush_cache_all();
554 flush_tlb_all();
558 cpu_lpmc(5, regs); 555 cpu_lpmc(5, regs);
559 return; 556 return;
560 557
@@ -572,7 +569,7 @@ void handle_interruption(int code, struct pt_regs *regs)
572 569
573 case 9: 570 case 9:
574 /* Break instruction trap */ 571 /* Break instruction trap */
575 handle_break(regs->iir,regs); 572 handle_break(regs);
576 return; 573 return;
577 574
578 case 10: 575 case 10:
@@ -840,7 +837,7 @@ int __init check_ivt(void *iva)
840 return 0; 837 return 0;
841} 838}
842 839
843#ifndef __LP64__ 840#ifndef CONFIG_64BIT
844extern const void fault_vector_11; 841extern const void fault_vector_11;
845#endif 842#endif
846extern const void fault_vector_20; 843extern const void fault_vector_20;
@@ -852,7 +849,7 @@ void __init trap_init(void)
852 if (boot_cpu_data.cpu_type >= pcxu) 849 if (boot_cpu_data.cpu_type >= pcxu)
853 iva = (void *) &fault_vector_20; 850 iva = (void *) &fault_vector_20;
854 else 851 else
855#ifdef __LP64__ 852#ifdef CONFIG_64BIT
856 panic("Can't boot 64-bit OS on PA1.1 processor!"); 853 panic("Can't boot 64-bit OS on PA1.1 processor!");
857#else 854#else
858 iva = (void *) &fault_vector_11; 855 iva = (void *) &fault_vector_11;
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index bd2230d6a2a6..347bb922e6d0 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -20,8 +20,11 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/jiffies.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/sched.h>
27#include <linux/signal.h>
25#include <asm/uaccess.h> 28#include <asm/uaccess.h>
26 29
27/* #define DEBUG_UNALIGNED 1 */ 30/* #define DEBUG_UNALIGNED 1 */
@@ -32,7 +35,7 @@
32#define DPRINTF(fmt, args...) 35#define DPRINTF(fmt, args...)
33#endif 36#endif
34 37
35#ifdef __LP64__ 38#ifdef CONFIG_64BIT
36#define RFMT "%016lx" 39#define RFMT "%016lx"
37#else 40#else
38#define RFMT "%08lx" 41#define RFMT "%08lx"
@@ -147,15 +150,8 @@ static int emulate_ldh(struct pt_regs *regs, int toreg)
147"4: ldi -2, %1\n" 150"4: ldi -2, %1\n"
148 FIXUP_BRANCH(3b) 151 FIXUP_BRANCH(3b)
149" .previous\n" 152" .previous\n"
150" .section __ex_table,\"aw\"\n" 153 ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
151#ifdef __LP64__ 154 ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
152" .dword 1b,4b\n"
153" .dword 2b,4b\n"
154#else
155" .word 1b,4b\n"
156" .word 2b,4b\n"
157#endif
158" .previous\n"
159 : "=r" (val), "=r" (ret) 155 : "=r" (val), "=r" (ret)
160 : "0" (val), "r" (saddr), "r" (regs->isr) 156 : "0" (val), "r" (saddr), "r" (regs->isr)
161 : "r20", FIXUP_BRANCH_CLOBBER ); 157 : "r20", FIXUP_BRANCH_CLOBBER );
@@ -192,15 +188,8 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop)
192"4: ldi -2, %1\n" 188"4: ldi -2, %1\n"
193 FIXUP_BRANCH(3b) 189 FIXUP_BRANCH(3b)
194" .previous\n" 190" .previous\n"
195" .section __ex_table,\"aw\"\n" 191 ASM_EXCEPTIONTABLE_ENTRY(1b, 4b)
196#ifdef __LP64__ 192 ASM_EXCEPTIONTABLE_ENTRY(2b, 4b)
197" .dword 1b,4b\n"
198" .dword 2b,4b\n"
199#else
200" .word 1b,4b\n"
201" .word 2b,4b\n"
202#endif
203" .previous\n"
204 : "=r" (val), "=r" (ret) 193 : "=r" (val), "=r" (ret)
205 : "0" (val), "r" (saddr), "r" (regs->isr) 194 : "0" (val), "r" (saddr), "r" (regs->isr)
206 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 195 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -224,7 +213,7 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
224 regs->isr, regs->ior, toreg); 213 regs->isr, regs->ior, toreg);
225#ifdef CONFIG_PA20 214#ifdef CONFIG_PA20
226 215
227#ifndef __LP64__ 216#ifndef CONFIG_64BIT
228 if (!flop) 217 if (!flop)
229 return -1; 218 return -1;
230#endif 219#endif
@@ -243,15 +232,8 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
243"4: ldi -2, %1\n" 232"4: ldi -2, %1\n"
244 FIXUP_BRANCH(3b) 233 FIXUP_BRANCH(3b)
245" .previous\n" 234" .previous\n"
246" .section __ex_table,\"aw\"\n" 235 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
247#ifdef __LP64__ 236 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
248" .dword 1b,4b\n"
249" .dword 2b,4b\n"
250#else
251" .word 1b,4b\n"
252" .word 2b,4b\n"
253#endif
254" .previous\n"
255 : "=r" (val), "=r" (ret) 237 : "=r" (val), "=r" (ret)
256 : "0" (val), "r" (saddr), "r" (regs->isr) 238 : "0" (val), "r" (saddr), "r" (regs->isr)
257 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 239 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -275,17 +257,9 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop)
275"5: ldi -2, %2\n" 257"5: ldi -2, %2\n"
276 FIXUP_BRANCH(4b) 258 FIXUP_BRANCH(4b)
277" .previous\n" 259" .previous\n"
278" .section __ex_table,\"aw\"\n" 260 ASM_EXCEPTIONTABLE_ENTRY(1b,5b)
279#ifdef __LP64__ 261 ASM_EXCEPTIONTABLE_ENTRY(2b,5b)
280" .dword 1b,5b\n" 262 ASM_EXCEPTIONTABLE_ENTRY(3b,5b)
281" .dword 2b,5b\n"
282" .dword 3b,5b\n"
283#else
284" .word 1b,5b\n"
285" .word 2b,5b\n"
286" .word 3b,5b\n"
287#endif
288" .previous\n"
289 : "=r" (valh), "=r" (vall), "=r" (ret) 263 : "=r" (valh), "=r" (vall), "=r" (ret)
290 : "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr) 264 : "0" (valh), "1" (vall), "r" (saddr), "r" (regs->isr)
291 : "r19", "r20", FIXUP_BRANCH_CLOBBER ); 265 : "r19", "r20", FIXUP_BRANCH_CLOBBER );
@@ -325,15 +299,8 @@ static int emulate_sth(struct pt_regs *regs, int frreg)
325"4: ldi -2, %0\n" 299"4: ldi -2, %0\n"
326 FIXUP_BRANCH(3b) 300 FIXUP_BRANCH(3b)
327" .previous\n" 301" .previous\n"
328" .section __ex_table,\"aw\"\n" 302 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
329#ifdef __LP64__ 303 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
330" .dword 1b,4b\n"
331" .dword 2b,4b\n"
332#else
333" .word 1b,4b\n"
334" .word 2b,4b\n"
335#endif
336" .previous\n"
337 : "=r" (ret) 304 : "=r" (ret)
338 : "r" (val), "r" (regs->ior), "r" (regs->isr) 305 : "r" (val), "r" (regs->ior), "r" (regs->isr)
339 : "r19", FIXUP_BRANCH_CLOBBER ); 306 : "r19", FIXUP_BRANCH_CLOBBER );
@@ -379,15 +346,8 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop)
379"4: ldi -2, %0\n" 346"4: ldi -2, %0\n"
380 FIXUP_BRANCH(3b) 347 FIXUP_BRANCH(3b)
381" .previous\n" 348" .previous\n"
382" .section __ex_table,\"aw\"\n" 349 ASM_EXCEPTIONTABLE_ENTRY(1b,4b)
383#ifdef __LP64__ 350 ASM_EXCEPTIONTABLE_ENTRY(2b,4b)
384" .dword 1b,4b\n"
385" .dword 2b,4b\n"
386#else
387" .word 1b,4b\n"
388" .word 2b,4b\n"
389#endif
390" .previous\n"
391 : "=r" (ret) 351 : "=r" (ret)
392 : "r" (val), "r" (regs->ior), "r" (regs->isr) 352 : "r" (val), "r" (regs->ior), "r" (regs->isr)
393 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); 353 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -410,7 +370,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
410 val, regs->isr, regs->ior); 370 val, regs->isr, regs->ior);
411 371
412#ifdef CONFIG_PA20 372#ifdef CONFIG_PA20
413#ifndef __LP64__ 373#ifndef CONFIG_64BIT
414 if (!flop) 374 if (!flop)
415 return -1; 375 return -1;
416#endif 376#endif
@@ -436,19 +396,10 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
436"6: ldi -2, %0\n" 396"6: ldi -2, %0\n"
437 FIXUP_BRANCH(5b) 397 FIXUP_BRANCH(5b)
438" .previous\n" 398" .previous\n"
439" .section __ex_table,\"aw\"\n" 399 ASM_EXCEPTIONTABLE_ENTRY(1b,6b)
440#ifdef __LP64__ 400 ASM_EXCEPTIONTABLE_ENTRY(2b,6b)
441" .dword 1b,6b\n" 401 ASM_EXCEPTIONTABLE_ENTRY(3b,6b)
442" .dword 2b,6b\n" 402 ASM_EXCEPTIONTABLE_ENTRY(4b,6b)
443" .dword 3b,6b\n"
444" .dword 4b,6b\n"
445#else
446" .word 1b,6b\n"
447" .word 2b,6b\n"
448" .word 3b,6b\n"
449" .word 4b,6b\n"
450#endif
451" .previous\n"
452 : "=r" (ret) 403 : "=r" (ret)
453 : "r" (val), "r" (regs->ior), "r" (regs->isr) 404 : "r" (val), "r" (regs->ior), "r" (regs->isr)
454 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); 405 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
@@ -479,21 +430,11 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
479"7: ldi -2, %0\n" 430"7: ldi -2, %0\n"
480 FIXUP_BRANCH(6b) 431 FIXUP_BRANCH(6b)
481" .previous\n" 432" .previous\n"
482" .section __ex_table,\"aw\"\n" 433 ASM_EXCEPTIONTABLE_ENTRY(1b,7b)
483#ifdef __LP64__ 434 ASM_EXCEPTIONTABLE_ENTRY(2b,7b)
484" .dword 1b,7b\n" 435 ASM_EXCEPTIONTABLE_ENTRY(3b,7b)
485" .dword 2b,7b\n" 436 ASM_EXCEPTIONTABLE_ENTRY(4b,7b)
486" .dword 3b,7b\n" 437 ASM_EXCEPTIONTABLE_ENTRY(5b,7b)
487" .dword 4b,7b\n"
488" .dword 5b,7b\n"
489#else
490" .word 1b,7b\n"
491" .word 2b,7b\n"
492" .word 3b,7b\n"
493" .word 4b,7b\n"
494" .word 5b,7b\n"
495#endif
496" .previous\n"
497 : "=r" (ret) 438 : "=r" (ret)
498 : "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr) 439 : "r" (valh), "r" (vall), "r" (regs->ior), "r" (regs->isr)
499 : "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER ); 440 : "r19", "r20", "r21", "r1", FIXUP_BRANCH_CLOBBER );
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index c10ab47d81fa..5f75b3e65986 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/sched.h>
13#include <linux/slab.h> 14#include <linux/slab.h>
14#include <linux/kallsyms.h> 15#include <linux/kallsyms.h>
15 16
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 3b78c2794c36..2a8253358c6c 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -68,6 +68,8 @@ SECTIONS
68 68
69 RODATA 69 RODATA
70 70
71 BUG_TABLE
72
71 /* writeable */ 73 /* writeable */
72 . = ALIGN(ASM_PAGE_SIZE); /* Make sure this is page aligned so 74 . = ALIGN(ASM_PAGE_SIZE); /* Make sure this is page aligned so
73 that we can properly leave these 75 that we can properly leave these
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index f352666b5b2f..e3eb739fab19 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -17,7 +17,7 @@ raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
17}; 17};
18#endif 18#endif
19 19
20#ifdef __LP64__ 20#ifdef CONFIG_64BIT
21unsigned long __xchg64(unsigned long x, unsigned long *ptr) 21unsigned long __xchg64(unsigned long x, unsigned long *ptr)
22{ 22{
23 unsigned long temp, flags; 23 unsigned long temp, flags;
@@ -56,7 +56,7 @@ unsigned long __xchg8(char x, char *ptr)
56} 56}
57 57
58 58
59#ifdef __LP64__ 59#ifdef CONFIG_64BIT
60unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new) 60unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new)
61{ 61{
62 unsigned long flags; 62 unsigned long flags;
diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S
index ecce3d35401f..d172d4245cdc 100644
--- a/arch/parisc/lib/fixup.S
+++ b/arch/parisc/lib/fixup.S
@@ -22,6 +22,7 @@
22#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/assembly.h> 23#include <asm/assembly.h>
24#include <asm/errno.h> 24#include <asm/errno.h>
25#include <linux/linkage.h>
25 26
26#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
27 .macro get_fault_ip t1 t2 28 .macro get_fault_ip t1 t2
@@ -30,7 +31,7 @@
30 /* t2 = smp_processor_id() */ 31 /* t2 = smp_processor_id() */
31 mfctl 30,\t2 32 mfctl 30,\t2
32 ldw TI_CPU(\t2),\t2 33 ldw TI_CPU(\t2),\t2
33#ifdef __LP64__ 34#ifdef CONFIG_64BIT
34 extrd,u \t2,63,32,\t2 35 extrd,u \t2,63,32,\t2
35#endif 36#endif
36 /* t2 = &__per_cpu_offset[smp_processor_id()]; */ 37 /* t2 = &__per_cpu_offset[smp_processor_id()]; */
@@ -58,33 +59,34 @@
58 .section .fixup, "ax" 59 .section .fixup, "ax"
59 60
60 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */ 61 /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
61 .export fixup_get_user_skip_1 62ENTRY(fixup_get_user_skip_1)
62fixup_get_user_skip_1:
63 get_fault_ip %r1,%r8 63 get_fault_ip %r1,%r8
64 ldo 4(%r1), %r1 64 ldo 4(%r1), %r1
65 ldi -EFAULT, %r8 65 ldi -EFAULT, %r8
66 bv %r0(%r1) 66 bv %r0(%r1)
67 copy %r0, %r9 67 copy %r0, %r9
68ENDPROC(fixup_get_user_skip_1)
68 69
69 .export fixup_get_user_skip_2 70ENTRY(fixup_get_user_skip_2)
70fixup_get_user_skip_2:
71 get_fault_ip %r1,%r8 71 get_fault_ip %r1,%r8
72 ldo 8(%r1), %r1 72 ldo 8(%r1), %r1
73 ldi -EFAULT, %r8 73 ldi -EFAULT, %r8
74 bv %r0(%r1) 74 bv %r0(%r1)
75 copy %r0, %r9 75 copy %r0, %r9
76ENDPROC(fixup_get_user_skip_2)
76 77
77 /* put_user() fixups, store -EFAULT in r8 */ 78 /* put_user() fixups, store -EFAULT in r8 */
78 .export fixup_put_user_skip_1 79ENTRY(fixup_put_user_skip_1)
79fixup_put_user_skip_1:
80 get_fault_ip %r1,%r8 80 get_fault_ip %r1,%r8
81 ldo 4(%r1), %r1 81 ldo 4(%r1), %r1
82 bv %r0(%r1) 82 bv %r0(%r1)
83 ldi -EFAULT, %r8 83 ldi -EFAULT, %r8
84ENDPROC(fixup_put_user_skip_1)
84 85
85 .export fixup_put_user_skip_2 86ENTRY(fixup_put_user_skip_2)
86fixup_put_user_skip_2:
87 get_fault_ip %r1,%r8 87 get_fault_ip %r1,%r8
88 ldo 8(%r1), %r1 88 ldo 8(%r1), %r1
89 bv %r0(%r1) 89 bv %r0(%r1)
90 ldi -EFAULT, %r8 90 ldi -EFAULT, %r8
91ENDPROC(fixup_put_user_skip_2)
92
diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S
index a0509855c9a7..1bd23ccec17b 100644
--- a/arch/parisc/lib/lusercopy.S
+++ b/arch/parisc/lib/lusercopy.S
@@ -37,6 +37,7 @@
37 37
38#include <asm/assembly.h> 38#include <asm/assembly.h>
39#include <asm/errno.h> 39#include <asm/errno.h>
40#include <linux/linkage.h>
40 41
41 /* 42 /*
42 * get_sr gets the appropriate space value into 43 * get_sr gets the appropriate space value into
@@ -67,8 +68,7 @@
67 * otherwise strlen (i.e. excludes zero byte) 68 * otherwise strlen (i.e. excludes zero byte)
68 */ 69 */
69 70
70 .export lstrncpy_from_user,code 71ENTRY(lstrncpy_from_user)
71lstrncpy_from_user:
72 .proc 72 .proc
73 .callinfo NO_CALLS 73 .callinfo NO_CALLS
74 .entry 74 .entry
@@ -87,6 +87,7 @@ $lsfu_exit:
87 bv %r0(%r2) 87 bv %r0(%r2)
88 nop 88 nop
89 .exit 89 .exit
90ENDPROC(lstrncpy_from_user)
90 91
91 .section .fixup,"ax" 92 .section .fixup,"ax"
923: fixup_branch $lsfu_exit 933: fixup_branch $lsfu_exit
@@ -94,13 +95,8 @@ $lsfu_exit:
94 .previous 95 .previous
95 96
96 .section __ex_table,"aw" 97 .section __ex_table,"aw"
97#ifdef __LP64__ 98 ASM_ULONG_INSN 1b,3b
98 .dword 1b,3b 99 ASM_ULONG_INSN 2b,3b
99 .dword 2b,3b
100#else
101 .word 1b,3b
102 .word 2b,3b
103#endif
104 .previous 100 .previous
105 101
106 .procend 102 .procend
@@ -112,8 +108,7 @@ $lsfu_exit:
112 * otherwise, returns number of bytes not transferred. 108 * otherwise, returns number of bytes not transferred.
113 */ 109 */
114 110
115 .export lclear_user,code 111ENTRY(lclear_user)
116lclear_user:
117 .proc 112 .proc
118 .callinfo NO_CALLS 113 .callinfo NO_CALLS
119 .entry 114 .entry
@@ -127,6 +122,7 @@ $lclu_done:
127 bv %r0(%r2) 122 bv %r0(%r2)
128 copy %r25,%r28 123 copy %r25,%r28
129 .exit 124 .exit
125ENDPROC(lclear_user)
130 126
131 .section .fixup,"ax" 127 .section .fixup,"ax"
1322: fixup_branch $lclu_done 1282: fixup_branch $lclu_done
@@ -134,11 +130,7 @@ $lclu_done:
134 .previous 130 .previous
135 131
136 .section __ex_table,"aw" 132 .section __ex_table,"aw"
137#ifdef __LP64__ 133 ASM_ULONG_INSN 1b,2b
138 .dword 1b,2b
139#else
140 .word 1b,2b
141#endif
142 .previous 134 .previous
143 135
144 .procend 136 .procend
@@ -151,8 +143,7 @@ $lclu_done:
151 * else strlen + 1 (i.e. includes zero byte). 143 * else strlen + 1 (i.e. includes zero byte).
152 */ 144 */
153 145
154 .export lstrnlen_user,code 146ENTRY(lstrnlen_user)
155lstrnlen_user:
156 .proc 147 .proc
157 .callinfo NO_CALLS 148 .callinfo NO_CALLS
158 .entry 149 .entry
@@ -172,6 +163,7 @@ $lslen_done:
172$lslen_nzero: 163$lslen_nzero:
173 b $lslen_done 164 b $lslen_done
174 ldo 1(%r26),%r26 /* special case for N == 0 */ 165 ldo 1(%r26),%r26 /* special case for N == 0 */
166ENDPROC(lstrnlen_user)
175 167
176 .section .fixup,"ax" 168 .section .fixup,"ax"
1773: fixup_branch $lslen_done 1693: fixup_branch $lslen_done
@@ -179,13 +171,8 @@ $lslen_nzero:
179 .previous 171 .previous
180 172
181 .section __ex_table,"aw" 173 .section __ex_table,"aw"
182#ifdef __LP64__ 174 ASM_ULONG_INSN 1b,3b
183 .dword 1b,3b 175 ASM_ULONG_INSN 2b,3b
184 .dword 2b,3b
185#else
186 .word 1b,3b
187 .word 2b,3b
188#endif
189 .previous 176 .previous
190 177
191 .procend 178 .procend
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index 5575e41f9d60..2c43ebe99a9c 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -96,30 +96,18 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
96#define DPRINTF(fmt, args...) 96#define DPRINTF(fmt, args...)
97#endif 97#endif
98 98
99#ifndef __LP64__
100#define EXC_WORD ".word"
101#else
102#define EXC_WORD ".dword"
103#endif
104
105#define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ 99#define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \
106 __asm__ __volatile__ ( \ 100 __asm__ __volatile__ ( \
107 "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n" \ 101 "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n\t" \
108 "\t.section __ex_table,\"aw\"\n" \ 102 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
109 "\t" EXC_WORD "\t1b\n" \
110 "\t" EXC_WORD "\t" #_e "\n" \
111 "\t.previous\n" \
112 : _tt(_t), "+r"(_a) \ 103 : _tt(_t), "+r"(_a) \
113 : \ 104 : \
114 : "r8") 105 : "r8")
115 106
116#define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \ 107#define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \
117 __asm__ __volatile__ ( \ 108 __asm__ __volatile__ ( \
118 "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n" \ 109 "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n\t" \
119 "\t.section __ex_table,\"aw\"\n" \ 110 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
120 "\t" EXC_WORD "\t1b\n" \
121 "\t" EXC_WORD "\t" #_e "\n" \
122 "\t.previous\n" \
123 : "+r"(_a) \ 111 : "+r"(_a) \
124 : _tt(_t) \ 112 : _tt(_t) \
125 : "r8") 113 : "r8")
@@ -133,22 +121,16 @@ DECLARE_PER_CPU(struct exception_data, exception_data);
133 121
134#define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \ 122#define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \
135 __asm__ __volatile__ ( \ 123 __asm__ __volatile__ ( \
136 "1:\t" #_insn " " #_o "(" _s ",%1), %0\n" \ 124 "1:\t" #_insn " " #_o "(" _s ",%1), %0\n\t" \
137 "\t.section __ex_table,\"aw\"\n" \ 125 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
138 "\t" EXC_WORD "\t1b\n" \
139 "\t" EXC_WORD "\t" #_e "\n" \
140 "\t.previous\n" \
141 : _tt(_t) \ 126 : _tt(_t) \
142 : "r"(_a) \ 127 : "r"(_a) \
143 : "r8") 128 : "r8")
144 129
145#define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \ 130#define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \
146 __asm__ __volatile__ ( \ 131 __asm__ __volatile__ ( \
147 "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n" \ 132 "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n\t" \
148 "\t.section __ex_table,\"aw\"\n" \ 133 ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \
149 "\t" EXC_WORD "\t1b\n" \
150 "\t" EXC_WORD "\t" #_e "\n" \
151 "\t.previous\n" \
152 : \ 134 : \
153 : _tt(_t), "r"(_a) \ 135 : _tt(_t), "r"(_a) \
154 : "r8") 136 : "r8")
@@ -167,8 +149,8 @@ extern inline void prefetch_dst(const void *addr)
167 __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr)); 149 __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr));
168} 150}
169#else 151#else
170#define prefetch_src(addr) 152#define prefetch_src(addr) do { } while(0)
171#define prefetch_dst(addr) 153#define prefetch_dst(addr) do { } while(0)
172#endif 154#endif
173 155
174/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words 156/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 641f9c920eee..f6f67554c623 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -24,10 +24,6 @@
24 /* dumped to the console via printk) */ 24 /* dumped to the console via printk) */
25 25
26 26
27/* Defines for parisc_acctyp() */
28#define READ 0
29#define WRITE 1
30
31/* Various important other fields */ 27/* Various important other fields */
32#define bit22set(x) (x & 0x00000200) 28#define bit22set(x) (x & 0x00000200)
33#define bits23_25set(x) (x & 0x000001c0) 29#define bits23_25set(x) (x & 0x000001c0)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 12117db0043b..75ea9f2a8a41 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -6,7 +6,7 @@
6 * changed by Philipp Rumpf 6 * changed by Philipp Rumpf
7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org) 7 * Copyright 1999 Philipp Rumpf (prumpf@tux.org)
8 * Copyright 2004 Randolph Chung (tausq@debian.org) 8 * Copyright 2004 Randolph Chung (tausq@debian.org)
9 * Copyright 2006 Helge Deller (deller@gmx.de) 9 * Copyright 2006-2007 Helge Deller (deller@gmx.de)
10 * 10 *
11 */ 11 */
12 12
@@ -24,6 +24,7 @@
24#include <linux/pagemap.h> /* for release_pages and page_cache_release */ 24#include <linux/pagemap.h> /* for release_pages and page_cache_release */
25 25
26#include <asm/pgalloc.h> 26#include <asm/pgalloc.h>
27#include <asm/pgtable.h>
27#include <asm/tlb.h> 28#include <asm/tlb.h>
28#include <asm/pdc_chassis.h> 29#include <asm/pdc_chassis.h>
29#include <asm/mmzone.h> 30#include <asm/mmzone.h>
@@ -65,11 +66,11 @@ static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
65physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; 66physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
66int npmem_ranges __read_mostly; 67int npmem_ranges __read_mostly;
67 68
68#ifdef __LP64__ 69#ifdef CONFIG_64BIT
69#define MAX_MEM (~0UL) 70#define MAX_MEM (~0UL)
70#else /* !__LP64__ */ 71#else /* !CONFIG_64BIT */
71#define MAX_MEM (3584U*1024U*1024U) 72#define MAX_MEM (3584U*1024U*1024U)
72#endif /* !__LP64__ */ 73#endif /* !CONFIG_64BIT */
73 74
74static unsigned long mem_limit __read_mostly = MAX_MEM; 75static unsigned long mem_limit __read_mostly = MAX_MEM;
75 76
@@ -452,6 +453,8 @@ unsigned long pcxl_dma_start __read_mostly;
452 453
453void __init mem_init(void) 454void __init mem_init(void)
454{ 455{
456 int codesize, reservedpages, datasize, initsize;
457
455 high_memory = __va((max_pfn << PAGE_SHIFT)); 458 high_memory = __va((max_pfn << PAGE_SHIFT));
456 459
457#ifndef CONFIG_DISCONTIGMEM 460#ifndef CONFIG_DISCONTIGMEM
@@ -466,7 +469,32 @@ void __init mem_init(void)
466 } 469 }
467#endif 470#endif
468 471
469 printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10)); 472 codesize = (unsigned long)_etext - (unsigned long)_text;
473 datasize = (unsigned long)_edata - (unsigned long)_etext;
474 initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
475
476 reservedpages = 0;
477{
478 unsigned long pfn;
479#ifdef CONFIG_DISCONTIGMEM
480 int i;
481
482 for (i = 0; i < npmem_ranges; i++) {
483 for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
484 if (PageReserved(pfn_to_page(pfn)))
485 reservedpages++;
486 }
487 }
488#else /* !CONFIG_DISCONTIGMEM */
489 for (pfn = 0; pfn < max_pfn; pfn++) {
490 /*
491 * Only count reserved RAM pages
492 */
493 if (PageReserved(pfn_to_page(pfn)))
494 reservedpages++;
495 }
496#endif
497}
470 498
471#ifdef CONFIG_PA11 499#ifdef CONFIG_PA11
472 if (hppa_dma_ops == &pcxl_dma_ops) { 500 if (hppa_dma_ops == &pcxl_dma_ops) {
@@ -480,6 +508,38 @@ void __init mem_init(void)
480 vmalloc_start = SET_MAP_OFFSET(MAP_START); 508 vmalloc_start = SET_MAP_OFFSET(MAP_START);
481#endif 509#endif
482 510
511 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
512 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
513 num_physpages << (PAGE_SHIFT-10),
514 codesize >> 10,
515 reservedpages << (PAGE_SHIFT-10),
516 datasize >> 10,
517 initsize >> 10
518 );
519
520#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
521 printk("virtual kernel memory layout:\n"
522 " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
523 " memory : 0x%p - 0x%p (%4ld MB)\n"
524 " .init : 0x%p - 0x%p (%4ld kB)\n"
525 " .data : 0x%p - 0x%p (%4ld kB)\n"
526 " .text : 0x%p - 0x%p (%4ld kB)\n",
527
528 (void*)VMALLOC_START, (void*)VMALLOC_END,
529 (VMALLOC_END - VMALLOC_START) >> 20,
530
531 __va(0), high_memory,
532 ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
533
534 __init_begin, __init_end,
535 ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10,
536
537 _etext, _edata,
538 ((unsigned long)_edata - (unsigned long)_etext) >> 10,
539
540 _text, _etext,
541 ((unsigned long)_etext - (unsigned long)_text) >> 10);
542#endif
483} 543}
484 544
485unsigned long *empty_zero_page __read_mostly; 545unsigned long *empty_zero_page __read_mostly;
@@ -547,7 +607,7 @@ void show_mem(void)
547 607
548 printk("Zone list for zone %d on node %d: ", j, i); 608 printk("Zone list for zone %d on node %d: ", j, i);
549 for (k = 0; zl->zones[k] != NULL; k++) 609 for (k = 0; zl->zones[k] != NULL; k++)
550 printk("[%d/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); 610 printk("[%ld/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name);
551 printk("\n"); 611 printk("\n");
552 } 612 }
553 } 613 }
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
index 44b42c7f639d..92d496ad07c9 100644
--- a/arch/parisc/mm/ioremap.c
+++ b/arch/parisc/mm/ioremap.c
@@ -26,7 +26,7 @@
26 */ 26 */
27void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 27void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
28{ 28{
29 void *addr; 29 void __iomem *addr;
30 struct vm_struct *area; 30 struct vm_struct *area;
31 unsigned long offset, last_addr; 31 unsigned long offset, last_addr;
32 pgprot_t pgprot; 32 pgprot_t pgprot;
@@ -80,14 +80,14 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
80 if (!area) 80 if (!area)
81 return NULL; 81 return NULL;
82 82
83 addr = area->addr; 83 addr = (void __iomem *) area->addr;
84 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, 84 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
85 phys_addr, pgprot)) { 85 phys_addr, pgprot)) {
86 vfree(addr); 86 vfree(addr);
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 return (void __iomem *) (offset + (char *)addr); 90 return (void __iomem *) (offset + (char __iomem *)addr);
91} 91}
92EXPORT_SYMBOL(__ioremap); 92EXPORT_SYMBOL(__ioremap);
93 93
diff --git a/arch/parisc/mm/kmap.c b/arch/parisc/mm/kmap.c
deleted file mode 100644
index 1b1acd5e2f6e..000000000000
--- a/arch/parisc/mm/kmap.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * kmap/page table map and unmap support routines
3 *
4 * Copyright 1999,2000 Hewlett-Packard Company
5 * Copyright 2000 John Marvin <jsm at hp.com>
6 * Copyright 2000 Grant Grundler <grundler at parisc-linux.org>
7 * Copyright 2000 Philipp Rumpf <prumpf@tux.org>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24/*
25** Stolen mostly from arch/parisc/kernel/pci-dma.c
26*/
27
28#include <linux/types.h>
29#include <linux/mm.h>
30#include <linux/string.h>
31#include <linux/pci.h>
32
33#include <linux/slab.h>
34#include <linux/vmalloc.h>
35
36#include <asm/uaccess.h>
37#include <asm/pgalloc.h>
38
39#include <asm/io.h>
40#include <asm/page.h> /* get_order */
41
42#undef flush_cache_all
43#define flush_cache_all flush_all_caches
44
45typedef void (*pte_iterator_t) (pte_t * pte, unsigned long arg);
46
47#if 0
48/* XXX This routine could be used with iterate_page() to replace
49 * unmap_uncached_page() and save a little code space but I didn't
50 * do that since I'm not certain whether this is the right path. -PB
51 */
52static void unmap_cached_pte(pte_t * pte, unsigned long addr, unsigned long arg)
53{
54 pte_t page = *pte;
55 pte_clear(&init_mm, addr, pte);
56 if (!pte_none(page)) {
57 if (pte_present(page)) {
58 unsigned long map_nr = pte_pagenr(page);
59 if (map_nr < max_mapnr)
60 __free_page(mem_map + map_nr);
61 } else {
62 printk(KERN_CRIT
63 "Whee.. Swapped out page in kernel page table\n");
64 }
65 }
66}
67#endif
68
69/* These two routines should probably check a few things... */
70static void set_uncached(pte_t * pte, unsigned long arg)
71{
72 pte_val(*pte) |= _PAGE_NO_CACHE;
73}
74
75static void set_cached(pte_t * pte, unsigned long arg)
76{
77 pte_val(*pte) &= ~_PAGE_NO_CACHE;
78}
79
80static inline void iterate_pte(pmd_t * pmd, unsigned long address,
81 unsigned long size, pte_iterator_t op,
82 unsigned long arg)
83{
84 pte_t *pte;
85 unsigned long end;
86
87 if (pmd_none(*pmd))
88 return;
89 if (pmd_bad(*pmd)) {
90 pmd_ERROR(*pmd);
91 pmd_clear(pmd);
92 return;
93 }
94 pte = pte_offset(pmd, address);
95 address &= ~PMD_MASK;
96 end = address + size;
97 if (end > PMD_SIZE)
98 end = PMD_SIZE;
99 do {
100 op(pte, arg);
101 address += PAGE_SIZE;
102 pte++;
103 } while (address < end);
104}
105
106static inline void iterate_pmd(pgd_t * dir, unsigned long address,
107 unsigned long size, pte_iterator_t op,
108 unsigned long arg)
109{
110 pmd_t *pmd;
111 unsigned long end;
112
113 if (pgd_none(*dir))
114 return;
115 if (pgd_bad(*dir)) {
116 pgd_ERROR(*dir);
117 pgd_clear(dir);
118 return;
119 }
120 pmd = pmd_offset(dir, address);
121 address &= ~PGDIR_MASK;
122 end = address + size;
123 if (end > PGDIR_SIZE)
124 end = PGDIR_SIZE;
125 do {
126 iterate_pte(pmd, address, end - address, op, arg);
127 address = (address + PMD_SIZE) & PMD_MASK;
128 pmd++;
129 } while (address < end);
130}
131
132static void iterate_pages(unsigned long address, unsigned long size,
133 pte_iterator_t op, unsigned long arg)
134{
135 pgd_t *dir;
136 unsigned long end = address + size;
137
138 dir = pgd_offset_k(address);
139 flush_cache_all();
140 do {
141 iterate_pmd(dir, address, end - address, op, arg);
142 address = (address + PGDIR_SIZE) & PGDIR_MASK;
143 dir++;
144 } while (address && (address < end));
145 flush_tlb_all();
146}
147
148void
149kernel_set_cachemode(unsigned long vaddr, unsigned long size, int what)
150{
151 switch (what) {
152 case IOMAP_FULL_CACHING:
153 iterate_pages(vaddr, size, set_cached, 0);
154 flush_tlb_range(NULL, vaddr, size);
155 break;
156 case IOMAP_NOCACHE_SER:
157 iterate_pages(vaddr, size, set_uncached, 0);
158 flush_tlb_range(NULL, vaddr, size);
159 break;
160 default:
161 printk(KERN_CRIT
162 "kernel_set_cachemode mode %d not understood\n",
163 what);
164 break;
165 }
166}
diff --git a/arch/parisc/oprofile/init.c b/arch/parisc/oprofile/init.c
index a5b898c4d0b0..113f5139f551 100644
--- a/arch/parisc/oprofile/init.c
+++ b/arch/parisc/oprofile/init.c
@@ -18,6 +18,6 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
18} 18}
19 19
20 20
21void oprofile_arch_exit() 21void oprofile_arch_exit(void)
22{ 22{
23} 23}