aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/alpha/kernel
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/alpha/kernel')
-rw-r--r--arch/alpha/kernel/Makefile2
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c6
-rw-r--r--arch/alpha/kernel/binfmt_loader.c7
-rw-r--r--arch/alpha/kernel/core_apecs.c1
-rw-r--r--arch/alpha/kernel/core_cia.c1
-rw-r--r--arch/alpha/kernel/core_irongate.c1
-rw-r--r--arch/alpha/kernel/core_t2.c1
-rw-r--r--arch/alpha/kernel/core_tsunami.c1
-rw-r--r--arch/alpha/kernel/entry.S367
-rw-r--r--arch/alpha/kernel/err_impl.h2
-rw-r--r--arch/alpha/kernel/head.S6
-rw-r--r--arch/alpha/kernel/irq.c1
-rw-r--r--arch/alpha/kernel/irq_alpha.c1
-rw-r--r--arch/alpha/kernel/osf_sys.c276
-rw-r--r--arch/alpha/kernel/pci-noop.c22
-rw-r--r--arch/alpha/kernel/pci-sysfs.c3
-rw-r--r--arch/alpha/kernel/pci.c175
-rw-r--r--arch/alpha/kernel/pci_impl.h3
-rw-r--r--arch/alpha/kernel/pci_iommu.c43
-rw-r--r--arch/alpha/kernel/perf_event.c7
-rw-r--r--arch/alpha/kernel/process.c121
-rw-r--r--arch/alpha/kernel/ptrace.c33
-rw-r--r--arch/alpha/kernel/setup.c2
-rw-r--r--arch/alpha/kernel/signal.c163
-rw-r--r--arch/alpha/kernel/smc37c669.c12
-rw-r--r--arch/alpha/kernel/smp.c29
-rw-r--r--arch/alpha/kernel/srm_env.c5
-rw-r--r--arch/alpha/kernel/srmcons.c82
-rw-r--r--arch/alpha/kernel/sys_alcor.c1
-rw-r--r--arch/alpha/kernel/sys_cabriolet.c1
-rw-r--r--arch/alpha/kernel/sys_dp264.c3
-rw-r--r--arch/alpha/kernel/sys_eb64p.c1
-rw-r--r--arch/alpha/kernel/sys_eiger.c1
-rw-r--r--arch/alpha/kernel/sys_jensen.c1
-rw-r--r--arch/alpha/kernel/sys_marvel.c6
-rw-r--r--arch/alpha/kernel/sys_miata.c1
-rw-r--r--arch/alpha/kernel/sys_mikasa.c2
-rw-r--r--arch/alpha/kernel/sys_nautilus.c1
-rw-r--r--arch/alpha/kernel/sys_noritake.c2
-rw-r--r--arch/alpha/kernel/sys_rawhide.c1
-rw-r--r--arch/alpha/kernel/sys_ruffian.c1
-rw-r--r--arch/alpha/kernel/sys_rx164.c1
-rw-r--r--arch/alpha/kernel/sys_sable.c1
-rw-r--r--arch/alpha/kernel/sys_sio.c1
-rw-r--r--arch/alpha/kernel/sys_sx164.c2
-rw-r--r--arch/alpha/kernel/sys_takara.c1
-rw-r--r--arch/alpha/kernel/sys_titan.c6
-rw-r--r--arch/alpha/kernel/sys_wildfire.c1
-rw-r--r--arch/alpha/kernel/systbls.S22
-rw-r--r--arch/alpha/kernel/traps.c7
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S2
51 files changed, 886 insertions, 553 deletions
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 84ec46b38f7..7a6d908bb86 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
6asflags-y := $(KBUILD_CFLAGS) 6asflags-y := $(KBUILD_CFLAGS)
7ccflags-y := -Wno-sign-compare 7ccflags-y := -Wno-sign-compare
8 8
9obj-y := entry.o traps.o process.o osf_sys.o irq.o \ 9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
10 irq_alpha.o signal.o setup.o ptrace.o time.o \ 10 irq_alpha.o signal.o setup.o ptrace.o time.o \
11 alpha_ksyms.o systbls.o err_common.o io.o 11 alpha_ksyms.o systbls.o err_common.o io.o
12 12
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index 89566b346c0..d96e742d4dc 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -50,6 +50,10 @@ EXPORT_SYMBOL(alpha_read_fp_reg_s);
50EXPORT_SYMBOL(alpha_write_fp_reg); 50EXPORT_SYMBOL(alpha_write_fp_reg);
51EXPORT_SYMBOL(alpha_write_fp_reg_s); 51EXPORT_SYMBOL(alpha_write_fp_reg_s);
52 52
53/* entry.S */
54EXPORT_SYMBOL(kernel_thread);
55EXPORT_SYMBOL(kernel_execve);
56
53/* Networking helper routines. */ 57/* Networking helper routines. */
54EXPORT_SYMBOL(csum_tcpudp_magic); 58EXPORT_SYMBOL(csum_tcpudp_magic);
55EXPORT_SYMBOL(ip_compute_csum); 59EXPORT_SYMBOL(ip_compute_csum);
@@ -70,6 +74,8 @@ EXPORT_SYMBOL(alpha_fp_emul);
70 */ 74 */
71EXPORT_SYMBOL(__copy_user); 75EXPORT_SYMBOL(__copy_user);
72EXPORT_SYMBOL(__do_clear_user); 76EXPORT_SYMBOL(__do_clear_user);
77EXPORT_SYMBOL(__strncpy_from_user);
78EXPORT_SYMBOL(__strnlen_user);
73 79
74/* 80/*
75 * SMP-specific symbols. 81 * SMP-specific symbols.
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c
index 9525660c93c..3fcfad41013 100644
--- a/arch/alpha/kernel/binfmt_loader.c
+++ b/arch/alpha/kernel/binfmt_loader.c
@@ -5,7 +5,7 @@
5#include <linux/binfmts.h> 5#include <linux/binfmts.h>
6#include <linux/a.out.h> 6#include <linux/a.out.h>
7 7
8static int load_binary(struct linux_binprm *bprm) 8static int load_binary(struct linux_binprm *bprm, struct pt_regs *regs)
9{ 9{
10 struct exec *eh = (struct exec *)bprm->buf; 10 struct exec *eh = (struct exec *)bprm->buf;
11 unsigned long loader; 11 unsigned long loader;
@@ -37,7 +37,7 @@ static int load_binary(struct linux_binprm *bprm)
37 retval = prepare_binprm(bprm); 37 retval = prepare_binprm(bprm);
38 if (retval < 0) 38 if (retval < 0)
39 return retval; 39 return retval;
40 return search_binary_handler(bprm); 40 return search_binary_handler(bprm,regs);
41} 41}
42 42
43static struct linux_binfmt loader_format = { 43static struct linux_binfmt loader_format = {
@@ -46,7 +46,6 @@ static struct linux_binfmt loader_format = {
46 46
47static int __init init_loader_binfmt(void) 47static int __init init_loader_binfmt(void)
48{ 48{
49 insert_binfmt(&loader_format); 49 return insert_binfmt(&loader_format);
50 return 0;
51} 50}
52arch_initcall(init_loader_binfmt); 51arch_initcall(init_loader_binfmt);
diff --git a/arch/alpha/kernel/core_apecs.c b/arch/alpha/kernel/core_apecs.c
index 708c831efa7..ca46b2c2445 100644
--- a/arch/alpha/kernel/core_apecs.c
+++ b/arch/alpha/kernel/core_apecs.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/smp.h> 23#include <asm/smp.h>
24#include <asm/mce.h>
25 24
26#include "proto.h" 25#include "proto.h"
27#include "pci_impl.h" 26#include "pci_impl.h"
diff --git a/arch/alpha/kernel/core_cia.c b/arch/alpha/kernel/core_cia.c
index c44339e176c..1d6ee6c985f 100644
--- a/arch/alpha/kernel/core_cia.c
+++ b/arch/alpha/kernel/core_cia.c
@@ -23,7 +23,6 @@
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24 24
25#include <asm/ptrace.h> 25#include <asm/ptrace.h>
26#include <asm/mce.h>
27 26
28#include "proto.h" 27#include "proto.h"
29#include "pci_impl.h" 28#include "pci_impl.h"
diff --git a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
index 00096df0f6a..a872078497b 100644
--- a/arch/alpha/kernel/core_irongate.c
+++ b/arch/alpha/kernel/core_irongate.c
@@ -303,7 +303,6 @@ irongate_init_arch(void)
303#include <linux/vmalloc.h> 303#include <linux/vmalloc.h>
304#include <linux/agp_backend.h> 304#include <linux/agp_backend.h>
305#include <linux/agpgart.h> 305#include <linux/agpgart.h>
306#include <linux/export.h>
307#include <asm/pgalloc.h> 306#include <asm/pgalloc.h>
308 307
309#define GET_PAGE_DIR_OFF(addr) (addr >> 22) 308#define GET_PAGE_DIR_OFF(addr) (addr >> 22)
diff --git a/arch/alpha/kernel/core_t2.c b/arch/alpha/kernel/core_t2.c
index 3ada4f7b085..2f770e99428 100644
--- a/arch/alpha/kernel/core_t2.c
+++ b/arch/alpha/kernel/core_t2.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/delay.h> 23#include <asm/delay.h>
24#include <asm/mce.h>
25 24
26#include "proto.h" 25#include "proto.h"
27#include "pci_impl.h" 26#include "pci_impl.h"
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c
index 61893d7bdda..5e7c28f92f1 100644
--- a/arch/alpha/kernel/core_tsunami.c
+++ b/arch/alpha/kernel/core_tsunami.c
@@ -11,7 +11,6 @@
11#include <asm/core_tsunami.h> 11#include <asm/core_tsunami.h>
12#undef __EXTERN_INLINE 12#undef __EXTERN_INLINE
13 13
14#include <linux/module.h>
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/pci.h> 15#include <linux/pci.h>
17#include <linux/sched.h> 16#include <linux/sched.h>
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index f62a994ef12..6d159cee5f2 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -311,7 +311,7 @@ entSys:
311 311
312 .align 4 312 .align 4
313ret_from_sys_call: 313ret_from_sys_call:
314 cmovne $26, 0, $18 /* $18 = 0 => non-restartable */ 314 cmovne $26, 0, $19 /* $19 = 0 => non-restartable */
315 ldq $0, SP_OFF($sp) 315 ldq $0, SP_OFF($sp)
316 and $0, 8, $0 316 and $0, 8, $0
317 beq $0, ret_to_kernel 317 beq $0, ret_to_kernel
@@ -320,8 +320,8 @@ ret_to_user:
320 sampling and the rti. */ 320 sampling and the rti. */
321 lda $16, 7 321 lda $16, 7
322 call_pal PAL_swpipl 322 call_pal PAL_swpipl
323 ldl $17, TI_FLAGS($8) 323 ldl $5, TI_FLAGS($8)
324 and $17, _TIF_WORK_MASK, $2 324 and $5, _TIF_WORK_MASK, $2
325 bne $2, work_pending 325 bne $2, work_pending
326restore_all: 326restore_all:
327 RESTORE_ALL 327 RESTORE_ALL
@@ -341,10 +341,10 @@ $syscall_error:
341 * frame to indicate that a negative return value wasn't an 341 * frame to indicate that a negative return value wasn't an
342 * error number.. 342 * error number..
343 */ 343 */
344 ldq $18, 0($sp) /* old syscall nr (zero if success) */ 344 ldq $19, 0($sp) /* old syscall nr (zero if success) */
345 beq $18, $ret_success 345 beq $19, $ret_success
346 346
347 ldq $19, 72($sp) /* .. and this a3 */ 347 ldq $20, 72($sp) /* .. and this a3 */
348 subq $31, $0, $0 /* with error in v0 */ 348 subq $31, $0, $0 /* with error in v0 */
349 addq $31, 1, $1 /* set a3 for errno return */ 349 addq $31, 1, $1 /* set a3 for errno return */
350 stq $0, 0($sp) 350 stq $0, 0($sp)
@@ -362,35 +362,51 @@ $ret_success:
362 * Do all cleanup when returning from all interrupts and system calls. 362 * Do all cleanup when returning from all interrupts and system calls.
363 * 363 *
364 * Arguments: 364 * Arguments:
365 * $5: TI_FLAGS.
365 * $8: current. 366 * $8: current.
366 * $17: TI_FLAGS. 367 * $19: The old syscall number, or zero if this is not a return
367 * $18: The old syscall number, or zero if this is not a return
368 * from a syscall that errored and is possibly restartable. 368 * from a syscall that errored and is possibly restartable.
369 * $19: The old a3 value 369 * $20: The old a3 value
370 */ 370 */
371 371
372 .align 4 372 .align 4
373 .ent work_pending 373 .ent work_pending
374work_pending: 374work_pending:
375 and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2 375 and $5, _TIF_NEED_RESCHED, $2
376 bne $2, $work_notifysig 376 beq $2, $work_notifysig
377 377
378$work_resched: 378$work_resched:
379 /* 379 subq $sp, 16, $sp
380 * We can get here only if we returned from syscall without SIGPENDING 380 stq $19, 0($sp) /* save syscall nr */
381 * or got through work_notifysig already. Either case means no syscall 381 stq $20, 8($sp) /* and error indication (a3) */
382 * restarts for us, so let $18 and $19 burn.
383 */
384 jsr $26, schedule 382 jsr $26, schedule
385 mov 0, $18 383 ldq $19, 0($sp)
386 br ret_to_user 384 ldq $20, 8($sp)
385 addq $sp, 16, $sp
386 /* Make sure need_resched and sigpending don't change between
387 sampling and the rti. */
388 lda $16, 7
389 call_pal PAL_swpipl
390 ldl $5, TI_FLAGS($8)
391 and $5, _TIF_WORK_MASK, $2
392 beq $2, restore_all
393 and $5, _TIF_NEED_RESCHED, $2
394 bne $2, $work_resched
387 395
388$work_notifysig: 396$work_notifysig:
389 mov $sp, $16 397 mov $sp, $16
390 bsr $1, do_switch_stack 398 bsr $1, do_switch_stack
391 jsr $26, do_work_pending 399 mov $sp, $17
400 mov $5, $18
401 mov $19, $9 /* save old syscall number */
402 mov $20, $10 /* save old a3 */
403 and $5, _TIF_SIGPENDING, $2
404 cmovne $2, 0, $9 /* we don't want double syscall restarts */
405 jsr $26, do_notify_resume
406 mov $9, $19
407 mov $10, $20
392 bsr $1, undo_switch_stack 408 bsr $1, undo_switch_stack
393 br restore_all 409 br ret_to_user
394.end work_pending 410.end work_pending
395 411
396/* 412/*
@@ -402,10 +418,11 @@ $work_notifysig:
402strace: 418strace:
403 /* set up signal stack, call syscall_trace */ 419 /* set up signal stack, call syscall_trace */
404 bsr $1, do_switch_stack 420 bsr $1, do_switch_stack
405 jsr $26, syscall_trace_enter /* returns the syscall number */ 421 jsr $26, syscall_trace
406 bsr $1, undo_switch_stack 422 bsr $1, undo_switch_stack
407 423
408 /* get the arguments back.. */ 424 /* get the system call number and the arguments back.. */
425 ldq $0, 0($sp)
409 ldq $16, SP_OFF+24($sp) 426 ldq $16, SP_OFF+24($sp)
410 ldq $17, SP_OFF+32($sp) 427 ldq $17, SP_OFF+32($sp)
411 ldq $18, SP_OFF+40($sp) 428 ldq $18, SP_OFF+40($sp)
@@ -432,15 +449,15 @@ $strace_success:
432 stq $0, 0($sp) /* save return value */ 449 stq $0, 0($sp) /* save return value */
433 450
434 bsr $1, do_switch_stack 451 bsr $1, do_switch_stack
435 jsr $26, syscall_trace_leave 452 jsr $26, syscall_trace
436 bsr $1, undo_switch_stack 453 bsr $1, undo_switch_stack
437 br $31, ret_from_sys_call 454 br $31, ret_from_sys_call
438 455
439 .align 3 456 .align 3
440$strace_error: 457$strace_error:
441 ldq $18, 0($sp) /* old syscall nr (zero if success) */ 458 ldq $19, 0($sp) /* old syscall nr (zero if success) */
442 beq $18, $strace_success 459 beq $19, $strace_success
443 ldq $19, 72($sp) /* .. and this a3 */ 460 ldq $20, 72($sp) /* .. and this a3 */
444 461
445 subq $31, $0, $0 /* with error in v0 */ 462 subq $31, $0, $0 /* with error in v0 */
446 addq $31, 1, $1 /* set a3 for errno return */ 463 addq $31, 1, $1 /* set a3 for errno return */
@@ -448,11 +465,11 @@ $strace_error:
448 stq $1, 72($sp) /* a3 for return */ 465 stq $1, 72($sp) /* a3 for return */
449 466
450 bsr $1, do_switch_stack 467 bsr $1, do_switch_stack
451 mov $18, $9 /* save old syscall number */ 468 mov $19, $9 /* save old syscall number */
452 mov $19, $10 /* save old a3 */ 469 mov $20, $10 /* save old a3 */
453 jsr $26, syscall_trace_leave 470 jsr $26, syscall_trace
454 mov $9, $18 471 mov $9, $19
455 mov $10, $19 472 mov $10, $20
456 bsr $1, undo_switch_stack 473 bsr $1, undo_switch_stack
457 474
458 mov $31, $26 /* tell "ret_from_sys_call" we can restart */ 475 mov $31, $26 /* tell "ret_from_sys_call" we can restart */
@@ -592,44 +609,158 @@ ret_from_fork:
592.end ret_from_fork 609.end ret_from_fork
593 610
594/* 611/*
595 * ... and new kernel threads - here 612 * kernel_thread(fn, arg, clone_flags)
596 */ 613 */
597 .align 4 614 .align 4
598 .globl ret_from_kernel_thread 615 .globl kernel_thread
599 .ent ret_from_kernel_thread 616 .ent kernel_thread
600ret_from_kernel_thread: 617kernel_thread:
601 mov $17, $16 618 /* We can be called from a module. */
602 jsr $26, schedule_tail 619 ldgp $gp, 0($27)
603 mov $9, $27 620 .prologue 1
604 mov $10, $16 621 subq $sp, SP_OFF+6*8, $sp
605 jsr $26, ($9) 622 br $1, 2f /* load start address */
606 mov $31, $19 /* to disable syscall restarts */ 623
607 br $31, ret_to_user 624 /* We've now "returned" from a fake system call. */
608.end ret_from_kernel_thread 625 unop
626 blt $0, 1f /* error? */
627 ldi $1, 0x3fff
628 beq $20, 1f /* parent or child? */
629
630 bic $sp, $1, $8 /* in child. */
631 jsr $26, ($27)
632 ldgp $gp, 0($26)
633 mov $0, $16
634 mov $31, $26
635 jmp $31, sys_exit
636
6371: ret /* in parent. */
638
639 .align 4
6402: /* Fake a system call stack frame, as we can't do system calls
641 from kernel space. Note that we store FN and ARG as they
642 need to be set up in the child for the call. Also store $8
643 and $26 for use in the parent. */
644 stq $31, SP_OFF($sp) /* ps */
645 stq $1, SP_OFF+8($sp) /* pc */
646 stq $gp, SP_OFF+16($sp) /* gp */
647 stq $16, 136($sp) /* $27; FN for child */
648 stq $17, SP_OFF+24($sp) /* $16; ARG for child */
649 stq $8, 64($sp) /* $8 */
650 stq $26, 128($sp) /* $26 */
651 /* Avoid the HAE being gratuitously wrong, to avoid restoring it. */
652 ldq $2, alpha_mv+HAE_CACHE
653 stq $2, 152($sp) /* HAE */
654
655 /* Shuffle FLAGS to the front; add CLONE_VM. */
656 ldi $1, CLONE_VM|CLONE_UNTRACED
657 or $18, $1, $16
658 bsr $26, sys_clone
659
660 /* We don't actually care for a3 success widgetry in the kernel.
661 Not for positive errno values. */
662 stq $0, 0($sp) /* $0 */
663 br ret_to_kernel
664.end kernel_thread
665
666/*
667 * kernel_execve(path, argv, envp)
668 */
669 .align 4
670 .globl kernel_execve
671 .ent kernel_execve
672kernel_execve:
673 /* We can be called from a module. */
674 ldgp $gp, 0($27)
675 lda $sp, -(32+SIZEOF_PT_REGS+8)($sp)
676 .frame $sp, 32+SIZEOF_PT_REGS+8, $26, 0
677 stq $26, 0($sp)
678 stq $16, 8($sp)
679 stq $17, 16($sp)
680 stq $18, 24($sp)
681 .prologue 1
682
683 lda $16, 32($sp)
684 lda $17, 0
685 lda $18, SIZEOF_PT_REGS
686 bsr $26, memset !samegp
687
688 /* Avoid the HAE being gratuitously wrong, which would cause us
689 to do the whole turn off interrupts thing and restore it. */
690 ldq $2, alpha_mv+HAE_CACHE
691 stq $2, 152+32($sp)
692
693 ldq $16, 8($sp)
694 ldq $17, 16($sp)
695 ldq $18, 24($sp)
696 lda $19, 32($sp)
697 bsr $26, do_execve !samegp
698
699 ldq $26, 0($sp)
700 bne $0, 1f /* error! */
701
702 /* Move the temporary pt_regs struct from its current location
703 to the top of the kernel stack frame. See copy_thread for
704 details for a normal process. */
705 lda $16, 0x4000 - SIZEOF_PT_REGS($8)
706 lda $17, 32($sp)
707 lda $18, SIZEOF_PT_REGS
708 bsr $26, memmove !samegp
709
710 /* Take that over as our new stack frame and visit userland! */
711 lda $sp, 0x4000 - SIZEOF_PT_REGS($8)
712 br $31, ret_from_sys_call
713
7141: lda $sp, 32+SIZEOF_PT_REGS+8($sp)
715 ret
716.end kernel_execve
609 717
610 718
611/* 719/*
612 * Special system calls. Most of these are special in that they either 720 * Special system calls. Most of these are special in that they either
613 * have to play switch_stack games or in some way use the pt_regs struct. 721 * have to play switch_stack games or in some way use the pt_regs struct.
614 */ 722 */
723 .align 4
724 .globl sys_fork
725 .ent sys_fork
726sys_fork:
727 .prologue 0
728 mov $sp, $21
729 bsr $1, do_switch_stack
730 bis $31, SIGCHLD, $16
731 mov $31, $17
732 mov $31, $18
733 mov $31, $19
734 mov $31, $20
735 jsr $26, alpha_clone
736 bsr $1, undo_switch_stack
737 ret
738.end sys_fork
615 739
616.macro fork_like name
617 .align 4 740 .align 4
618 .globl alpha_\name 741 .globl sys_clone
619 .ent alpha_\name 742 .ent sys_clone
620alpha_\name: 743sys_clone:
621 .prologue 0 744 .prologue 0
745 mov $sp, $21
622 bsr $1, do_switch_stack 746 bsr $1, do_switch_stack
623 jsr $26, sys_\name 747 /* $16, $17, $18, $19, $20 come from the user. */
624 ldq $26, 56($sp) 748 jsr $26, alpha_clone
625 lda $sp, SWITCH_STACK_SIZE($sp) 749 bsr $1, undo_switch_stack
626 ret 750 ret
627.end alpha_\name 751.end sys_clone
628.endm
629 752
630fork_like fork 753 .align 4
631fork_like vfork 754 .globl sys_vfork
632fork_like clone 755 .ent sys_vfork
756sys_vfork:
757 .prologue 0
758 mov $sp, $16
759 bsr $1, do_switch_stack
760 jsr $26, alpha_vfork
761 bsr $1, undo_switch_stack
762 ret
763.end sys_vfork
633 764
634 .align 4 765 .align 4
635 .globl sys_sigreturn 766 .globl sys_sigreturn
@@ -638,10 +769,12 @@ sys_sigreturn:
638 .prologue 0 769 .prologue 0
639 lda $9, ret_from_straced 770 lda $9, ret_from_straced
640 cmpult $26, $9, $9 771 cmpult $26, $9, $9
772 mov $sp, $17
773 lda $18, -SWITCH_STACK_SIZE($sp)
641 lda $sp, -SWITCH_STACK_SIZE($sp) 774 lda $sp, -SWITCH_STACK_SIZE($sp)
642 jsr $26, do_sigreturn 775 jsr $26, do_sigreturn
643 bne $9, 1f 776 bne $9, 1f
644 jsr $26, syscall_trace_leave 777 jsr $26, syscall_trace
6451: br $1, undo_switch_stack 7781: br $1, undo_switch_stack
646 br ret_from_sys_call 779 br ret_from_sys_call
647.end sys_sigreturn 780.end sys_sigreturn
@@ -653,15 +786,135 @@ sys_rt_sigreturn:
653 .prologue 0 786 .prologue 0
654 lda $9, ret_from_straced 787 lda $9, ret_from_straced
655 cmpult $26, $9, $9 788 cmpult $26, $9, $9
789 mov $sp, $17
790 lda $18, -SWITCH_STACK_SIZE($sp)
656 lda $sp, -SWITCH_STACK_SIZE($sp) 791 lda $sp, -SWITCH_STACK_SIZE($sp)
657 jsr $26, do_rt_sigreturn 792 jsr $26, do_rt_sigreturn
658 bne $9, 1f 793 bne $9, 1f
659 jsr $26, syscall_trace_leave 794 jsr $26, syscall_trace
6601: br $1, undo_switch_stack 7951: br $1, undo_switch_stack
661 br ret_from_sys_call 796 br ret_from_sys_call
662.end sys_rt_sigreturn 797.end sys_rt_sigreturn
663 798
664 .align 4 799 .align 4
800 .globl sys_sethae
801 .ent sys_sethae
802sys_sethae:
803 .prologue 0
804 stq $16, 152($sp)
805 ret
806.end sys_sethae
807
808 .align 4
809 .globl osf_getpriority
810 .ent osf_getpriority
811osf_getpriority:
812 lda $sp, -16($sp)
813 stq $26, 0($sp)
814 .prologue 0
815
816 jsr $26, sys_getpriority
817
818 ldq $26, 0($sp)
819 blt $0, 1f
820
821 /* Return value is the unbiased priority, i.e. 20 - prio.
822 This does result in negative return values, so signal
823 no error by writing into the R0 slot. */
824 lda $1, 20
825 stq $31, 16($sp)
826 subl $1, $0, $0
827 unop
828
8291: lda $sp, 16($sp)
830 ret
831.end osf_getpriority
832
833 .align 4
834 .globl sys_getxuid
835 .ent sys_getxuid
836sys_getxuid:
837 .prologue 0
838 ldq $2, TI_TASK($8)
839 ldq $3, TASK_CRED($2)
840 ldl $0, CRED_UID($3)
841 ldl $1, CRED_EUID($3)
842 stq $1, 80($sp)
843 ret
844.end sys_getxuid
845
846 .align 4
847 .globl sys_getxgid
848 .ent sys_getxgid
849sys_getxgid:
850 .prologue 0
851 ldq $2, TI_TASK($8)
852 ldq $3, TASK_CRED($2)
853 ldl $0, CRED_GID($3)
854 ldl $1, CRED_EGID($3)
855 stq $1, 80($sp)
856 ret
857.end sys_getxgid
858
859 .align 4
860 .globl sys_getxpid
861 .ent sys_getxpid
862sys_getxpid:
863 .prologue 0
864 ldq $2, TI_TASK($8)
865
866 /* See linux/kernel/timer.c sys_getppid for discussion
867 about this loop. */
868 ldq $3, TASK_GROUP_LEADER($2)
869 ldq $4, TASK_REAL_PARENT($3)
870 ldl $0, TASK_TGID($2)
8711: ldl $1, TASK_TGID($4)
872#ifdef CONFIG_SMP
873 mov $4, $5
874 mb
875 ldq $3, TASK_GROUP_LEADER($2)
876 ldq $4, TASK_REAL_PARENT($3)
877 cmpeq $4, $5, $5
878 beq $5, 1b
879#endif
880 stq $1, 80($sp)
881 ret
882.end sys_getxpid
883
884 .align 4
885 .globl sys_alpha_pipe
886 .ent sys_alpha_pipe
887sys_alpha_pipe:
888 lda $sp, -16($sp)
889 stq $26, 0($sp)
890 .prologue 0
891
892 mov $31, $17
893 lda $16, 8($sp)
894 jsr $26, do_pipe_flags
895
896 ldq $26, 0($sp)
897 bne $0, 1f
898
899 /* The return values are in $0 and $20. */
900 ldl $1, 12($sp)
901 ldl $0, 8($sp)
902
903 stq $1, 80+16($sp)
9041: lda $sp, 16($sp)
905 ret
906.end sys_alpha_pipe
907
908 .align 4
909 .globl sys_execve
910 .ent sys_execve
911sys_execve:
912 .prologue 0
913 mov $sp, $19
914 jmp $31, do_sys_execve
915.end sys_execve
916
917 .align 4
665 .globl alpha_ni_syscall 918 .globl alpha_ni_syscall
666 .ent alpha_ni_syscall 919 .ent alpha_ni_syscall
667alpha_ni_syscall: 920alpha_ni_syscall:
diff --git a/arch/alpha/kernel/err_impl.h b/arch/alpha/kernel/err_impl.h
index ae529c41603..0c010ca4611 100644
--- a/arch/alpha/kernel/err_impl.h
+++ b/arch/alpha/kernel/err_impl.h
@@ -7,8 +7,6 @@
7 * implementations. 7 * implementations.
8 */ 8 */
9 9
10#include <asm/mce.h>
11
12union el_timestamp; 10union el_timestamp;
13struct el_subpacket; 11struct el_subpacket;
14struct ev7_lf_subpackets; 12struct ev7_lf_subpackets;
diff --git a/arch/alpha/kernel/head.S b/arch/alpha/kernel/head.S
index c352499ab9f..4bdd1d2ff35 100644
--- a/arch/alpha/kernel/head.S
+++ b/arch/alpha/kernel/head.S
@@ -8,12 +8,14 @@
8 */ 8 */
9 9
10#include <linux/init.h> 10#include <linux/init.h>
11#include <asm/system.h>
11#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
12#include <asm/pal.h>
13#include <asm/setup.h>
14 13
15__HEAD 14__HEAD
15.globl swapper_pg_dir
16.globl _stext 16.globl _stext
17swapper_pg_dir=SWAPPER_PGD
18
17 .set noreorder 19 .set noreorder
18 .globl __start 20 .globl __start
19 .ent __start 21 .ent __start
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index 2872accd221..381431a2d6d 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -26,6 +26,7 @@
26#include <linux/profile.h> 26#include <linux/profile.h>
27#include <linux/bitops.h> 27#include <linux/bitops.h>
28 28
29#include <asm/system.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31 32
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index 772ddfdb71a..51b7fbd9e4c 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -11,7 +11,6 @@
11#include <asm/machvec.h> 11#include <asm/machvec.h>
12#include <asm/dma.h> 12#include <asm/dma.h>
13#include <asm/perf_event.h> 13#include <asm/perf_event.h>
14#include <asm/mce.h>
15 14
16#include "proto.h" 15#include "proto.h"
17#include "irq_impl.h" 16#include "irq_impl.h"
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 14db93e4c8a..01e8715e26d 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -40,6 +40,7 @@
40#include <asm/fpu.h> 40#include <asm/fpu.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/system.h>
43#include <asm/sysinfo.h> 44#include <asm/sysinfo.h>
44#include <asm/thread_info.h> 45#include <asm/thread_info.h>
45#include <asm/hwrpb.h> 46#include <asm/hwrpb.h>
@@ -145,24 +146,27 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
145 long __user *, basep) 146 long __user *, basep)
146{ 147{
147 int error; 148 int error;
148 struct fd arg = fdget(fd); 149 struct file *file;
149 struct osf_dirent_callback buf; 150 struct osf_dirent_callback buf;
150 151
151 if (!arg.file) 152 error = -EBADF;
152 return -EBADF; 153 file = fget(fd);
154 if (!file)
155 goto out;
153 156
154 buf.dirent = dirent; 157 buf.dirent = dirent;
155 buf.basep = basep; 158 buf.basep = basep;
156 buf.count = count; 159 buf.count = count;
157 buf.error = 0; 160 buf.error = 0;
158 161
159 error = vfs_readdir(arg.file, osf_filldir, &buf); 162 error = vfs_readdir(file, osf_filldir, &buf);
160 if (error >= 0) 163 if (error >= 0)
161 error = buf.error; 164 error = buf.error;
162 if (count != buf.count) 165 if (count != buf.count)
163 error = count - buf.count; 166 error = count - buf.count;
164 167
165 fdput(arg); 168 fput(file);
169 out:
166 return error; 170 return error;
167} 171}
168 172
@@ -188,39 +192,6 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
188 return ret; 192 return ret;
189} 193}
190 194
191struct osf_stat {
192 int st_dev;
193 int st_pad1;
194 unsigned st_mode;
195 unsigned short st_nlink;
196 short st_nlink_reserved;
197 unsigned st_uid;
198 unsigned st_gid;
199 int st_rdev;
200 int st_ldev;
201 long st_size;
202 int st_pad2;
203 int st_uatime;
204 int st_pad3;
205 int st_umtime;
206 int st_pad4;
207 int st_uctime;
208 int st_pad5;
209 int st_pad6;
210 unsigned st_flags;
211 unsigned st_gen;
212 long st_spare[4];
213 unsigned st_ino;
214 int st_ino_reserved;
215 int st_atime;
216 int st_atime_reserved;
217 int st_mtime;
218 int st_mtime_reserved;
219 int st_ctime;
220 int st_ctime_reserved;
221 long st_blksize;
222 long st_blocks;
223};
224 195
225/* 196/*
226 * The OSF/1 statfs structure is much larger, but this should 197 * The OSF/1 statfs structure is much larger, but this should
@@ -239,60 +210,6 @@ struct osf_statfs {
239 __kernel_fsid_t f_fsid; 210 __kernel_fsid_t f_fsid;
240}; 211};
241 212
242struct osf_statfs64 {
243 short f_type;
244 short f_flags;
245 int f_pad1;
246 int f_pad2;
247 int f_pad3;
248 int f_pad4;
249 int f_pad5;
250 int f_pad6;
251 int f_pad7;
252 __kernel_fsid_t f_fsid;
253 u_short f_namemax;
254 short f_reserved1;
255 int f_spare[8];
256 char f_pad8[90];
257 char f_pad9[90];
258 long mount_info[10];
259 u_long f_flags2;
260 long f_spare2[14];
261 long f_fsize;
262 long f_bsize;
263 long f_blocks;
264 long f_bfree;
265 long f_bavail;
266 long f_files;
267 long f_ffree;
268};
269
270static int
271linux_to_osf_stat(struct kstat *lstat, struct osf_stat __user *osf_stat)
272{
273 struct osf_stat tmp = { 0 };
274
275 tmp.st_dev = lstat->dev;
276 tmp.st_mode = lstat->mode;
277 tmp.st_nlink = lstat->nlink;
278 tmp.st_uid = from_kuid_munged(current_user_ns(), lstat->uid);
279 tmp.st_gid = from_kgid_munged(current_user_ns(), lstat->gid);
280 tmp.st_rdev = lstat->rdev;
281 tmp.st_ldev = lstat->rdev;
282 tmp.st_size = lstat->size;
283 tmp.st_uatime = lstat->atime.tv_nsec / 1000;
284 tmp.st_umtime = lstat->mtime.tv_nsec / 1000;
285 tmp.st_uctime = lstat->ctime.tv_nsec / 1000;
286 tmp.st_ino = lstat->ino;
287 tmp.st_atime = lstat->atime.tv_sec;
288 tmp.st_mtime = lstat->mtime.tv_sec;
289 tmp.st_ctime = lstat->ctime.tv_sec;
290 tmp.st_blksize = lstat->blksize;
291 tmp.st_blocks = lstat->blocks;
292
293 return copy_to_user(osf_stat, &tmp, sizeof(tmp)) ? -EFAULT : 0;
294}
295
296static int 213static int
297linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat, 214linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat,
298 unsigned long bufsiz) 215 unsigned long bufsiz)
@@ -314,26 +231,6 @@ linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_st
314 return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0; 231 return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0;
315} 232}
316 233
317static int
318linux_to_osf_statfs64(struct kstatfs *linux_stat, struct osf_statfs64 __user *osf_stat,
319 unsigned long bufsiz)
320{
321 struct osf_statfs64 tmp_stat = { 0 };
322
323 tmp_stat.f_type = linux_stat->f_type;
324 tmp_stat.f_fsize = linux_stat->f_frsize;
325 tmp_stat.f_bsize = linux_stat->f_bsize;
326 tmp_stat.f_blocks = linux_stat->f_blocks;
327 tmp_stat.f_bfree = linux_stat->f_bfree;
328 tmp_stat.f_bavail = linux_stat->f_bavail;
329 tmp_stat.f_files = linux_stat->f_files;
330 tmp_stat.f_ffree = linux_stat->f_ffree;
331 tmp_stat.f_fsid = linux_stat->f_fsid;
332 if (bufsiz > sizeof(tmp_stat))
333 bufsiz = sizeof(tmp_stat);
334 return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0;
335}
336
337SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, 234SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
338 struct osf_statfs __user *, buffer, unsigned long, bufsiz) 235 struct osf_statfs __user *, buffer, unsigned long, bufsiz)
339{ 236{
@@ -344,42 +241,6 @@ SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
344 return error; 241 return error;
345} 242}
346 243
347SYSCALL_DEFINE2(osf_stat, char __user *, name, struct osf_stat __user *, buf)
348{
349 struct kstat stat;
350 int error;
351
352 error = vfs_stat(name, &stat);
353 if (error)
354 return error;
355
356 return linux_to_osf_stat(&stat, buf);
357}
358
359SYSCALL_DEFINE2(osf_lstat, char __user *, name, struct osf_stat __user *, buf)
360{
361 struct kstat stat;
362 int error;
363
364 error = vfs_lstat(name, &stat);
365 if (error)
366 return error;
367
368 return linux_to_osf_stat(&stat, buf);
369}
370
371SYSCALL_DEFINE2(osf_fstat, int, fd, struct osf_stat __user *, buf)
372{
373 struct kstat stat;
374 int error;
375
376 error = vfs_fstat(fd, &stat);
377 if (error)
378 return error;
379
380 return linux_to_osf_stat(&stat, buf);
381}
382
383SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, 244SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
384 struct osf_statfs __user *, buffer, unsigned long, bufsiz) 245 struct osf_statfs __user *, buffer, unsigned long, bufsiz)
385{ 246{
@@ -390,26 +251,6 @@ SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
390 return error; 251 return error;
391} 252}
392 253
393SYSCALL_DEFINE3(osf_statfs64, char __user *, pathname,
394 struct osf_statfs64 __user *, buffer, unsigned long, bufsiz)
395{
396 struct kstatfs linux_stat;
397 int error = user_statfs(pathname, &linux_stat);
398 if (!error)
399 error = linux_to_osf_statfs64(&linux_stat, buffer, bufsiz);
400 return error;
401}
402
403SYSCALL_DEFINE3(osf_fstatfs64, unsigned long, fd,
404 struct osf_statfs64 __user *, buffer, unsigned long, bufsiz)
405{
406 struct kstatfs linux_stat;
407 int error = fd_statfs(fd, &linux_stat);
408 if (!error)
409 error = linux_to_osf_statfs64(&linux_stat, buffer, bufsiz);
410 return error;
411}
412
413/* 254/*
414 * Uhh.. OSF/1 mount parameters aren't exactly obvious.. 255 * Uhh.. OSF/1 mount parameters aren't exactly obvious..
415 * 256 *
@@ -445,11 +286,11 @@ struct procfs_args {
445 * unhappy with OSF UFS. [CHECKME] 286 * unhappy with OSF UFS. [CHECKME]
446 */ 287 */
447static int 288static int
448osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags) 289osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags)
449{ 290{
450 int retval; 291 int retval;
451 struct cdfs_args tmp; 292 struct cdfs_args tmp;
452 struct filename *devname; 293 char *devname;
453 294
454 retval = -EFAULT; 295 retval = -EFAULT;
455 if (copy_from_user(&tmp, args, sizeof(tmp))) 296 if (copy_from_user(&tmp, args, sizeof(tmp)))
@@ -458,18 +299,18 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
458 retval = PTR_ERR(devname); 299 retval = PTR_ERR(devname);
459 if (IS_ERR(devname)) 300 if (IS_ERR(devname))
460 goto out; 301 goto out;
461 retval = do_mount(devname->name, dirname, "ext2", flags, NULL); 302 retval = do_mount(devname, dirname, "ext2", flags, NULL);
462 putname(devname); 303 putname(devname);
463 out: 304 out:
464 return retval; 305 return retval;
465} 306}
466 307
467static int 308static int
468osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags) 309osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags)
469{ 310{
470 int retval; 311 int retval;
471 struct cdfs_args tmp; 312 struct cdfs_args tmp;
472 struct filename *devname; 313 char *devname;
473 314
474 retval = -EFAULT; 315 retval = -EFAULT;
475 if (copy_from_user(&tmp, args, sizeof(tmp))) 316 if (copy_from_user(&tmp, args, sizeof(tmp)))
@@ -478,14 +319,14 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
478 retval = PTR_ERR(devname); 319 retval = PTR_ERR(devname);
479 if (IS_ERR(devname)) 320 if (IS_ERR(devname))
480 goto out; 321 goto out;
481 retval = do_mount(devname->name, dirname, "iso9660", flags, NULL); 322 retval = do_mount(devname, dirname, "iso9660", flags, NULL);
482 putname(devname); 323 putname(devname);
483 out: 324 out:
484 return retval; 325 return retval;
485} 326}
486 327
487static int 328static int
488osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int flags) 329osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
489{ 330{
490 struct procfs_args tmp; 331 struct procfs_args tmp;
491 332
@@ -499,7 +340,7 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
499 int, flag, void __user *, data) 340 int, flag, void __user *, data)
500{ 341{
501 int retval; 342 int retval;
502 struct filename *name; 343 char *name;
503 344
504 name = getname(path); 345 name = getname(path);
505 retval = PTR_ERR(name); 346 retval = PTR_ERR(name);
@@ -507,13 +348,13 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
507 goto out; 348 goto out;
508 switch (typenr) { 349 switch (typenr) {
509 case 1: 350 case 1:
510 retval = osf_ufs_mount(name->name, data, flag); 351 retval = osf_ufs_mount(name, data, flag);
511 break; 352 break;
512 case 6: 353 case 6:
513 retval = osf_cdfs_mount(name->name, data, flag); 354 retval = osf_cdfs_mount(name, data, flag);
514 break; 355 break;
515 case 9: 356 case 9:
516 retval = osf_procfs_mount(name->name, data, flag); 357 retval = osf_procfs_mount(name, data, flag);
517 break; 358 break;
518 default: 359 default:
519 retval = -EINVAL; 360 retval = -EINVAL;
@@ -793,7 +634,8 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer,
793 case GSI_UACPROC: 634 case GSI_UACPROC:
794 if (nbytes < sizeof(unsigned int)) 635 if (nbytes < sizeof(unsigned int))
795 return -EINVAL; 636 return -EINVAL;
796 w = current_thread_info()->status & UAC_BITMASK; 637 w = (current_thread_info()->flags >> ALPHA_UAC_SHIFT) &
638 UAC_BITMASK;
797 if (put_user(w, (unsigned int __user *)buffer)) 639 if (put_user(w, (unsigned int __user *)buffer))
798 return -EFAULT; 640 return -EFAULT;
799 return 1; 641 return 1;
@@ -903,20 +745,24 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
903 break; 745 break;
904 746
905 case SSI_NVPAIRS: { 747 case SSI_NVPAIRS: {
906 unsigned __user *p = buffer; 748 unsigned long v, w, i;
907 unsigned i; 749 unsigned int old, new;
908 750
909 for (i = 0, p = buffer; i < nbytes; ++i, p += 2) { 751 for (i = 0; i < nbytes; ++i) {
910 unsigned v, w, status;
911 752
912 if (get_user(v, p) || get_user(w, p + 1)) 753 if (get_user(v, 2*i + (unsigned int __user *)buffer))
754 return -EFAULT;
755 if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer))
913 return -EFAULT; 756 return -EFAULT;
914 switch (v) { 757 switch (v) {
915 case SSIN_UACPROC: 758 case SSIN_UACPROC:
916 w &= UAC_BITMASK; 759 again:
917 status = current_thread_info()->status; 760 old = current_thread_info()->flags;
918 status = (status & ~UAC_BITMASK) | w; 761 new = old & ~(UAC_BITMASK << ALPHA_UAC_SHIFT);
919 current_thread_info()->status = status; 762 new = new | (w & UAC_BITMASK) << ALPHA_UAC_SHIFT;
763 if (cmpxchg(&current_thread_info()->flags,
764 old, new) != old)
765 goto again;
920 break; 766 break;
921 767
922 default: 768 default:
@@ -926,9 +772,6 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
926 return 0; 772 return 0;
927 } 773 }
928 774
929 case SSI_LMF:
930 return 0;
931
932 default: 775 default:
933 break; 776 break;
934 } 777 }
@@ -1396,52 +1239,3 @@ SYSCALL_DEFINE3(osf_writev, unsigned long, fd,
1396} 1239}
1397 1240
1398#endif 1241#endif
1399
1400SYSCALL_DEFINE2(osf_getpriority, int, which, int, who)
1401{
1402 int prio = sys_getpriority(which, who);
1403 if (prio >= 0) {
1404 /* Return value is the unbiased priority, i.e. 20 - prio.
1405 This does result in negative return values, so signal
1406 no error */
1407 force_successful_syscall_return();
1408 prio = 20 - prio;
1409 }
1410 return prio;
1411}
1412
1413SYSCALL_DEFINE0(getxuid)
1414{
1415 current_pt_regs()->r20 = sys_geteuid();
1416 return sys_getuid();
1417}
1418
1419SYSCALL_DEFINE0(getxgid)
1420{
1421 current_pt_regs()->r20 = sys_getegid();
1422 return sys_getgid();
1423}
1424
1425SYSCALL_DEFINE0(getxpid)
1426{
1427 current_pt_regs()->r20 = sys_getppid();
1428 return sys_getpid();
1429}
1430
1431SYSCALL_DEFINE0(alpha_pipe)
1432{
1433 int fd[2];
1434 int res = do_pipe_flags(fd, 0);
1435 if (!res) {
1436 /* The return values are in $0 and $20. */
1437 current_pt_regs()->r20 = fd[1];
1438 res = fd[0];
1439 }
1440 return res;
1441}
1442
1443SYSCALL_DEFINE1(sethae, unsigned long, val)
1444{
1445 current_pt_regs()->hae = val;
1446 return 0;
1447}
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index df24b76f924..246100ef07c 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -108,8 +108,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
108} 108}
109 109
110static void *alpha_noop_alloc_coherent(struct device *dev, size_t size, 110static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
111 dma_addr_t *dma_handle, gfp_t gfp, 111 dma_addr_t *dma_handle, gfp_t gfp)
112 struct dma_attrs *attrs)
113{ 112{
114 void *ret; 113 void *ret;
115 114
@@ -124,8 +123,7 @@ static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
124} 123}
125 124
126static void alpha_noop_free_coherent(struct device *dev, size_t size, 125static void alpha_noop_free_coherent(struct device *dev, size_t size,
127 void *cpu_addr, dma_addr_t dma_addr, 126 void *cpu_addr, dma_addr_t dma_addr)
128 struct dma_attrs *attrs)
129{ 127{
130 free_pages((unsigned long)cpu_addr, get_order(size)); 128 free_pages((unsigned long)cpu_addr, get_order(size));
131} 129}
@@ -176,8 +174,8 @@ static int alpha_noop_set_mask(struct device *dev, u64 mask)
176} 174}
177 175
178struct dma_map_ops alpha_noop_ops = { 176struct dma_map_ops alpha_noop_ops = {
179 .alloc = alpha_noop_alloc_coherent, 177 .alloc_coherent = alpha_noop_alloc_coherent,
180 .free = alpha_noop_free_coherent, 178 .free_coherent = alpha_noop_free_coherent,
181 .map_page = alpha_noop_map_page, 179 .map_page = alpha_noop_map_page,
182 .map_sg = alpha_noop_map_sg, 180 .map_sg = alpha_noop_map_sg,
183 .mapping_error = alpha_noop_mapping_error, 181 .mapping_error = alpha_noop_mapping_error,
@@ -187,3 +185,15 @@ struct dma_map_ops alpha_noop_ops = {
187 185
188struct dma_map_ops *dma_ops = &alpha_noop_ops; 186struct dma_map_ops *dma_ops = &alpha_noop_ops;
189EXPORT_SYMBOL(dma_ops); 187EXPORT_SYMBOL(dma_ops);
188
189void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
190{
191 return NULL;
192}
193
194void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
195{
196}
197
198EXPORT_SYMBOL(pci_iomap);
199EXPORT_SYMBOL(pci_iounmap);
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index b51f7b4818c..b899e95f79f 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/stat.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
15#include <linux/pci.h> 14#include <linux/pci.h>
16 15
@@ -26,7 +25,7 @@ static int hose_mmap_page_range(struct pci_controller *hose,
26 base = sparse ? hose->sparse_io_base : hose->dense_io_base; 25 base = sparse ? hose->sparse_io_base : hose->dense_io_base;
27 26
28 vma->vm_pgoff += base >> PAGE_SHIFT; 27 vma->vm_pgoff += base >> PAGE_SHIFT;
29 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; 28 vma->vm_flags |= (VM_IO | VM_RESERVED);
30 29
31 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 30 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
32 vma->vm_end - vma->vm_start, 31 vma->vm_end - vma->vm_start,
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index edb4e0097b7..c9ab94ee1ca 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -43,10 +43,12 @@ const char *const pci_mem_names[] = {
43 43
44const char pci_hae0_name[] = "HAE0"; 44const char pci_hae0_name[] = "HAE0";
45 45
46/* Indicate whether we respect the PCI setup left by console. */
46/* 47/*
47 * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource 48 * Make this long-lived so that we know when shutting down
48 * assignments. 49 * whether we probed only or not.
49 */ 50 */
51int pci_probe_only;
50 52
51/* 53/*
52 * The PCI controller list. 54 * The PCI controller list.
@@ -59,13 +61,15 @@ struct pci_controller *pci_isa_hose;
59 * Quirks. 61 * Quirks.
60 */ 62 */
61 63
62static void quirk_isa_bridge(struct pci_dev *dev) 64static void __init
65quirk_isa_bridge(struct pci_dev *dev)
63{ 66{
64 dev->class = PCI_CLASS_BRIDGE_ISA << 8; 67 dev->class = PCI_CLASS_BRIDGE_ISA << 8;
65} 68}
66DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge); 69DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge);
67 70
68static void quirk_cypress(struct pci_dev *dev) 71static void __init
72quirk_cypress(struct pci_dev *dev)
69{ 73{
70 /* The Notorious Cy82C693 chip. */ 74 /* The Notorious Cy82C693 chip. */
71 75
@@ -104,7 +108,8 @@ static void quirk_cypress(struct pci_dev *dev)
104DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress); 108DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress);
105 109
106/* Called for each device after PCI setup is done. */ 110/* Called for each device after PCI setup is done. */
107static void pcibios_fixup_final(struct pci_dev *dev) 111static void __init
112pcibios_fixup_final(struct pci_dev *dev)
108{ 113{
109 unsigned int class = dev->class >> 8; 114 unsigned int class = dev->class >> 8;
110 115
@@ -195,15 +200,22 @@ pcibios_init(void)
195 200
196subsys_initcall(pcibios_init); 201subsys_initcall(pcibios_init);
197 202
203char * __devinit
204pcibios_setup(char *str)
205{
206 return str;
207}
208
198#ifdef ALPHA_RESTORE_SRM_SETUP 209#ifdef ALPHA_RESTORE_SRM_SETUP
199static struct pdev_srm_saved_conf *srm_saved_configs; 210static struct pdev_srm_saved_conf *srm_saved_configs;
200 211
201void pdev_save_srm_config(struct pci_dev *dev) 212void __devinit
213pdev_save_srm_config(struct pci_dev *dev)
202{ 214{
203 struct pdev_srm_saved_conf *tmp; 215 struct pdev_srm_saved_conf *tmp;
204 static int printed = 0; 216 static int printed = 0;
205 217
206 if (!alpha_using_srm || pci_has_flag(PCI_PROBE_ONLY)) 218 if (!alpha_using_srm || pci_probe_only)
207 return; 219 return;
208 220
209 if (!printed) { 221 if (!printed) {
@@ -230,7 +242,7 @@ pci_restore_srm_config(void)
230 struct pdev_srm_saved_conf *tmp; 242 struct pdev_srm_saved_conf *tmp;
231 243
232 /* No need to restore if probed only. */ 244 /* No need to restore if probed only. */
233 if (pci_has_flag(PCI_PROBE_ONLY)) 245 if (pci_probe_only)
234 return; 246 return;
235 247
236 /* Restore SRM config. */ 248 /* Restore SRM config. */
@@ -240,20 +252,110 @@ pci_restore_srm_config(void)
240} 252}
241#endif 253#endif
242 254
243void pcibios_fixup_bus(struct pci_bus *bus) 255void __devinit
256pcibios_fixup_resource(struct resource *res, struct resource *root)
257{
258 res->start += root->start;
259 res->end += root->start;
260}
261
262void __devinit
263pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
244{ 264{
265 /* Update device resources. */
266 struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
267 int i;
268
269 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
270 if (!dev->resource[i].start)
271 continue;
272 if (dev->resource[i].flags & IORESOURCE_IO)
273 pcibios_fixup_resource(&dev->resource[i],
274 hose->io_space);
275 else if (dev->resource[i].flags & IORESOURCE_MEM)
276 pcibios_fixup_resource(&dev->resource[i],
277 hose->mem_space);
278 }
279}
280
281void __devinit
282pcibios_fixup_bus(struct pci_bus *bus)
283{
284 /* Propagate hose info into the subordinate devices. */
285
286 struct pci_controller *hose = bus->sysdata;
245 struct pci_dev *dev = bus->self; 287 struct pci_dev *dev = bus->self;
246 288
247 if (pci_has_flag(PCI_PROBE_ONLY) && dev && 289 if (!dev) {
290 /* Root bus. */
291 u32 pci_mem_end;
292 u32 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0;
293 unsigned long end;
294
295 bus->resource[0] = hose->io_space;
296 bus->resource[1] = hose->mem_space;
297
298 /* Adjust hose mem_space limit to prevent PCI allocations
299 in the iommu windows. */
300 pci_mem_end = min((u32)__direct_map_base, sg_base) - 1;
301 end = hose->mem_space->start + pci_mem_end;
302 if (hose->mem_space->end > end)
303 hose->mem_space->end = end;
304 } else if (pci_probe_only &&
248 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 305 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
249 pci_read_bridge_bases(bus); 306 pci_read_bridge_bases(bus);
307 pcibios_fixup_device_resources(dev, bus);
250 } 308 }
251 309
252 list_for_each_entry(dev, &bus->devices, bus_list) { 310 list_for_each_entry(dev, &bus->devices, bus_list) {
253 pdev_save_srm_config(dev); 311 pdev_save_srm_config(dev);
312 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
313 pcibios_fixup_device_resources(dev, bus);
254 } 314 }
255} 315}
256 316
317void __init
318pcibios_update_irq(struct pci_dev *dev, int irq)
319{
320 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
321}
322
323void
324pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
325 struct resource *res)
326{
327 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
328 unsigned long offset = 0;
329
330 if (res->flags & IORESOURCE_IO)
331 offset = hose->io_space->start;
332 else if (res->flags & IORESOURCE_MEM)
333 offset = hose->mem_space->start;
334
335 region->start = res->start - offset;
336 region->end = res->end - offset;
337}
338
339void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
340 struct pci_bus_region *region)
341{
342 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
343 unsigned long offset = 0;
344
345 if (res->flags & IORESOURCE_IO)
346 offset = hose->io_space->start;
347 else if (res->flags & IORESOURCE_MEM)
348 offset = hose->mem_space->start;
349
350 res->start = region->start + offset;
351 res->end = region->end + offset;
352}
353
354#ifdef CONFIG_HOTPLUG
355EXPORT_SYMBOL(pcibios_resource_to_bus);
356EXPORT_SYMBOL(pcibios_bus_to_resource);
357#endif
358
257int 359int
258pcibios_enable_device(struct pci_dev *dev, int mask) 360pcibios_enable_device(struct pci_dev *dev, int mask)
259{ 361{
@@ -290,8 +392,7 @@ pcibios_claim_one_bus(struct pci_bus *b)
290 392
291 if (r->parent || !r->start || !r->flags) 393 if (r->parent || !r->start || !r->flags)
292 continue; 394 continue;
293 if (pci_has_flag(PCI_PROBE_ONLY) || 395 if (pci_probe_only || (r->flags & IORESOURCE_PCI_FIXED))
294 (r->flags & IORESOURCE_PCI_FIXED))
295 pci_claim_resource(dev, i); 396 pci_claim_resource(dev, i);
296 } 397 }
297 } 398 }
@@ -313,36 +414,16 @@ void __init
313common_init_pci(void) 414common_init_pci(void)
314{ 415{
315 struct pci_controller *hose; 416 struct pci_controller *hose;
316 struct list_head resources;
317 struct pci_bus *bus; 417 struct pci_bus *bus;
318 int next_busno; 418 int next_busno;
319 int need_domain_info = 0; 419 int need_domain_info = 0;
320 u32 pci_mem_end;
321 u32 sg_base;
322 unsigned long end;
323 420
324 /* Scan all of the recorded PCI controllers. */ 421 /* Scan all of the recorded PCI controllers. */
325 for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { 422 for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
326 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; 423 bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose);
327
328 /* Adjust hose mem_space limit to prevent PCI allocations
329 in the iommu windows. */
330 pci_mem_end = min((u32)__direct_map_base, sg_base) - 1;
331 end = hose->mem_space->start + pci_mem_end;
332 if (hose->mem_space->end > end)
333 hose->mem_space->end = end;
334
335 INIT_LIST_HEAD(&resources);
336 pci_add_resource_offset(&resources, hose->io_space,
337 hose->io_space->start);
338 pci_add_resource_offset(&resources, hose->mem_space,
339 hose->mem_space->start);
340
341 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
342 hose, &resources);
343 hose->bus = bus; 424 hose->bus = bus;
344 hose->need_domain_info = need_domain_info; 425 hose->need_domain_info = need_domain_info;
345 next_busno = bus->busn_res.end + 1; 426 next_busno = bus->subordinate + 1;
346 /* Don't allow 8-bit bus number overflow inside the hose - 427 /* Don't allow 8-bit bus number overflow inside the hose -
347 reserve some space for bridges. */ 428 reserve some space for bridges. */
348 if (next_busno > 224) { 429 if (next_busno > 224) {
@@ -427,7 +508,30 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
427 return -EOPNOTSUPP; 508 return -EOPNOTSUPP;
428} 509}
429 510
430/* Destroy an __iomem token. Not copied from lib/iomap.c. */ 511/* Create an __iomem token from a PCI BAR. Copied from lib/iomap.c with
512 no changes, since we don't want the other things in that object file. */
513
514void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
515{
516 resource_size_t start = pci_resource_start(dev, bar);
517 resource_size_t len = pci_resource_len(dev, bar);
518 unsigned long flags = pci_resource_flags(dev, bar);
519
520 if (!len || !start)
521 return NULL;
522 if (maxlen && len > maxlen)
523 len = maxlen;
524 if (flags & IORESOURCE_IO)
525 return ioport_map(start, len);
526 if (flags & IORESOURCE_MEM) {
527 /* Not checking IORESOURCE_CACHEABLE because alpha does
528 not distinguish between ioremap and ioremap_nocache. */
529 return ioremap(start, len);
530 }
531 return NULL;
532}
533
534/* Destroy that token. Not copied from lib/iomap.c. */
431 535
432void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 536void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
433{ 537{
@@ -435,6 +539,7 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
435 iounmap(addr); 539 iounmap(addr);
436} 540}
437 541
542EXPORT_SYMBOL(pci_iomap);
438EXPORT_SYMBOL(pci_iounmap); 543EXPORT_SYMBOL(pci_iounmap);
439 544
440/* FIXME: Some boxes have multiple ISA bridges! */ 545/* FIXME: Some boxes have multiple ISA bridges! */
diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h
index 2b0ac429f5e..85457b2d451 100644
--- a/arch/alpha/kernel/pci_impl.h
+++ b/arch/alpha/kernel/pci_impl.h
@@ -173,6 +173,9 @@ extern void pci_restore_srm_config(void);
173extern struct pci_controller *hose_head, **hose_tail; 173extern struct pci_controller *hose_head, **hose_tail;
174extern struct pci_controller *pci_isa_hose; 174extern struct pci_controller *pci_isa_hose;
175 175
176/* Indicate that we trust the console to configure things properly. */
177extern int pci_probe_only;
178
176extern unsigned long alpha_agpgart_size; 179extern unsigned long alpha_agpgart_size;
177 180
178extern void common_init_pci(void); 181extern void common_init_pci(void);
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index a21d0ab3b19..022c2748fa4 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -7,7 +7,6 @@
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/export.h>
11#include <linux/scatterlist.h> 10#include <linux/scatterlist.h>
12#include <linux/log2.h> 11#include <linux/log2.h>
13#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
@@ -236,7 +235,7 @@ static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
236 ok = 0; 235 ok = 0;
237 236
238 /* If both conditions above are met, we are fine. */ 237 /* If both conditions above are met, we are fine. */
239 DBGA("pci_dac_dma_supported %s from %pf\n", 238 DBGA("pci_dac_dma_supported %s from %p\n",
240 ok ? "yes" : "no", __builtin_return_address(0)); 239 ok ? "yes" : "no", __builtin_return_address(0));
241 240
242 return ok; 241 return ok;
@@ -268,7 +267,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
268 && paddr + size <= __direct_map_size) { 267 && paddr + size <= __direct_map_size) {
269 ret = paddr + __direct_map_base; 268 ret = paddr + __direct_map_base;
270 269
271 DBGA2("pci_map_single: [%p,%zx] -> direct %llx from %pf\n", 270 DBGA2("pci_map_single: [%p,%zx] -> direct %llx from %p\n",
272 cpu_addr, size, ret, __builtin_return_address(0)); 271 cpu_addr, size, ret, __builtin_return_address(0));
273 272
274 return ret; 273 return ret;
@@ -279,7 +278,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
279 if (dac_allowed) { 278 if (dac_allowed) {
280 ret = paddr + alpha_mv.pci_dac_offset; 279 ret = paddr + alpha_mv.pci_dac_offset;
281 280
282 DBGA2("pci_map_single: [%p,%zx] -> DAC %llx from %pf\n", 281 DBGA2("pci_map_single: [%p,%zx] -> DAC %llx from %p\n",
283 cpu_addr, size, ret, __builtin_return_address(0)); 282 cpu_addr, size, ret, __builtin_return_address(0));
284 283
285 return ret; 284 return ret;
@@ -316,7 +315,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
316 ret = arena->dma_base + dma_ofs * PAGE_SIZE; 315 ret = arena->dma_base + dma_ofs * PAGE_SIZE;
317 ret += (unsigned long)cpu_addr & ~PAGE_MASK; 316 ret += (unsigned long)cpu_addr & ~PAGE_MASK;
318 317
319 DBGA2("pci_map_single: [%p,%zx] np %ld -> sg %llx from %pf\n", 318 DBGA2("pci_map_single: [%p,%zx] np %ld -> sg %llx from %p\n",
320 cpu_addr, size, npages, ret, __builtin_return_address(0)); 319 cpu_addr, size, npages, ret, __builtin_return_address(0));
321 320
322 return ret; 321 return ret;
@@ -354,7 +353,8 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,
354 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 353 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
355 int dac_allowed; 354 int dac_allowed;
356 355
357 BUG_ON(dir == PCI_DMA_NONE); 356 if (dir == PCI_DMA_NONE)
357 BUG();
358 358
359 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 359 dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
360 return pci_map_single_1(pdev, (char *)page_address(page) + offset, 360 return pci_map_single_1(pdev, (char *)page_address(page) + offset,
@@ -377,20 +377,21 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
377 struct pci_iommu_arena *arena; 377 struct pci_iommu_arena *arena;
378 long dma_ofs, npages; 378 long dma_ofs, npages;
379 379
380 BUG_ON(dir == PCI_DMA_NONE); 380 if (dir == PCI_DMA_NONE)
381 BUG();
381 382
382 if (dma_addr >= __direct_map_base 383 if (dma_addr >= __direct_map_base
383 && dma_addr < __direct_map_base + __direct_map_size) { 384 && dma_addr < __direct_map_base + __direct_map_size) {
384 /* Nothing to do. */ 385 /* Nothing to do. */
385 386
386 DBGA2("pci_unmap_single: direct [%llx,%zx] from %pf\n", 387 DBGA2("pci_unmap_single: direct [%llx,%zx] from %p\n",
387 dma_addr, size, __builtin_return_address(0)); 388 dma_addr, size, __builtin_return_address(0));
388 389
389 return; 390 return;
390 } 391 }
391 392
392 if (dma_addr > 0xffffffff) { 393 if (dma_addr > 0xffffffff) {
393 DBGA2("pci64_unmap_single: DAC [%llx,%zx] from %pf\n", 394 DBGA2("pci64_unmap_single: DAC [%llx,%zx] from %p\n",
394 dma_addr, size, __builtin_return_address(0)); 395 dma_addr, size, __builtin_return_address(0));
395 return; 396 return;
396 } 397 }
@@ -422,7 +423,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
422 423
423 spin_unlock_irqrestore(&arena->lock, flags); 424 spin_unlock_irqrestore(&arena->lock, flags);
424 425
425 DBGA2("pci_unmap_single: sg [%llx,%zx] np %ld from %pf\n", 426 DBGA2("pci_unmap_single: sg [%llx,%zx] np %ld from %p\n",
426 dma_addr, size, npages, __builtin_return_address(0)); 427 dma_addr, size, npages, __builtin_return_address(0));
427} 428}
428 429
@@ -432,8 +433,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
432 else DMA_ADDRP is undefined. */ 433 else DMA_ADDRP is undefined. */
433 434
434static void *alpha_pci_alloc_coherent(struct device *dev, size_t size, 435static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
435 dma_addr_t *dma_addrp, gfp_t gfp, 436 dma_addr_t *dma_addrp, gfp_t gfp)
436 struct dma_attrs *attrs)
437{ 437{
438 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 438 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
439 void *cpu_addr; 439 void *cpu_addr;
@@ -445,7 +445,7 @@ try_again:
445 cpu_addr = (void *)__get_free_pages(gfp, order); 445 cpu_addr = (void *)__get_free_pages(gfp, order);
446 if (! cpu_addr) { 446 if (! cpu_addr) {
447 printk(KERN_INFO "pci_alloc_consistent: " 447 printk(KERN_INFO "pci_alloc_consistent: "
448 "get_free_pages failed from %pf\n", 448 "get_free_pages failed from %p\n",
449 __builtin_return_address(0)); 449 __builtin_return_address(0));
450 /* ??? Really atomic allocation? Otherwise we could play 450 /* ??? Really atomic allocation? Otherwise we could play
451 with vmalloc and sg if we can't find contiguous memory. */ 451 with vmalloc and sg if we can't find contiguous memory. */
@@ -464,7 +464,7 @@ try_again:
464 goto try_again; 464 goto try_again;
465 } 465 }
466 466
467 DBGA2("pci_alloc_consistent: %zx -> [%p,%llx] from %pf\n", 467 DBGA2("pci_alloc_consistent: %zx -> [%p,%llx] from %p\n",
468 size, cpu_addr, *dma_addrp, __builtin_return_address(0)); 468 size, cpu_addr, *dma_addrp, __builtin_return_address(0));
469 469
470 return cpu_addr; 470 return cpu_addr;
@@ -477,14 +477,13 @@ try_again:
477 DMA_ADDR past this call are illegal. */ 477 DMA_ADDR past this call are illegal. */
478 478
479static void alpha_pci_free_coherent(struct device *dev, size_t size, 479static void alpha_pci_free_coherent(struct device *dev, size_t size,
480 void *cpu_addr, dma_addr_t dma_addr, 480 void *cpu_addr, dma_addr_t dma_addr)
481 struct dma_attrs *attrs)
482{ 481{
483 struct pci_dev *pdev = alpha_gendev_to_pci(dev); 482 struct pci_dev *pdev = alpha_gendev_to_pci(dev);
484 pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL); 483 pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
485 free_pages((unsigned long)cpu_addr, get_order(size)); 484 free_pages((unsigned long)cpu_addr, get_order(size));
486 485
487 DBGA2("pci_free_consistent: [%llx,%zx] from %pf\n", 486 DBGA2("pci_free_consistent: [%llx,%zx] from %p\n",
488 dma_addr, size, __builtin_return_address(0)); 487 dma_addr, size, __builtin_return_address(0));
489} 488}
490 489
@@ -660,7 +659,8 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
660 dma_addr_t max_dma; 659 dma_addr_t max_dma;
661 int dac_allowed; 660 int dac_allowed;
662 661
663 BUG_ON(dir == PCI_DMA_NONE); 662 if (dir == PCI_DMA_NONE)
663 BUG();
664 664
665 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 665 dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
666 666
@@ -739,7 +739,8 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
739 dma_addr_t max_dma; 739 dma_addr_t max_dma;
740 dma_addr_t fbeg, fend; 740 dma_addr_t fbeg, fend;
741 741
742 BUG_ON(dir == PCI_DMA_NONE); 742 if (dir == PCI_DMA_NONE)
743 BUG();
743 744
744 if (! alpha_mv.mv_pci_tbi) 745 if (! alpha_mv.mv_pci_tbi)
745 return; 746 return;
@@ -950,8 +951,8 @@ static int alpha_pci_set_mask(struct device *dev, u64 mask)
950} 951}
951 952
952struct dma_map_ops alpha_pci_ops = { 953struct dma_map_ops alpha_pci_ops = {
953 .alloc = alpha_pci_alloc_coherent, 954 .alloc_coherent = alpha_pci_alloc_coherent,
954 .free = alpha_pci_free_coherent, 955 .free_coherent = alpha_pci_free_coherent,
955 .map_page = alpha_pci_map_page, 956 .map_page = alpha_pci_map_page,
956 .unmap_page = alpha_pci_unmap_page, 957 .unmap_page = alpha_pci_unmap_page,
957 .map_sg = alpha_pci_map_sg, 958 .map_sg = alpha_pci_map_sg,
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index d821b17047e..8143cd7cdbf 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -685,10 +685,6 @@ static int alpha_pmu_event_init(struct perf_event *event)
685{ 685{
686 int err; 686 int err;
687 687
688 /* does not support taken branch sampling */
689 if (has_branch_stack(event))
690 return -EOPNOTSUPP;
691
692 switch (event->attr.type) { 688 switch (event->attr.type) {
693 case PERF_TYPE_RAW: 689 case PERF_TYPE_RAW:
694 case PERF_TYPE_HARDWARE: 690 case PERF_TYPE_HARDWARE:
@@ -824,6 +820,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
824 820
825 idx = la_ptr; 821 idx = la_ptr;
826 822
823 perf_sample_data_init(&data, 0);
827 for (j = 0; j < cpuc->n_events; j++) { 824 for (j = 0; j < cpuc->n_events; j++) {
828 if (cpuc->current_idx[j] == idx) 825 if (cpuc->current_idx[j] == idx)
829 break; 826 break;
@@ -847,7 +844,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
847 844
848 hwc = &event->hw; 845 hwc = &event->hw;
849 alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1); 846 alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1);
850 perf_sample_data_init(&data, 0, hwc->last_period); 847 data.period = event->hw.last_period;
851 848
852 if (alpha_perf_event_set_period(event, hwc, idx)) { 849 if (alpha_perf_event_set_period(event, hwc, idx)) {
853 if (perf_event_overflow(event, &data, regs)) { 850 if (perf_event_overflow(event, &data, regs)) {
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index b5d0d092369..89bbe5b4114 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -28,10 +28,10 @@
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/console.h> 29#include <linux/console.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/rcupdate.h>
32 31
33#include <asm/reg.h> 32#include <asm/reg.h>
34#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/system.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/hwrpb.h> 37#include <asm/hwrpb.h>
@@ -49,18 +49,15 @@ EXPORT_SYMBOL(pm_power_off);
49void 49void
50cpu_idle(void) 50cpu_idle(void)
51{ 51{
52 current_thread_info()->status |= TS_POLLING; 52 set_thread_flag(TIF_POLLING_NRFLAG);
53 53
54 while (1) { 54 while (1) {
55 /* FIXME -- EV6 and LCA45 know how to power down 55 /* FIXME -- EV6 and LCA45 know how to power down
56 the CPU. */ 56 the CPU. */
57 57
58 rcu_idle_enter();
59 while (!need_resched()) 58 while (!need_resched())
60 cpu_relax(); 59 cpu_relax();
61 60 schedule();
62 rcu_idle_exit();
63 schedule_preempt_disabled();
64 } 61 }
65} 62}
66 63
@@ -235,54 +232,87 @@ release_thread(struct task_struct *dead_task)
235} 232}
236 233
237/* 234/*
235 * "alpha_clone()".. By the time we get here, the
236 * non-volatile registers have also been saved on the
237 * stack. We do some ugly pointer stuff here.. (see
238 * also copy_thread)
239 *
240 * Notice that "fork()" is implemented in terms of clone,
241 * with parameters (SIGCHLD, 0).
242 */
243int
244alpha_clone(unsigned long clone_flags, unsigned long usp,
245 int __user *parent_tid, int __user *child_tid,
246 unsigned long tls_value, struct pt_regs *regs)
247{
248 if (!usp)
249 usp = rdusp();
250
251 return do_fork(clone_flags, usp, regs, 0, parent_tid, child_tid);
252}
253
254int
255alpha_vfork(struct pt_regs *regs)
256{
257 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
258 regs, 0, NULL, NULL);
259}
260
261/*
238 * Copy an alpha thread.. 262 * Copy an alpha thread..
263 *
264 * Note the "stack_offset" stuff: when returning to kernel mode, we need
265 * to have some extra stack-space for the kernel stack that still exists
266 * after the "ret_from_fork". When returning to user mode, we only want
267 * the space needed by the syscall stack frame (ie "struct pt_regs").
268 * Use the passed "regs" pointer to determine how much space we need
269 * for a kernel fork().
239 */ 270 */
240 271
241int 272int
242copy_thread(unsigned long clone_flags, unsigned long usp, 273copy_thread(unsigned long clone_flags, unsigned long usp,
243 unsigned long arg, 274 unsigned long unused,
244 struct task_struct *p) 275 struct task_struct * p, struct pt_regs * regs)
245{ 276{
246 extern void ret_from_fork(void); 277 extern void ret_from_fork(void);
247 extern void ret_from_kernel_thread(void);
248 278
249 struct thread_info *childti = task_thread_info(p); 279 struct thread_info *childti = task_thread_info(p);
250 struct pt_regs *childregs = task_pt_regs(p); 280 struct pt_regs * childregs;
251 struct pt_regs *regs = current_pt_regs(); 281 struct switch_stack * childstack, *stack;
252 struct switch_stack *childstack, *stack; 282 unsigned long stack_offset, settls;
253 unsigned long settls; 283
254 284 stack_offset = PAGE_SIZE - sizeof(struct pt_regs);
285 if (!(regs->ps & 8))
286 stack_offset = (PAGE_SIZE-1) & (unsigned long) regs;
287 childregs = (struct pt_regs *)
288 (stack_offset + PAGE_SIZE + task_stack_page(p));
289
290 *childregs = *regs;
291 settls = regs->r20;
292 childregs->r0 = 0;
293 childregs->r19 = 0;
294 childregs->r20 = 1; /* OSF/1 has some strange fork() semantics. */
295 regs->r20 = 0;
296 stack = ((struct switch_stack *) regs) - 1;
255 childstack = ((struct switch_stack *) childregs) - 1; 297 childstack = ((struct switch_stack *) childregs) - 1;
298 *childstack = *stack;
299 childstack->r26 = (unsigned long) ret_from_fork;
300 childti->pcb.usp = usp;
256 childti->pcb.ksp = (unsigned long) childstack; 301 childti->pcb.ksp = (unsigned long) childstack;
257 childti->pcb.flags = 1; /* set FEN, clear everything else */ 302 childti->pcb.flags = 1; /* set FEN, clear everything else */
258 303
259 if (unlikely(p->flags & PF_KTHREAD)) { 304 /* Set a new TLS for the child thread? Peek back into the
260 /* kernel thread */ 305 syscall arguments that we saved on syscall entry. Oops,
261 memset(childstack, 0, 306 except we'd have clobbered it with the parent/child set
262 sizeof(struct switch_stack) + sizeof(struct pt_regs)); 307 of r20. Read the saved copy. */
263 childstack->r26 = (unsigned long) ret_from_kernel_thread;
264 childstack->r9 = usp; /* function */
265 childstack->r10 = arg;
266 childregs->hae = alpha_mv.hae_cache,
267 childti->pcb.usp = 0;
268 return 0;
269 }
270 /* Note: if CLONE_SETTLS is not set, then we must inherit the 308 /* Note: if CLONE_SETTLS is not set, then we must inherit the
271 value from the parent, which will have been set by the block 309 value from the parent, which will have been set by the block
272 copy in dup_task_struct. This is non-intuitive, but is 310 copy in dup_task_struct. This is non-intuitive, but is
273 required for proper operation in the case of a threaded 311 required for proper operation in the case of a threaded
274 application calling fork. */ 312 application calling fork. */
275 if (clone_flags & CLONE_SETTLS) 313 if (clone_flags & CLONE_SETTLS)
276 childti->pcb.unique = regs->r20; 314 childti->pcb.unique = settls;
277 childti->pcb.usp = usp ?: rdusp(); 315
278 *childregs = *regs;
279 childregs->r0 = 0;
280 childregs->r19 = 0;
281 childregs->r20 = 1; /* OSF/1 has some strange fork() semantics. */
282 regs->r20 = 0;
283 stack = ((struct switch_stack *) regs) - 1;
284 *childstack = *stack;
285 childstack->r26 = (unsigned long) ret_from_fork;
286 return 0; 316 return 0;
287} 317}
288 318
@@ -353,6 +383,27 @@ dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task)
353EXPORT_SYMBOL(dump_elf_task_fp); 383EXPORT_SYMBOL(dump_elf_task_fp);
354 384
355/* 385/*
386 * sys_execve() executes a new program.
387 */
388asmlinkage int
389do_sys_execve(const char __user *ufilename,
390 const char __user *const __user *argv,
391 const char __user *const __user *envp, struct pt_regs *regs)
392{
393 int error;
394 char *filename;
395
396 filename = getname(ufilename);
397 error = PTR_ERR(filename);
398 if (IS_ERR(filename))
399 goto out;
400 error = do_execve(filename, argv, envp, regs);
401 putname(filename);
402out:
403 return error;
404}
405
406/*
356 * Return saved PC of a blocked thread. This assumes the frame 407 * Return saved PC of a blocked thread. This assumes the frame
357 * pointer is the 6th saved long on the kernel stack and that the 408 * pointer is the 6th saved long on the kernel stack and that the
358 * saved return address is the first long in the frame. This all 409 * saved return address is the first long in the frame. This all
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 2a4a80ff4a2..e2af5eb59bb 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -13,10 +13,10 @@
13#include <linux/user.h> 13#include <linux/user.h>
14#include <linux/security.h> 14#include <linux/security.h>
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/tracehook.h>
17 16
18#include <asm/uaccess.h> 17#include <asm/uaccess.h>
19#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/system.h>
20#include <asm/fpu.h> 20#include <asm/fpu.h>
21 21
22#include "proto.h" 22#include "proto.h"
@@ -313,18 +313,25 @@ long arch_ptrace(struct task_struct *child, long request,
313 return ret; 313 return ret;
314} 314}
315 315
316asmlinkage unsigned long syscall_trace_enter(void)
317{
318 unsigned long ret = 0;
319 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
320 tracehook_report_syscall_entry(current_pt_regs()))
321 ret = -1UL;
322 return ret ?: current_pt_regs()->r0;
323}
324
325asmlinkage void 316asmlinkage void
326syscall_trace_leave(void) 317syscall_trace(void)
327{ 318{
328 if (test_thread_flag(TIF_SYSCALL_TRACE)) 319 if (!test_thread_flag(TIF_SYSCALL_TRACE))
329 tracehook_report_syscall_exit(current_pt_regs(), 0); 320 return;
321 if (!(current->ptrace & PT_PTRACED))
322 return;
323 /* The 0x80 provides a way for the tracing parent to distinguish
324 between a syscall stop and SIGTRAP delivery */
325 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
326 ? 0x80 : 0));
327
328 /*
329 * This isn't the same as continuing with a signal, but it will do
330 * for normal use. strace only continues with a signal if the
331 * stopping signal is not SIGTRAP. -brl
332 */
333 if (current->exit_code) {
334 send_sig(current->exit_code, current, 1);
335 current->exit_code = 0;
336 }
330} 337}
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index 9e3107cc5eb..cc0fd862cf2 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -43,7 +43,6 @@
43#include <asm/setup.h> 43#include <asm/setup.h>
44#include <asm/io.h> 44#include <asm/io.h>
45#include <linux/log2.h> 45#include <linux/log2.h>
46#include <linux/export.h>
47 46
48extern struct atomic_notifier_head panic_notifier_list; 47extern struct atomic_notifier_head panic_notifier_list;
49static int alpha_panic_event(struct notifier_block *, unsigned long, void *); 48static int alpha_panic_event(struct notifier_block *, unsigned long, void *);
@@ -55,6 +54,7 @@ static struct notifier_block alpha_panic_block = {
55 54
56#include <asm/uaccess.h> 55#include <asm/uaccess.h>
57#include <asm/pgtable.h> 56#include <asm/pgtable.h>
57#include <asm/system.h>
58#include <asm/hwrpb.h> 58#include <asm/hwrpb.h>
59#include <asm/dma.h> 59#include <asm/dma.h>
60#include <asm/mmu_context.h> 60#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 02d02c047f1..6f7feb5db27 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -34,6 +34,9 @@
34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
35 35
36asmlinkage void ret_from_sys_call(void); 36asmlinkage void ret_from_sys_call(void);
37static void do_signal(struct pt_regs *, struct switch_stack *,
38 unsigned long, unsigned long);
39
37 40
38/* 41/*
39 * The OSF/1 sigprocmask calling sequence is different from the 42 * The OSF/1 sigprocmask calling sequence is different from the
@@ -117,9 +120,23 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
117 */ 120 */
118SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) 121SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
119{ 122{
120 sigset_t blocked; 123 mask &= _BLOCKABLE;
121 siginitset(&blocked, mask); 124 spin_lock_irq(&current->sighand->siglock);
122 return sigsuspend(&blocked); 125 current->saved_sigmask = current->blocked;
126 siginitset(&current->blocked, mask);
127 recalc_sigpending();
128 spin_unlock_irq(&current->sighand->siglock);
129
130 current->state = TASK_INTERRUPTIBLE;
131 schedule();
132 set_thread_flag(TIF_RESTORE_SIGMASK);
133 return -ERESTARTNOHAND;
134}
135
136asmlinkage int
137sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
138{
139 return do_sigaltstack(uss, uoss, rdusp());
123} 140}
124 141
125/* 142/*
@@ -154,10 +171,10 @@ extern char compile_time_assert
154#define INSN_CALLSYS 0x00000083 171#define INSN_CALLSYS 0x00000083
155 172
156static long 173static long
157restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs) 174restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
175 struct switch_stack *sw)
158{ 176{
159 unsigned long usp; 177 unsigned long usp;
160 struct switch_stack *sw = (struct switch_stack *)regs - 1;
161 long i, err = __get_user(regs->pc, &sc->sc_pc); 178 long i, err = __get_user(regs->pc, &sc->sc_pc);
162 179
163 current_thread_info()->restart_block.fn = do_no_restart_syscall; 180 current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -209,9 +226,9 @@ restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
209 registers and transfer control from userland. */ 226 registers and transfer control from userland. */
210 227
211asmlinkage void 228asmlinkage void
212do_sigreturn(struct sigcontext __user *sc) 229do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
230 struct switch_stack *sw)
213{ 231{
214 struct pt_regs *regs = current_pt_regs();
215 sigset_t set; 232 sigset_t set;
216 233
217 /* Verify that it's a good sigcontext before using it */ 234 /* Verify that it's a good sigcontext before using it */
@@ -220,9 +237,13 @@ do_sigreturn(struct sigcontext __user *sc)
220 if (__get_user(set.sig[0], &sc->sc_mask)) 237 if (__get_user(set.sig[0], &sc->sc_mask))
221 goto give_sigsegv; 238 goto give_sigsegv;
222 239
223 set_current_blocked(&set); 240 sigdelsetmask(&set, ~_BLOCKABLE);
241 spin_lock_irq(&current->sighand->siglock);
242 current->blocked = set;
243 recalc_sigpending();
244 spin_unlock_irq(&current->sighand->siglock);
224 245
225 if (restore_sigcontext(sc, regs)) 246 if (restore_sigcontext(sc, regs, sw))
226 goto give_sigsegv; 247 goto give_sigsegv;
227 248
228 /* Send SIGTRAP if we're single-stepping: */ 249 /* Send SIGTRAP if we're single-stepping: */
@@ -243,9 +264,9 @@ give_sigsegv:
243} 264}
244 265
245asmlinkage void 266asmlinkage void
246do_rt_sigreturn(struct rt_sigframe __user *frame) 267do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
268 struct switch_stack *sw)
247{ 269{
248 struct pt_regs *regs = current_pt_regs();
249 sigset_t set; 270 sigset_t set;
250 271
251 /* Verify that it's a good ucontext_t before using it */ 272 /* Verify that it's a good ucontext_t before using it */
@@ -254,9 +275,13 @@ do_rt_sigreturn(struct rt_sigframe __user *frame)
254 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 275 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
255 goto give_sigsegv; 276 goto give_sigsegv;
256 277
257 set_current_blocked(&set); 278 sigdelsetmask(&set, ~_BLOCKABLE);
279 spin_lock_irq(&current->sighand->siglock);
280 current->blocked = set;
281 recalc_sigpending();
282 spin_unlock_irq(&current->sighand->siglock);
258 283
259 if (restore_sigcontext(&frame->uc.uc_mcontext, regs)) 284 if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw))
260 goto give_sigsegv; 285 goto give_sigsegv;
261 286
262 /* Send SIGTRAP if we're single-stepping: */ 287 /* Send SIGTRAP if we're single-stepping: */
@@ -292,9 +317,8 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
292 317
293static long 318static long
294setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 319setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
295 unsigned long mask, unsigned long sp) 320 struct switch_stack *sw, unsigned long mask, unsigned long sp)
296{ 321{
297 struct switch_stack *sw = (struct switch_stack *)regs - 1;
298 long i, err = 0; 322 long i, err = 0;
299 323
300 err |= __put_user(on_sig_stack((unsigned long)sc), &sc->sc_onstack); 324 err |= __put_user(on_sig_stack((unsigned long)sc), &sc->sc_onstack);
@@ -349,7 +373,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
349 373
350static int 374static int
351setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 375setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
352 struct pt_regs *regs) 376 struct pt_regs *regs, struct switch_stack * sw)
353{ 377{
354 unsigned long oldsp, r26, err = 0; 378 unsigned long oldsp, r26, err = 0;
355 struct sigframe __user *frame; 379 struct sigframe __user *frame;
@@ -357,11 +381,11 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
357 oldsp = rdusp(); 381 oldsp = rdusp();
358 frame = get_sigframe(ka, oldsp, sizeof(*frame)); 382 frame = get_sigframe(ka, oldsp, sizeof(*frame));
359 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 383 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
360 return -EFAULT; 384 goto give_sigsegv;
361 385
362 err |= setup_sigcontext(&frame->sc, regs, set->sig[0], oldsp); 386 err |= setup_sigcontext(&frame->sc, regs, sw, set->sig[0], oldsp);
363 if (err) 387 if (err)
364 return -EFAULT; 388 goto give_sigsegv;
365 389
366 /* Set up to return from userspace. If provided, use a stub 390 /* Set up to return from userspace. If provided, use a stub
367 already in userspace. */ 391 already in userspace. */
@@ -377,7 +401,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
377 401
378 /* Check that everything was written properly. */ 402 /* Check that everything was written properly. */
379 if (err) 403 if (err)
380 return err; 404 goto give_sigsegv;
381 405
382 /* "Return" to the handler */ 406 /* "Return" to the handler */
383 regs->r26 = r26; 407 regs->r26 = r26;
@@ -391,12 +415,17 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
391 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 415 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
392 current->comm, current->pid, frame, regs->pc, regs->r26); 416 current->comm, current->pid, frame, regs->pc, regs->r26);
393#endif 417#endif
418
394 return 0; 419 return 0;
420
421give_sigsegv:
422 force_sigsegv(sig, current);
423 return -EFAULT;
395} 424}
396 425
397static int 426static int
398setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 427setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
399 sigset_t *set, struct pt_regs *regs) 428 sigset_t *set, struct pt_regs *regs, struct switch_stack * sw)
400{ 429{
401 unsigned long oldsp, r26, err = 0; 430 unsigned long oldsp, r26, err = 0;
402 struct rt_sigframe __user *frame; 431 struct rt_sigframe __user *frame;
@@ -404,7 +433,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
404 oldsp = rdusp(); 433 oldsp = rdusp();
405 frame = get_sigframe(ka, oldsp, sizeof(*frame)); 434 frame = get_sigframe(ka, oldsp, sizeof(*frame));
406 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 435 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
407 return -EFAULT; 436 goto give_sigsegv;
408 437
409 err |= copy_siginfo_to_user(&frame->info, info); 438 err |= copy_siginfo_to_user(&frame->info, info);
410 439
@@ -412,12 +441,14 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
412 err |= __put_user(0, &frame->uc.uc_flags); 441 err |= __put_user(0, &frame->uc.uc_flags);
413 err |= __put_user(0, &frame->uc.uc_link); 442 err |= __put_user(0, &frame->uc.uc_link);
414 err |= __put_user(set->sig[0], &frame->uc.uc_osf_sigmask); 443 err |= __put_user(set->sig[0], &frame->uc.uc_osf_sigmask);
415 err |= __save_altstack(&frame->uc.uc_stack, oldsp); 444 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
416 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, 445 err |= __put_user(sas_ss_flags(oldsp), &frame->uc.uc_stack.ss_flags);
446 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
447 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, sw,
417 set->sig[0], oldsp); 448 set->sig[0], oldsp);
418 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 449 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
419 if (err) 450 if (err)
420 return -EFAULT; 451 goto give_sigsegv;
421 452
422 /* Set up to return from userspace. If provided, use a stub 453 /* Set up to return from userspace. If provided, use a stub
423 already in userspace. */ 454 already in userspace. */
@@ -433,7 +464,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
433 } 464 }
434 465
435 if (err) 466 if (err)
436 return -EFAULT; 467 goto give_sigsegv;
437 468
438 /* "Return" to the handler */ 469 /* "Return" to the handler */
439 regs->r26 = r26; 470 regs->r26 = r26;
@@ -449,29 +480,37 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
449#endif 480#endif
450 481
451 return 0; 482 return 0;
483
484give_sigsegv:
485 force_sigsegv(sig, current);
486 return -EFAULT;
452} 487}
453 488
454 489
455/* 490/*
456 * OK, we're invoking a handler. 491 * OK, we're invoking a handler.
457 */ 492 */
458static inline void 493static inline int
459handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, 494handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
460 struct pt_regs * regs) 495 sigset_t *oldset, struct pt_regs * regs, struct switch_stack *sw)
461{ 496{
462 sigset_t *oldset = sigmask_to_save();
463 int ret; 497 int ret;
464 498
465 if (ka->sa.sa_flags & SA_SIGINFO) 499 if (ka->sa.sa_flags & SA_SIGINFO)
466 ret = setup_rt_frame(sig, ka, info, oldset, regs); 500 ret = setup_rt_frame(sig, ka, info, oldset, regs, sw);
467 else 501 else
468 ret = setup_frame(sig, ka, oldset, regs); 502 ret = setup_frame(sig, ka, oldset, regs, sw);
469 503
470 if (ret) { 504 if (ret == 0) {
471 force_sigsegv(sig, current); 505 spin_lock_irq(&current->sighand->siglock);
472 return; 506 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
507 if (!(ka->sa.sa_flags & SA_NODEFER))
508 sigaddset(&current->blocked,sig);
509 recalc_sigpending();
510 spin_unlock_irq(&current->sighand->siglock);
473 } 511 }
474 signal_delivered(sig, info, ka, regs, 0); 512
513 return ret;
475} 514}
476 515
477static inline void 516static inline void
@@ -512,12 +551,19 @@ syscall_restart(unsigned long r0, unsigned long r19,
512 * all (if we get here from anything but a syscall return, it will be 0) 551 * all (if we get here from anything but a syscall return, it will be 0)
513 */ 552 */
514static void 553static void
515do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19) 554do_signal(struct pt_regs * regs, struct switch_stack * sw,
555 unsigned long r0, unsigned long r19)
516{ 556{
517 siginfo_t info; 557 siginfo_t info;
518 int signr; 558 int signr;
519 unsigned long single_stepping = ptrace_cancel_bpt(current); 559 unsigned long single_stepping = ptrace_cancel_bpt(current);
520 struct k_sigaction ka; 560 struct k_sigaction ka;
561 sigset_t *oldset;
562
563 if (test_thread_flag(TIF_RESTORE_SIGMASK))
564 oldset = &current->saved_sigmask;
565 else
566 oldset = &current->blocked;
521 567
522 /* This lets the debugger run, ... */ 568 /* This lets the debugger run, ... */
523 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 569 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
@@ -529,7 +575,14 @@ do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19)
529 /* Whee! Actually deliver the signal. */ 575 /* Whee! Actually deliver the signal. */
530 if (r0) 576 if (r0)
531 syscall_restart(r0, r19, regs, &ka); 577 syscall_restart(r0, r19, regs, &ka);
532 handle_signal(signr, &ka, &info, regs); 578 if (handle_signal(signr, &ka, &info, oldset, regs, sw) == 0) {
579 /* A signal was successfully delivered, and the
580 saved sigmask was stored on the signal frame,
581 and will be restored by sigreturn. So we can
582 simply clear the restore sigmask flag. */
583 if (test_thread_flag(TIF_RESTORE_SIGMASK))
584 clear_thread_flag(TIF_RESTORE_SIGMASK);
585 }
533 if (single_stepping) 586 if (single_stepping)
534 ptrace_set_bpt(current); /* re-set bpt */ 587 ptrace_set_bpt(current); /* re-set bpt */
535 return; 588 return;
@@ -554,29 +607,27 @@ do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19)
554 } 607 }
555 608
556 /* If there's no signal to deliver, we just restore the saved mask. */ 609 /* If there's no signal to deliver, we just restore the saved mask. */
557 restore_saved_sigmask(); 610 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
611 clear_thread_flag(TIF_RESTORE_SIGMASK);
612 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
613 }
614
558 if (single_stepping) 615 if (single_stepping)
559 ptrace_set_bpt(current); /* re-set breakpoint */ 616 ptrace_set_bpt(current); /* re-set breakpoint */
560} 617}
561 618
562void 619void
563do_work_pending(struct pt_regs *regs, unsigned long thread_flags, 620do_notify_resume(struct pt_regs *regs, struct switch_stack *sw,
621 unsigned long thread_info_flags,
564 unsigned long r0, unsigned long r19) 622 unsigned long r0, unsigned long r19)
565{ 623{
566 do { 624 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
567 if (thread_flags & _TIF_NEED_RESCHED) { 625 do_signal(regs, sw, r0, r19);
568 schedule(); 626
569 } else { 627 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
570 local_irq_enable(); 628 clear_thread_flag(TIF_NOTIFY_RESUME);
571 if (thread_flags & _TIF_SIGPENDING) { 629 tracehook_notify_resume(regs);
572 do_signal(regs, r0, r19); 630 if (current->replacement_session_keyring)
573 r0 = 0; 631 key_replace_session_keyring();
574 } else { 632 }
575 clear_thread_flag(TIF_NOTIFY_RESUME);
576 tracehook_notify_resume(regs);
577 }
578 }
579 local_irq_disable();
580 thread_flags = current_thread_info()->flags;
581 } while (thread_flags & _TIF_WORK_MASK);
582} 633}
diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c
index c803fc76ae4..0435921d41c 100644
--- a/arch/alpha/kernel/smc37c669.c
+++ b/arch/alpha/kernel/smc37c669.c
@@ -933,6 +933,18 @@ void SMC37c669_display_device_info(
933 * 933 *
934 *-- 934 *--
935 */ 935 */
936#if 0
937/* $INCLUDE_OPTIONS$ */
938#include "cp$inc:platform_io.h"
939/* $INCLUDE_OPTIONS_END$ */
940#include "cp$src:common.h"
941#include "cp$inc:prototypes.h"
942#include "cp$src:kernel_def.h"
943#include "cp$src:msg_def.h"
944#include "cp$src:smcc669_def.h"
945/* Platform-specific includes */
946#include "cp$src:platform.h"
947#endif
936 948
937#ifndef TRUE 949#ifndef TRUE
938#define TRUE 1 950#define TRUE 1
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 9603bc234b4..4087a569b43 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -68,7 +68,7 @@ enum ipi_message_type {
68}; 68};
69 69
70/* Set to a secondary's cpuid when it comes online. */ 70/* Set to a secondary's cpuid when it comes online. */
71static int smp_secondary_alive = 0; 71static int smp_secondary_alive __devinitdata = 0;
72 72
73int smp_num_probed; /* Internal processor count */ 73int smp_num_probed; /* Internal processor count */
74int smp_num_cpus = 1; /* Number that came online. */ 74int smp_num_cpus = 1; /* Number that came online. */
@@ -166,13 +166,12 @@ smp_callin(void)
166 DBGS(("smp_callin: commencing CPU %d current %p active_mm %p\n", 166 DBGS(("smp_callin: commencing CPU %d current %p active_mm %p\n",
167 cpuid, current, current->active_mm)); 167 cpuid, current, current->active_mm));
168 168
169 preempt_disable();
170 /* Do nothing. */ 169 /* Do nothing. */
171 cpu_idle(); 170 cpu_idle();
172} 171}
173 172
174/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */ 173/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */
175static int 174static int __devinit
176wait_for_txrdy (unsigned long cpumask) 175wait_for_txrdy (unsigned long cpumask)
177{ 176{
178 unsigned long timeout; 177 unsigned long timeout;
@@ -358,10 +357,24 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
358 * Bring one cpu online. 357 * Bring one cpu online.
359 */ 358 */
360static int __cpuinit 359static int __cpuinit
361smp_boot_one_cpu(int cpuid, struct task_struct *idle) 360smp_boot_one_cpu(int cpuid)
362{ 361{
362 struct task_struct *idle;
363 unsigned long timeout; 363 unsigned long timeout;
364 364
365 /* Cook up an idler for this guy. Note that the address we
366 give to kernel_thread is irrelevant -- it's going to start
367 where HWRPB.CPU_restart says to start. But this gets all
368 the other task-y sort of data structures set up like we
369 wish. We can't use kernel_thread since we must avoid
370 rescheduling the child. */
371 idle = fork_idle(cpuid);
372 if (IS_ERR(idle))
373 panic("failed fork for CPU %d", cpuid);
374
375 DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n",
376 cpuid, idle->state, idle->flags));
377
365 /* Signal the secondary to wait a moment. */ 378 /* Signal the secondary to wait a moment. */
366 smp_secondary_alive = -1; 379 smp_secondary_alive = -1;
367 380
@@ -437,7 +450,7 @@ setup_smp(void)
437 smp_num_probed = 1; 450 smp_num_probed = 1;
438 } 451 }
439 452
440 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 453 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_map = %lx\n",
441 smp_num_probed, cpumask_bits(cpu_present_mask)[0]); 454 smp_num_probed, cpumask_bits(cpu_present_mask)[0]);
442} 455}
443 456
@@ -468,15 +481,15 @@ smp_prepare_cpus(unsigned int max_cpus)
468 smp_num_cpus = smp_num_probed; 481 smp_num_cpus = smp_num_probed;
469} 482}
470 483
471void 484void __devinit
472smp_prepare_boot_cpu(void) 485smp_prepare_boot_cpu(void)
473{ 486{
474} 487}
475 488
476int __cpuinit 489int __cpuinit
477__cpu_up(unsigned int cpu, struct task_struct *tidle) 490__cpu_up(unsigned int cpu)
478{ 491{
479 smp_boot_one_cpu(cpu, tidle); 492 smp_boot_one_cpu(cpu);
480 493
481 return cpu_online(cpu) ? 0 : -ENOSYS; 494 return cpu_online(cpu) ? 0 : -ENOSYS;
482} 495}
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index b9fc6c309d2..f0df3fbd840 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -4,8 +4,9 @@
4 * 4 *
5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de> 5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
6 * 6 *
7 * This driver is a modified version of Erik Mouw's example proc 7 * This driver is at all a modified version of Erik Mouw's
8 * interface, so: thank you, Erik! He can be reached via email at 8 * Documentation/DocBook/procfs_example.c, so: thank
9 * you, Erik! He can be reached via email at
9 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea 10 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea
10 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They 11 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They
11 * included a patch like this as well. Thanks for idea! 12 * included a patch like this as well. Thanks for idea!
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
index 59b7bbad839..783f4e50c11 100644
--- a/arch/alpha/kernel/srmcons.c
+++ b/arch/alpha/kernel/srmcons.c
@@ -30,9 +30,10 @@ static int srm_is_registered_console = 0;
30#define MAX_SRM_CONSOLE_DEVICES 1 /* only support 1 console device */ 30#define MAX_SRM_CONSOLE_DEVICES 1 /* only support 1 console device */
31 31
32struct srmcons_private { 32struct srmcons_private {
33 struct tty_port port; 33 struct tty_struct *tty;
34 struct timer_list timer; 34 struct timer_list timer;
35} srmcons_singleton; 35 spinlock_t lock;
36};
36 37
37typedef union _srmcons_result { 38typedef union _srmcons_result {
38 struct { 39 struct {
@@ -67,21 +68,22 @@ static void
67srmcons_receive_chars(unsigned long data) 68srmcons_receive_chars(unsigned long data)
68{ 69{
69 struct srmcons_private *srmconsp = (struct srmcons_private *)data; 70 struct srmcons_private *srmconsp = (struct srmcons_private *)data;
70 struct tty_port *port = &srmconsp->port;
71 unsigned long flags; 71 unsigned long flags;
72 int incr = 10; 72 int incr = 10;
73 73
74 local_irq_save(flags); 74 local_irq_save(flags);
75 if (spin_trylock(&srmcons_callback_lock)) { 75 if (spin_trylock(&srmcons_callback_lock)) {
76 if (!srmcons_do_receive_chars(port->tty)) 76 if (!srmcons_do_receive_chars(srmconsp->tty))
77 incr = 100; 77 incr = 100;
78 spin_unlock(&srmcons_callback_lock); 78 spin_unlock(&srmcons_callback_lock);
79 } 79 }
80 80
81 spin_lock(&port->lock); 81 spin_lock(&srmconsp->lock);
82 if (port->tty) 82 if (srmconsp->tty) {
83 mod_timer(&srmconsp->timer, jiffies + incr); 83 srmconsp->timer.expires = jiffies + incr;
84 spin_unlock(&port->lock); 84 add_timer(&srmconsp->timer);
85 }
86 spin_unlock(&srmconsp->lock);
85 87
86 local_irq_restore(flags); 88 local_irq_restore(flags);
87} 89}
@@ -154,22 +156,56 @@ srmcons_chars_in_buffer(struct tty_struct *tty)
154} 156}
155 157
156static int 158static int
159srmcons_get_private_struct(struct srmcons_private **ps)
160{
161 static struct srmcons_private *srmconsp = NULL;
162 static DEFINE_SPINLOCK(srmconsp_lock);
163 unsigned long flags;
164 int retval = 0;
165
166 if (srmconsp == NULL) {
167 srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
168 spin_lock_irqsave(&srmconsp_lock, flags);
169
170 if (srmconsp == NULL)
171 retval = -ENOMEM;
172 else {
173 srmconsp->tty = NULL;
174 spin_lock_init(&srmconsp->lock);
175 init_timer(&srmconsp->timer);
176 }
177
178 spin_unlock_irqrestore(&srmconsp_lock, flags);
179 }
180
181 *ps = srmconsp;
182 return retval;
183}
184
185static int
157srmcons_open(struct tty_struct *tty, struct file *filp) 186srmcons_open(struct tty_struct *tty, struct file *filp)
158{ 187{
159 struct srmcons_private *srmconsp = &srmcons_singleton; 188 struct srmcons_private *srmconsp;
160 struct tty_port *port = &srmconsp->port;
161 unsigned long flags; 189 unsigned long flags;
190 int retval;
191
192 retval = srmcons_get_private_struct(&srmconsp);
193 if (retval)
194 return retval;
162 195
163 spin_lock_irqsave(&port->lock, flags); 196 spin_lock_irqsave(&srmconsp->lock, flags);
164 197
165 if (!port->tty) { 198 if (!srmconsp->tty) {
166 tty->driver_data = srmconsp; 199 tty->driver_data = srmconsp;
167 tty->port = port; 200
168 port->tty = tty; /* XXX proper refcounting */ 201 srmconsp->tty = tty;
169 mod_timer(&srmconsp->timer, jiffies + 10); 202 srmconsp->timer.function = srmcons_receive_chars;
203 srmconsp->timer.data = (unsigned long)srmconsp;
204 srmconsp->timer.expires = jiffies + 10;
205 add_timer(&srmconsp->timer);
170 } 206 }
171 207
172 spin_unlock_irqrestore(&port->lock, flags); 208 spin_unlock_irqrestore(&srmconsp->lock, flags);
173 209
174 return 0; 210 return 0;
175} 211}
@@ -178,17 +214,16 @@ static void
178srmcons_close(struct tty_struct *tty, struct file *filp) 214srmcons_close(struct tty_struct *tty, struct file *filp)
179{ 215{
180 struct srmcons_private *srmconsp = tty->driver_data; 216 struct srmcons_private *srmconsp = tty->driver_data;
181 struct tty_port *port = &srmconsp->port;
182 unsigned long flags; 217 unsigned long flags;
183 218
184 spin_lock_irqsave(&port->lock, flags); 219 spin_lock_irqsave(&srmconsp->lock, flags);
185 220
186 if (tty->count == 1) { 221 if (tty->count == 1) {
187 port->tty = NULL; 222 srmconsp->tty = NULL;
188 del_timer(&srmconsp->timer); 223 del_timer(&srmconsp->timer);
189 } 224 }
190 225
191 spin_unlock_irqrestore(&port->lock, flags); 226 spin_unlock_irqrestore(&srmconsp->lock, flags);
192} 227}
193 228
194 229
@@ -205,8 +240,6 @@ static const struct tty_operations srmcons_ops = {
205static int __init 240static int __init
206srmcons_init(void) 241srmcons_init(void)
207{ 242{
208 setup_timer(&srmcons_singleton.timer, srmcons_receive_chars,
209 (unsigned long)&srmcons_singleton);
210 if (srm_is_registered_console) { 243 if (srm_is_registered_console) {
211 struct tty_driver *driver; 244 struct tty_driver *driver;
212 int err; 245 int err;
@@ -214,9 +247,6 @@ srmcons_init(void)
214 driver = alloc_tty_driver(MAX_SRM_CONSOLE_DEVICES); 247 driver = alloc_tty_driver(MAX_SRM_CONSOLE_DEVICES);
215 if (!driver) 248 if (!driver)
216 return -ENOMEM; 249 return -ENOMEM;
217
218 tty_port_init(&srmcons_singleton.port);
219
220 driver->driver_name = "srm"; 250 driver->driver_name = "srm";
221 driver->name = "srm"; 251 driver->name = "srm";
222 driver->major = 0; /* dynamic */ 252 driver->major = 0; /* dynamic */
@@ -225,11 +255,9 @@ srmcons_init(void)
225 driver->subtype = SYSTEM_TYPE_SYSCONS; 255 driver->subtype = SYSTEM_TYPE_SYSCONS;
226 driver->init_termios = tty_std_termios; 256 driver->init_termios = tty_std_termios;
227 tty_set_operations(driver, &srmcons_ops); 257 tty_set_operations(driver, &srmcons_ops);
228 tty_port_link_device(&srmcons_singleton.port, driver, 0);
229 err = tty_register_driver(driver); 258 err = tty_register_driver(driver);
230 if (err) { 259 if (err) {
231 put_tty_driver(driver); 260 put_tty_driver(driver);
232 tty_port_destroy(&srmcons_singleton.port);
233 return err; 261 return err;
234 } 262 }
235 srmcons_driver = driver; 263 srmcons_driver = driver;
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index 118dc6af180..8606d77e516 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -18,6 +18,7 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/system.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/dma.h> 23#include <asm/dma.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c
index 4c50f8f40cb..1029619fb6c 100644
--- a/arch/alpha/kernel/sys_cabriolet.c
+++ b/arch/alpha/kernel/sys_cabriolet.c
@@ -18,6 +18,7 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/system.h>
21#include <asm/dma.h> 22#include <asm/dma.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index 5bf401f7ea9..bb7f0c7cb17 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -21,6 +21,7 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22 22
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/system.h>
24#include <asm/dma.h> 25#include <asm/dma.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
@@ -365,7 +366,7 @@ clipper_init_irq(void)
365 */ 366 */
366 367
367static int __init 368static int __init
368isa_irq_fixup(const struct pci_dev *dev, int irq) 369isa_irq_fixup(struct pci_dev *dev, int irq)
369{ 370{
370 u8 irq8; 371 u8 irq8;
371 372
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c
index ad40a425e84..3c6c13cd8b1 100644
--- a/arch/alpha/kernel/sys_eb64p.c
+++ b/arch/alpha/kernel/sys_eb64p.c
@@ -17,6 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/system.h>
20#include <asm/dma.h> 21#include <asm/dma.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 79d69d7f63f..35f480db771 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -18,6 +18,7 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/system.h>
21#include <asm/dma.h> 22#include <asm/dma.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 5a0af11b3a6..7f1a87f176e 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <asm/system.h>
18 19
19#define __EXTERN_INLINE inline 20#define __EXTERN_INLINE inline
20#include <asm/io.h> 21#include <asm/io.h>
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 407accc8087..95cfc83ece8 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -13,6 +13,7 @@
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14 14
15#include <asm/ptrace.h> 15#include <asm/ptrace.h>
16#include <asm/system.h>
16#include <asm/dma.h> 17#include <asm/dma.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
@@ -317,7 +318,7 @@ marvel_init_irq(void)
317} 318}
318 319
319static int 320static int
320marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 321marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
321{ 322{
322 struct pci_controller *hose = dev->sysdata; 323 struct pci_controller *hose = dev->sysdata;
323 struct io7_port *io7_port = hose->sysdata; 324 struct io7_port *io7_port = hose->sysdata;
@@ -383,8 +384,7 @@ marvel_init_pci(void)
383 384
384 marvel_register_error_handlers(); 385 marvel_register_error_handlers();
385 386
386 /* Indicate that we trust the console to configure things properly */ 387 pci_probe_only = 1;
387 pci_set_flags(PCI_PROBE_ONLY);
388 common_init_pci(); 388 common_init_pci();
389 locate_and_init_vga(NULL); 389 locate_and_init_vga(NULL);
390 390
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index d5b9776a608..258da684670 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -17,6 +17,7 @@
17#include <linux/reboot.h> 17#include <linux/reboot.h>
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/system.h>
20#include <asm/dma.h> 21#include <asm/dma.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c
index 5e82dc1ad6f..c0fd7284dec 100644
--- a/arch/alpha/kernel/sys_mikasa.c
+++ b/arch/alpha/kernel/sys_mikasa.c
@@ -17,7 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/mce.h> 20#include <asm/system.h>
21#include <asm/dma.h> 21#include <asm/dma.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4d4c046f708..4112200307c 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -35,6 +35,7 @@
35#include <linux/bitops.h> 35#include <linux/bitops.h>
36 36
37#include <asm/ptrace.h> 37#include <asm/ptrace.h>
38#include <asm/system.h>
38#include <asm/dma.h> 39#include <asm/dma.h>
39#include <asm/irq.h> 40#include <asm/irq.h>
40#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index 063e594fd96..21725283cdd 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -18,7 +18,7 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/mce.h> 21#include <asm/system.h>
22#include <asm/dma.h> 22#include <asm/dma.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index dfd510ae5d8..a125d6bea7e 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/system.h>
19#include <asm/dma.h> 20#include <asm/dma.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/mmu_context.h> 22#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index a3f48525717..2581cbec6fc 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/system.h>
21#include <asm/dma.h> 22#include <asm/dma.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c
index 08ee737d4fb..b172b27555a 100644
--- a/arch/alpha/kernel/sys_rx164.c
+++ b/arch/alpha/kernel/sys_rx164.c
@@ -17,6 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/system.h>
20#include <asm/dma.h> 21#include <asm/dma.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index 8a0aa6d67b5..98d1dbffe98 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/system.h>
19#include <asm/dma.h> 20#include <asm/dma.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/mmu_context.h> 22#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index febd24eba7a..47bec1e97d1 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/compiler.h> 21#include <asm/compiler.h>
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/system.h>
23#include <asm/dma.h> 24#include <asm/dma.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
25#include <asm/mmu_context.h> 26#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c
index d063b360efe..73e1c317afc 100644
--- a/arch/alpha/kernel/sys_sx164.c
+++ b/arch/alpha/kernel/sys_sx164.c
@@ -17,6 +17,7 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/system.h>
20#include <asm/dma.h> 21#include <asm/dma.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
@@ -25,7 +26,6 @@
25#include <asm/core_cia.h> 26#include <asm/core_cia.h>
26#include <asm/hwrpb.h> 27#include <asm/hwrpb.h>
27#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
28#include <asm/special_insns.h>
29 29
30#include "proto.h" 30#include "proto.h"
31#include "irq_impl.h" 31#include "irq_impl.h"
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
index dd0f1eae3c6..2ae99ad6975 100644
--- a/arch/alpha/kernel/sys_takara.c
+++ b/arch/alpha/kernel/sys_takara.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/system.h>
19#include <asm/dma.h> 20#include <asm/dma.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/mmu_context.h> 22#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 5cf4a481b8c..f47b30a2a11 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -21,6 +21,7 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22 22
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/system.h>
24#include <asm/dma.h> 25#include <asm/dma.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
@@ -303,7 +304,7 @@ titan_late_init(void)
303 304
304} 305}
305 306
306static int 307static int __devinit
307titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 308titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
308{ 309{
309 u8 intline; 310 u8 intline;
@@ -330,8 +331,7 @@ titan_init_pci(void)
330 */ 331 */
331 titan_late_init(); 332 titan_late_init();
332 333
333 /* Indicate that we trust the console to configure things properly */ 334 pci_probe_only = 1;
334 pci_set_flags(PCI_PROBE_ONLY);
335 common_init_pci(); 335 common_init_pci();
336 SMC669_Init(0); 336 SMC669_Init(0);
337 locate_and_init_vga(NULL); 337 locate_and_init_vga(NULL);
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
index ee187488777..17c85a65e7b 100644
--- a/arch/alpha/kernel/sys_wildfire.c
+++ b/arch/alpha/kernel/sys_wildfire.c
@@ -15,6 +15,7 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16 16
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <asm/system.h>
18#include <asm/dma.h> 19#include <asm/dma.h>
19#include <asm/irq.h> 20#include <asm/irq.h>
20#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 4284ec798ec..6acea1f96de 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -12,7 +12,7 @@
12sys_call_table: 12sys_call_table:
13 .quad alpha_ni_syscall /* 0 */ 13 .quad alpha_ni_syscall /* 0 */
14 .quad sys_exit 14 .quad sys_exit
15 .quad alpha_fork 15 .quad sys_fork
16 .quad sys_read 16 .quad sys_read
17 .quad sys_write 17 .quad sys_write
18 .quad alpha_ni_syscall /* 5 */ 18 .quad alpha_ni_syscall /* 5 */
@@ -76,7 +76,7 @@ sys_call_table:
76 .quad sys_getpgrp 76 .quad sys_getpgrp
77 .quad sys_getpagesize 77 .quad sys_getpagesize
78 .quad alpha_ni_syscall /* 65 */ 78 .quad alpha_ni_syscall /* 65 */
79 .quad alpha_vfork 79 .quad sys_vfork
80 .quad sys_newstat 80 .quad sys_newstat
81 .quad sys_newlstat 81 .quad sys_newlstat
82 .quad alpha_ni_syscall 82 .quad alpha_ni_syscall
@@ -111,7 +111,7 @@ sys_call_table:
111 .quad sys_socket 111 .quad sys_socket
112 .quad sys_connect 112 .quad sys_connect
113 .quad sys_accept 113 .quad sys_accept
114 .quad sys_osf_getpriority /* 100 */ 114 .quad osf_getpriority /* 100 */
115 .quad sys_send 115 .quad sys_send
116 .quad sys_recv 116 .quad sys_recv
117 .quad sys_sigreturn 117 .quad sys_sigreturn
@@ -241,11 +241,11 @@ sys_call_table:
241 .quad alpha_ni_syscall 241 .quad alpha_ni_syscall
242 .quad alpha_ni_syscall 242 .quad alpha_ni_syscall
243 .quad alpha_ni_syscall 243 .quad alpha_ni_syscall
244 .quad sys_osf_stat 244 .quad alpha_ni_syscall
245 .quad sys_osf_lstat /* 225 */ 245 .quad alpha_ni_syscall /* 225 */
246 .quad sys_osf_fstat 246 .quad alpha_ni_syscall
247 .quad sys_osf_statfs64 247 .quad alpha_ni_syscall
248 .quad sys_osf_fstatfs64 248 .quad alpha_ni_syscall
249 .quad alpha_ni_syscall 249 .quad alpha_ni_syscall
250 .quad alpha_ni_syscall /* 230 */ 250 .quad alpha_ni_syscall /* 230 */
251 .quad alpha_ni_syscall 251 .quad alpha_ni_syscall
@@ -330,7 +330,7 @@ sys_call_table:
330 .quad sys_ni_syscall /* 309: old get_kernel_syms */ 330 .quad sys_ni_syscall /* 309: old get_kernel_syms */
331 .quad sys_syslog /* 310 */ 331 .quad sys_syslog /* 310 */
332 .quad sys_reboot 332 .quad sys_reboot
333 .quad alpha_clone 333 .quad sys_clone
334 .quad sys_uselib 334 .quad sys_uselib
335 .quad sys_mlock 335 .quad sys_mlock
336 .quad sys_munlock /* 315 */ 336 .quad sys_munlock /* 315 */
@@ -520,10 +520,6 @@ sys_call_table:
520 .quad sys_clock_adjtime 520 .quad sys_clock_adjtime
521 .quad sys_syncfs /* 500 */ 521 .quad sys_syncfs /* 500 */
522 .quad sys_setns 522 .quad sys_setns
523 .quad sys_accept4
524 .quad sys_sendmmsg
525 .quad sys_process_vm_readv
526 .quad sys_process_vm_writev /* 505 */
527 523
528 .size sys_call_table, . - sys_call_table 524 .size sys_call_table, . - sys_call_table
529 .type sys_call_table, @object 525 .type sys_call_table, @object
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 272666d006d..0414e021a91 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -24,7 +24,6 @@
24#include <asm/sysinfo.h> 24#include <asm/sysinfo.h>
25#include <asm/hwrpb.h> 25#include <asm/hwrpb.h>
26#include <asm/mmu_context.h> 26#include <asm/mmu_context.h>
27#include <asm/special_insns.h>
28 27
29#include "proto.h" 28#include "proto.h"
30 29
@@ -780,17 +779,17 @@ do_entUnaUser(void __user * va, unsigned long opcode,
780 /* Check the UAC bits to decide what the user wants us to do 779 /* Check the UAC bits to decide what the user wants us to do
781 with the unaliged access. */ 780 with the unaliged access. */
782 781
783 if (!(current_thread_info()->status & TS_UAC_NOPRINT)) { 782 if (!test_thread_flag (TIF_UAC_NOPRINT)) {
784 if (__ratelimit(&ratelimit)) { 783 if (__ratelimit(&ratelimit)) {
785 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", 784 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
786 current->comm, task_pid_nr(current), 785 current->comm, task_pid_nr(current),
787 regs->pc - 4, va, opcode, reg); 786 regs->pc - 4, va, opcode, reg);
788 } 787 }
789 } 788 }
790 if ((current_thread_info()->status & TS_UAC_SIGBUS)) 789 if (test_thread_flag (TIF_UAC_SIGBUS))
791 goto give_sigbus; 790 goto give_sigbus;
792 /* Not sure why you'd want to use this, but... */ 791 /* Not sure why you'd want to use this, but... */
793 if ((current_thread_info()->status & TS_UAC_NOFIX)) 792 if (test_thread_flag (TIF_UAC_NOFIX))
794 return; 793 return;
795 794
796 /* Don't bother reading ds in the access check since we already 795 /* Don't bother reading ds in the access check since we already
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 647b84c1538..f937ad12385 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -2,7 +2,6 @@
2#include <asm/thread_info.h> 2#include <asm/thread_info.h>
3#include <asm/cache.h> 3#include <asm/cache.h>
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm/setup.h>
6 5
7OUTPUT_FORMAT("elf64-alpha") 6OUTPUT_FORMAT("elf64-alpha")
8OUTPUT_ARCH(alpha) 7OUTPUT_ARCH(alpha)
@@ -26,7 +25,6 @@ SECTIONS
26 *(.fixup) 25 *(.fixup)
27 *(.gnu.warning) 26 *(.gnu.warning)
28 } :kernel 27 } :kernel
29 swapper_pg_dir = SWAPPER_PGD;
30 _etext = .; /* End of text section */ 28 _etext = .; /* End of text section */
31 29
32 NOTES :kernel :note 30 NOTES :kernel :note