Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: Add missing syscalls

Complete list of syscalls for CRISv10 and CRISv32.
Clean up some whitespace at the same time.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

+139 -91
+98 -82
arch/cris/arch-v10/kernel/entry.S
··· 13 13 * after a timer-interrupt and after each system call. 14 14 * 15 15 * Stack layout in 'ret_from_system_call': 16 - * ptrace needs to have all regs on the stack. 17 - * if the order here is changed, it needs to be 16 + * ptrace needs to have all regs on the stack. 17 + * if the order here is changed, it needs to be 18 18 * updated in fork.c:copy_process, signal.c:do_signal, 19 19 * ptrace.c and ptrace.h 20 20 * ··· 31 31 #include <asm/pgtable.h> 32 32 33 33 ;; functions exported from this file 34 - 34 + 35 35 .globl system_call 36 36 .globl ret_from_intr 37 37 .globl ret_from_fork ··· 46 46 .globl do_sigtrap 47 47 .globl gdb_handle_breakpoint 48 48 .globl sys_call_table 49 - 49 + 50 50 ;; below are various parts of system_call which are not in the fast-path 51 - 52 - #ifdef CONFIG_PREEMPT 51 + 52 + #ifdef CONFIG_PREEMPT 53 53 ; Check if preemptive kernel scheduling should be done 54 54 _resume_kernel: 55 55 di ··· 74 74 nop 75 75 #else 76 76 #define _resume_kernel _Rexit 77 - #endif 77 + #endif 78 78 79 79 ; Called at exit from fork. schedule_tail must be called to drop 80 80 ; spinlock if CONFIG_PREEMPT ··· 91 91 ba ret_from_sys_call 92 92 93 93 ret_from_intr: 94 - ;; check for resched if preemptive kernel or if we're going back to user-mode 94 + ;; check for resched if preemptive kernel or if we're going back to user-mode 95 95 ;; this test matches the user_regs(regs) macro 96 96 ;; we cannot simply test $dccr, because that does not necessarily 97 97 ;; reflect what mode we'll return into. 98 - 98 + 99 99 move.d [$sp + PT_dccr], $r0; regs->dccr 100 100 btstq 8, $r0 ; U-flag 101 101 bpl _resume_kernel 102 - ; Note that di below is in delay slot 103 - 102 + ; Note that di below is in delay slot 103 + 104 104 _resume_userspace: 105 105 di ; so need_resched and sigpending don't change 106 106 ··· 113 113 nop 114 114 ba _Rexit 115 115 nop 116 - 116 + 117 117 ;; The system_call is called by a BREAK instruction, which works like 118 118 ;; an interrupt call but it stores the return PC in BRP instead of IRP. 119 119 ;; Since we dont really want to have two epilogues (one for system calls ··· 123 123 ;; 124 124 ;; Since we can't have system calls inside interrupts, it should not matter 125 125 ;; that we don't stack IRP. 126 - ;; 126 + ;; 127 127 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp 128 128 ;; 129 129 ;; This function looks on the _surface_ like spaghetti programming, but it's ··· 140 140 movem $r13, [$sp] ; push r0-r13 141 141 push $r10 ; push orig_r10 142 142 clear.d [$sp=$sp-4] ; frametype == 0, normal stackframe 143 - 143 + 144 144 movs.w -ENOSYS, $r0 145 145 move.d $r0, [$sp+PT_r10] ; put the default return value in r10 in the frame 146 146 ··· 148 148 149 149 movs.w -8192, $r0 ; THREAD_SIZE == 8192 150 150 and.d $sp, $r0 151 - 151 + 152 152 move.d [$r0+TI_flags], $r0 153 153 btstq TIF_SYSCALL_TRACE, $r0 154 154 bmi _syscall_trace_entry 155 - nop 155 + nop 156 156 157 - _syscall_traced: 157 + _syscall_traced: 158 158 159 159 ;; check for sanity in the requested syscall number 160 - 161 - cmpu.w NR_syscalls, $r9 160 + 161 + cmpu.w NR_syscalls, $r9 162 162 bcc ret_from_sys_call 163 163 lslq 2, $r9 ; multiply by 4, in the delay slot 164 164 ··· 166 166 ;; of the register structure itself. some syscalls need this. 167 167 168 168 push $sp 169 - 169 + 170 170 ;; the parameter carrying registers r10, r11, r12 and 13 are intact. 171 - ;; the fifth and sixth parameters (if any) was in mof and srp 171 + ;; the fifth and sixth parameters (if any) was in mof and srp 172 172 ;; respectively, and we need to put them on the stack. 173 173 174 174 push $srp 175 175 push $mof 176 - 176 + 177 177 jsr [$r9+sys_call_table] ; actually do the system call 178 178 addq 3*4, $sp ; pop the mof, srp and regs parameters 179 179 move.d $r10, [$sp+PT_r10] ; save the return value 180 180 181 181 moveq 1, $r9 ; "parameter" to ret_from_sys_call to show it was a sys call 182 - 182 + 183 183 ;; fall through into ret_from_sys_call to return 184 - 184 + 185 185 ret_from_sys_call: 186 186 ;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq 187 - 187 + 188 188 ;; get the current task-struct pointer (see top for defs) 189 189 190 - movs.w -8192, $r0 ; THREAD_SIZE == 8192 190 + movs.w -8192, $r0 ; THREAD_SIZE == 8192 191 191 and.d $sp, $r0 192 192 193 193 di ; make sure need_resched and sigpending don't change ··· 202 202 bne _RBFexit ; was not CRIS_FRAME_NORMAL, handle otherwise 203 203 addq 4, $sp ; skip orig_r10, in delayslot 204 204 movem [$sp+], $r13 ; registers r0-r13 205 - pop $mof ; multiply overflow register 205 + pop $mof ; multiply overflow register 206 206 pop $dccr ; condition codes 207 207 pop $srp ; subroutine return pointer 208 208 ;; now we have a 4-word SBFS frame which we do not want to restore ··· 216 216 217 217 _RBFexit: 218 218 movem [$sp+], $r13 ; registers r0-r13, in delay slot 219 - pop $mof ; multiply overflow register 219 + pop $mof ; multiply overflow register 220 220 pop $dccr ; condition codes 221 221 pop $srp ; subroutine return pointer 222 222 rbf [$sp+] ; return by popping the CPU status 223 223 224 224 ;; We get here after doing a syscall if extra work might need to be done 225 225 ;; perform syscall exit tracing if needed 226 - 226 + 227 227 _syscall_exit_work: 228 228 ;; $r0 contains current at this point and irq's are disabled 229 229 ··· 231 231 btstq TIF_SYSCALL_TRACE, $r1 232 232 bpl _work_pending 233 233 nop 234 - 234 + 235 235 ei 236 236 237 237 move.d $r9, $r1 ; preserve r9 238 238 jsr do_syscall_trace 239 239 move.d $r1, $r9 240 - 240 + 241 241 ba _resume_userspace 242 242 nop 243 - 243 + 244 244 _work_pending: 245 245 move.d [$r0+TI_flags], $r1 246 246 btstq TIF_NEED_RESCHED, $r1 247 247 bpl _work_notifysig ; was neither trace nor sched, must be signal/notify 248 248 nop 249 - 249 + 250 250 _work_resched: 251 251 move.d $r9, $r1 ; preserve r9 252 252 jsr schedule ··· 268 268 move.d $sp, $r11 ; the regs param 269 269 move.d $r1, $r12 ; the thread_info_flags parameter 270 270 jsr do_notify_resume 271 - 271 + 272 272 ba _Rexit 273 273 nop 274 274 275 275 ;; We get here as a sidetrack when we've entered a syscall with the 276 276 ;; trace-bit set. We need to call do_syscall_trace and then continue 277 277 ;; with the call. 278 - 278 + 279 279 _syscall_trace_entry: 280 280 ;; PT_r10 in the frame contains -ENOSYS as required, at this point 281 - 281 + 282 282 jsr do_syscall_trace 283 283 284 284 ;; now re-enter the syscall code to do the syscall itself ··· 292 292 move.d [$sp+PT_r13], $r13 293 293 move [$sp+PT_mof], $mof 294 294 move [$sp+PT_srp], $srp 295 - 295 + 296 296 ba _syscall_traced 297 297 nop 298 - 298 + 299 299 ;; resume performs the actual task-switching, by switching stack pointers 300 300 ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct 301 301 ;; returns old current in r10 ··· 303 303 ;; TODO: see the i386 version. The switch_to which calls resume in our version 304 304 ;; could really be an inline asm of this. 305 305 306 - resume: 307 - push $srp ; we keep the old/new PC on the stack 306 + resume: 307 + push $srp ; we keep the old/new PC on the stack 308 308 add.d $r12, $r10 ; r10 = current tasks tss 309 309 move $dccr, [$r10+THREAD_dccr]; save irq enable state 310 310 di 311 311 312 312 move $usp, [$r10+ THREAD_usp] ; save user-mode stackpointer 313 - 313 + 314 314 ;; See copy_thread for the reason why register R9 is saved. 315 315 subq 10*4, $sp 316 316 movem $r9, [$sp] ; save non-scratch registers and R9. 317 - 317 + 318 318 move.d $sp, [$r10+THREAD_ksp] ; save the kernel stack pointer for the old task 319 319 move.d $sp, $r10 ; return last running task in r10 320 320 and.d -8192, $r10 ; get thread_info from stackpointer 321 - move.d [$r10+TI_task], $r10 ; get task 321 + move.d [$r10+TI_task], $r10 ; get task 322 322 add.d $r12, $r11 ; find the new tasks tss 323 323 move.d [$r11+THREAD_ksp], $sp ; switch into the new stackframe by restoring kernel sp 324 324 325 325 movem [$sp+], $r9 ; restore non-scratch registers and R9. 326 326 327 327 move [$r11+THREAD_usp], $usp ; restore user-mode stackpointer 328 - 328 + 329 329 move [$r11+THREAD_dccr], $dccr ; restore irq enable status 330 330 jump [$sp+] ; restore PC 331 331 ··· 401 401 push $r10 ; frametype == 1, BUSFAULT frame type 402 402 403 403 move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault 404 - 404 + 405 405 jsr handle_mmu_bus_fault ; in arch/cris/arch-v10/mm/fault.c 406 406 407 407 ;; now we need to return through the normal path, we cannot just ··· 410 410 ;; whatever. 411 411 412 412 moveq 0, $r9 ; busfault is equivalent to an irq 413 - 413 + 414 414 ba ret_from_intr 415 415 nop 416 - 416 + 417 417 ;; special handlers for breakpoint and NMI 418 418 hwbreakpoint: 419 419 push $dccr ··· 429 429 pop $dccr 430 430 retb 431 431 nop 432 - 432 + 433 433 IRQ1_interrupt: 434 434 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 435 435 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame ··· 500 500 move.d $r10, [$r11] 501 501 502 502 #endif 503 - 503 + 504 504 ;; Note that we don't do "setf m" here (or after two necessary NOPs), 505 505 ;; since *not* doing that saves us from re-entrancy checks. We don't want 506 506 ;; to get here again due to possible subsequent NMIs; we want the watchdog ··· 525 525 526 526 #endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */ 527 527 528 - spurious_interrupt: 528 + spurious_interrupt: 529 529 di 530 530 jump hard_reset_now 531 531 532 532 ;; this handles the case when multiple interrupts arrive at the same time 533 533 ;; we jump to the first set interrupt bit in a priority fashion 534 534 ;; the hardware will call the unserved interrupts after the handler finishes 535 - 535 + 536 536 multiple_interrupt: 537 537 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 538 538 move $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame ··· 551 551 jump ret_from_intr 552 552 553 553 do_sigtrap: 554 - ;; 554 + ;; 555 555 ;; SIGTRAP the process that executed the break instruction. 556 556 ;; Make a frame that Rexit in entry.S expects. 557 557 ;; ··· 568 568 movs.w -8192,$r9 ; THREAD_SIZE == 8192 569 569 and.d $sp, $r9 570 570 move.d [$r9+TI_task], $r10 571 - move.d [$r10+TASK_pid], $r10 ; current->pid as arg1. 571 + move.d [$r10+TASK_pid], $r10 ; current->pid as arg1. 572 572 moveq 5, $r11 ; SIGTRAP as arg2. 573 - jsr sys_kill 573 + jsr sys_kill 574 574 jump ret_from_intr ; Use the return routine for interrupts. 575 575 576 - gdb_handle_breakpoint: 576 + gdb_handle_breakpoint: 577 577 push $dccr 578 578 push $r0 579 579 #ifdef CONFIG_ETRAX_KGDB 580 - move $dccr, $r0 ; U-flag not affected by previous insns. 580 + move $dccr, $r0 ; U-flag not affected by previous insns. 581 581 btstq 8, $r0 ; Test the U-flag. 582 - bmi _ugdb_handle_breakpoint ; Go to user mode debugging. 583 - nop ; Empty delay slot (cannot pop r0 here). 582 + bmi _ugdb_handle_breakpoint ; Go to user mode debugging. 583 + nop ; Empty delay slot (cannot pop r0 here). 584 584 pop $r0 ; Restore r0. 585 - ba kgdb_handle_breakpoint ; Go to kernel debugging. 585 + ba kgdb_handle_breakpoint ; Go to kernel debugging. 586 586 pop $dccr ; Restore dccr in delay slot. 587 587 #endif 588 - 589 - _ugdb_handle_breakpoint: 588 + 589 + _ugdb_handle_breakpoint: 590 590 move $brp, $r0 ; Use r0 temporarily for calculation. 591 591 subq 2, $r0 ; Set to address of previous instruction. 592 592 move $r0, $brp 593 - pop $r0 ; Restore r0. 594 - ba do_sigtrap ; SIGTRAP the offending process. 593 + pop $r0 ; Restore r0. 594 + ba do_sigtrap ; SIGTRAP the offending process. 595 595 pop $dccr ; Restore dccr in delay slot. 596 596 597 597 .data ··· 602 602 .dword hw_bp_trigs 603 603 604 604 .section .rodata,"a" 605 - sys_call_table: 605 + sys_call_table: 606 606 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ 607 607 .long sys_exit 608 608 .long sys_fork ··· 713 713 .long sys_newlstat 714 714 .long sys_newfstat 715 715 .long sys_ni_syscall /* old sys_uname holder */ 716 - .long sys_ni_syscall /* sys_iopl in i386 */ 716 + .long sys_ni_syscall /* 110 */ /* sys_iopl in i386 */ 717 717 .long sys_vhangup 718 718 .long sys_ni_syscall /* old "idle" system call */ 719 719 .long sys_ni_syscall /* vm86old in i386 */ ··· 730 730 .long sys_adjtimex 731 731 .long sys_mprotect /* 125 */ 732 732 .long sys_sigprocmask 733 - .long sys_ni_syscall /* old "create_module" */ 733 + .long sys_ni_syscall /* old "create_module" */ 734 734 .long sys_init_module 735 735 .long sys_delete_module 736 736 .long sys_ni_syscall /* 130: old "get_kernel_syms" */ ··· 795 795 .long sys_ni_syscall /* streams2 */ 796 796 .long sys_vfork /* 190 */ 797 797 .long sys_getrlimit 798 - .long sys_mmap2 798 + .long sys_mmap2 /* mmap_pgoff */ 799 799 .long sys_truncate64 800 800 .long sys_ftruncate64 801 801 .long sys_stat64 /* 195 */ ··· 861 861 .long sys_epoll_ctl /* 255 */ 862 862 .long sys_epoll_wait 863 863 .long sys_remap_file_pages 864 - .long sys_set_tid_address 865 - .long sys_timer_create 866 - .long sys_timer_settime /* 260 */ 867 - .long sys_timer_gettime 868 - .long sys_timer_getoverrun 869 - .long sys_timer_delete 870 - .long sys_clock_settime 871 - .long sys_clock_gettime /* 265 */ 872 - .long sys_clock_getres 873 - .long sys_clock_nanosleep 864 + .long sys_set_tid_address 865 + .long sys_timer_create 866 + .long sys_timer_settime /* 260 */ 867 + .long sys_timer_gettime 868 + .long sys_timer_getoverrun 869 + .long sys_timer_delete 870 + .long sys_clock_settime 871 + .long sys_clock_gettime /* 265 */ 872 + .long sys_clock_getres 873 + .long sys_clock_nanosleep 874 874 .long sys_statfs64 875 - .long sys_fstatfs64 876 - .long sys_tgkill /* 270 */ 875 + .long sys_fstatfs64 876 + .long sys_tgkill /* 270 */ 877 877 .long sys_utimes 878 - .long sys_fadvise64_64 878 + .long sys_fadvise64_64 879 879 .long sys_ni_syscall /* sys_vserver */ 880 880 .long sys_ni_syscall /* sys_mbind */ 881 881 .long sys_ni_syscall /* 275 sys_get_mempolicy */ ··· 886 886 .long sys_mq_timedreceive /* 280 */ 887 887 .long sys_mq_notify 888 888 .long sys_mq_getsetattr 889 - .long sys_ni_syscall /* reserved for kexec */ 889 + .long sys_ni_syscall 890 890 .long sys_waitid 891 891 .long sys_ni_syscall /* 285 */ /* available */ 892 892 .long sys_add_key ··· 939 939 .long sys_preadv 940 940 .long sys_pwritev 941 941 .long sys_setns /* 335 */ 942 + .long sys_name_to_handle_at 943 + .long sys_open_by_handle_at 944 + .long sys_rt_tgsigqueueinfo 945 + .long sys_perf_event_open 946 + .long sys_recvmmsg /* 340 */ 947 + .long sys_accept4 948 + .long sys_fanotify_init 949 + .long sys_fanotify_mark 950 + .long sys_prlimit64 951 + .long sys_clock_adjtime /* 345 */ 952 + .long sys_syncfs 953 + .long sys_sendmmsg 954 + .long sys_process_vm_readv 955 + .long sys_process_vm_writev 956 + .long sys_kcmp /* 350 */ 957 + .long sys_finit_module 942 958 943 959 /* 944 960 * NOTE!! This doesn't have to be exact - we just have ··· 966 950 .rept NR_syscalls-(.-sys_call_table)/4 967 951 .long sys_ni_syscall 968 952 .endr 969 - 953 +
+24 -8
arch/cris/arch-v32/kernel/entry.S
··· 424 424 bpl 1f 425 425 nop 426 426 jsr handle_watchdog_bite ; In time.c. 427 - move.d $sp, $r10 ; Pointer to registers 427 + move.d $sp, $r10 ; Pointer to registers 428 428 1: btstq REG_BIT(intr_vect, r_nmi, ext), $r0 429 429 bpl 1f 430 430 nop ··· 452 452 nop 453 453 454 454 ;; This handles the case when multiple interrupts arrive at the same 455 - ;; time. Jump to the first set interrupt bit in a priotiry fashion. The 455 + ;; time. Jump to the first set interrupt bit in a priority fashion. The 456 456 ;; hardware will call the unserved interrupts after the handler 457 457 ;; finishes. 458 458 .type multiple_interrupt, @function ··· 885 885 .long sys_preadv 886 886 .long sys_pwritev 887 887 .long sys_setns /* 335 */ 888 + .long sys_name_to_handle_at 889 + .long sys_open_by_handle_at 890 + .long sys_rt_tgsigqueueinfo 891 + .long sys_perf_event_open 892 + .long sys_recvmmsg /* 340 */ 893 + .long sys_accept4 894 + .long sys_fanotify_init 895 + .long sys_fanotify_mark 896 + .long sys_prlimit64 897 + .long sys_clock_adjtime /* 345 */ 898 + .long sys_syncfs 899 + .long sys_sendmmsg 900 + .long sys_process_vm_readv 901 + .long sys_process_vm_writev 902 + .long sys_kcmp /* 350 */ 903 + .long sys_finit_module 888 904 889 - /* 890 - * NOTE!! This doesn't have to be exact - we just have 891 - * to make sure we have _enough_ of the "sys_ni_syscall" 892 - * entries. Don't panic if you notice that this hasn't 893 - * been shrunk every time we add a new system call. 894 - */ 905 + /* 906 + * NOTE!! This doesn't have to be exact - we just have 907 + * to make sure we have _enough_ of the "sys_ni_syscall" 908 + * entries. Don't panic if you notice that this hasn't 909 + * been shrunk every time we add a new system call. 910 + */ 895 911 896 912 .rept NR_syscalls - (.-sys_call_table) / 4 897 913 .long sys_ni_syscall
+1 -1
arch/cris/include/asm/unistd.h
··· 4 4 #include <uapi/asm/unistd.h> 5 5 6 6 7 - #define NR_syscalls 336 7 + #define NR_syscalls 360 8 8 9 9 #include <arch/unistd.h> 10 10
+16
arch/cris/include/uapi/asm/unistd.h
··· 340 340 #define __NR_preadv 333 341 341 #define __NR_pwritev 334 342 342 #define __NR_setns 335 343 + #define __NR_name_to_handle_at 336 344 + #define __NR_open_by_handle_at 337 345 + #define __NR_rt_tgsigqueueinfo 338 346 + #define __NR_perf_event_open 339 347 + #define __NR_recvmmsg 340 348 + #define __NR_accept4 341 349 + #define __NR_fanotify_init 342 350 + #define __NR_fanotify_mark 343 351 + #define __NR_prlimit64 344 352 + #define __NR_clock_adjtime 345 353 + #define __NR_syncfs 346 354 + #define __NR_sendmmsg 347 355 + #define __NR_process_vm_readv 348 356 + #define __NR_process_vm_writev 349 357 + #define __NR_kcmp 350 358 + #define __NR_finit_module 351 343 359 344 360 #endif /* _UAPI_ASM_CRIS_UNISTD_H_ */