diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2012-08-18 22:40:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-19 11:41:19 -0400 |
commit | be53db6e4edd9dc013b21a929ad2b142dea8b9c0 (patch) | |
tree | 7c4604295375f432071c2077362df2e6c278af53 /arch/alpha/kernel | |
parent | f2db633d301b4b50f5f93de0e8314cc81e9bc7de (diff) |
alpha: take a bunch of syscalls into osf_sys.c
New helper: current_thread_info(). Allows to do a bunch of odd syscalls
in C. While we are at it, there had never been a reason to do
osf_getpriority() in assembler. We also get "namespace"-aware (read:
consistent with getuid(2), etc.) behaviour from getx?id() syscalls now.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Michael Cree <mcree@orcon.net.nz>
Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha/kernel')
-rw-r--r-- | arch/alpha/kernel/entry.S | 109 | ||||
-rw-r--r-- | arch/alpha/kernel/osf_sys.c | 49 | ||||
-rw-r--r-- | arch/alpha/kernel/systbls.S | 2 |
3 files changed, 50 insertions, 110 deletions
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 6d159cee5f2f..22b0c4d414a7 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -797,115 +797,6 @@ sys_rt_sigreturn: | |||
797 | .end sys_rt_sigreturn | 797 | .end sys_rt_sigreturn |
798 | 798 | ||
799 | .align 4 | 799 | .align 4 |
800 | .globl sys_sethae | ||
801 | .ent sys_sethae | ||
802 | sys_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 | ||
811 | osf_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 | |||
829 | 1: lda $sp, 16($sp) | ||
830 | ret | ||
831 | .end osf_getpriority | ||
832 | |||
833 | .align 4 | ||
834 | .globl sys_getxuid | ||
835 | .ent sys_getxuid | ||
836 | sys_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 | ||
849 | sys_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 | ||
862 | sys_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) | ||
871 | 1: 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 | ||
887 | sys_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) | ||
904 | 1: lda $sp, 16($sp) | ||
905 | ret | ||
906 | .end sys_alpha_pipe | ||
907 | |||
908 | .align 4 | ||
909 | .globl sys_execve | 800 | .globl sys_execve |
910 | .ent sys_execve | 801 | .ent sys_execve |
911 | sys_execve: | 802 | sys_execve: |
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 98a103621af6..bc1acdda7a5e 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -1404,3 +1404,52 @@ SYSCALL_DEFINE3(osf_writev, unsigned long, fd, | |||
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | #endif | 1406 | #endif |
1407 | |||
1408 | SYSCALL_DEFINE2(osf_getpriority, int, which, int, who) | ||
1409 | { | ||
1410 | int prio = sys_getpriority(which, who); | ||
1411 | if (prio >= 0) { | ||
1412 | /* Return value is the unbiased priority, i.e. 20 - prio. | ||
1413 | This does result in negative return values, so signal | ||
1414 | no error */ | ||
1415 | force_successful_syscall_return(); | ||
1416 | prio = 20 - prio; | ||
1417 | } | ||
1418 | return prio; | ||
1419 | } | ||
1420 | |||
1421 | SYSCALL_DEFINE0(getxuid) | ||
1422 | { | ||
1423 | current_pt_regs()->r20 = sys_geteuid(); | ||
1424 | return sys_getuid(); | ||
1425 | } | ||
1426 | |||
1427 | SYSCALL_DEFINE0(getxgid) | ||
1428 | { | ||
1429 | current_pt_regs()->r20 = sys_getegid(); | ||
1430 | return sys_getgid(); | ||
1431 | } | ||
1432 | |||
1433 | SYSCALL_DEFINE0(getxpid) | ||
1434 | { | ||
1435 | current_pt_regs()->r20 = sys_getppid(); | ||
1436 | return sys_getpid(); | ||
1437 | } | ||
1438 | |||
1439 | SYSCALL_DEFINE0(alpha_pipe) | ||
1440 | { | ||
1441 | int fd[2]; | ||
1442 | int res = do_pipe_flags(fd, 0); | ||
1443 | if (!res) { | ||
1444 | /* The return values are in $0 and $20. */ | ||
1445 | current_pt_regs()->r20 = fd[1]; | ||
1446 | res = fd[0]; | ||
1447 | } | ||
1448 | return res; | ||
1449 | } | ||
1450 | |||
1451 | SYSCALL_DEFINE1(sethae, unsigned long, val) | ||
1452 | { | ||
1453 | current_pt_regs()->hae = val; | ||
1454 | return 0; | ||
1455 | } | ||
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index b64157c98e02..2ac6b45c3e00 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -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 osf_getpriority /* 100 */ | 114 | .quad sys_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 |