···1313 * after a timer-interrupt and after each system call.1414 *1515 * Stack layout in 'ret_from_system_call':1616- * ptrace needs to have all regs on the stack.1717- * if the order here is changed, it needs to be 1616+ * ptrace needs to have all regs on the stack.1717+ * if the order here is changed, it needs to be1818 * updated in fork.c:copy_process, signal.c:do_signal,1919 * ptrace.c and ptrace.h2020 *···3131#include <asm/pgtable.h>32323333 ;; functions exported from this file3434-3434+3535 .globl system_call3636 .globl ret_from_intr3737 .globl ret_from_fork···4646 .globl do_sigtrap4747 .globl gdb_handle_breakpoint4848 .globl sys_call_table4949-4949+5050 ;; below are various parts of system_call which are not in the fast-path5151-5252-#ifdef CONFIG_PREEMPT 5151+5252+#ifdef CONFIG_PREEMPT5353 ; Check if preemptive kernel scheduling should be done5454_resume_kernel:5555 di···7474 nop7575#else7676#define _resume_kernel _Rexit7777-#endif 7777+#endif78787979 ; Called at exit from fork. schedule_tail must be called to drop8080 ; spinlock if CONFIG_PREEMPT···9191 ba ret_from_sys_call92929393ret_from_intr:9494- ;; check for resched if preemptive kernel or if we're going back to user-mode 9494+ ;; check for resched if preemptive kernel or if we're going back to user-mode9595 ;; this test matches the user_regs(regs) macro9696 ;; we cannot simply test $dccr, because that does not necessarily9797 ;; reflect what mode we'll return into.9898-9898+9999 move.d [$sp + PT_dccr], $r0; regs->dccr100100 btstq 8, $r0 ; U-flag101101 bpl _resume_kernel102102- ; Note that di below is in delay slot 103103-102102+ ; Note that di below is in delay slot103103+104104_resume_userspace:105105 di ; so need_resched and sigpending don't change106106···113113 nop114114 ba _Rexit115115 nop116116-116116+117117 ;; The system_call is called by a BREAK instruction, which works like118118 ;; an interrupt call but it stores the return PC in BRP instead of IRP.119119 ;; Since we dont really want to have two epilogues (one for system calls···123123 ;;124124 ;; Since we can't have system calls inside interrupts, it should not matter125125 ;; that we don't stack IRP.126126- ;; 126126+ ;;127127 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp128128 ;;129129 ;; This function looks on the _surface_ like spaghetti programming, but it's···140140 movem $r13, [$sp] ; push r0-r13141141 push $r10 ; push orig_r10142142 clear.d [$sp=$sp-4] ; frametype == 0, normal stackframe143143-143143+144144 movs.w -ENOSYS, $r0145145 move.d $r0, [$sp+PT_r10] ; put the default return value in r10 in the frame146146···148148149149 movs.w -8192, $r0 ; THREAD_SIZE == 8192150150 and.d $sp, $r0151151-151151+152152 move.d [$r0+TI_flags], $r0153153 btstq TIF_SYSCALL_TRACE, $r0154154 bmi _syscall_trace_entry155155- nop 155155+ nop156156157157-_syscall_traced: 157157+_syscall_traced:158158159159 ;; check for sanity in the requested syscall number160160-161161- cmpu.w NR_syscalls, $r9 160160+161161+ cmpu.w NR_syscalls, $r9162162 bcc ret_from_sys_call163163 lslq 2, $r9 ; multiply by 4, in the delay slot164164···166166 ;; of the register structure itself. some syscalls need this.167167168168 push $sp169169-169169+170170 ;; the parameter carrying registers r10, r11, r12 and 13 are intact.171171- ;; the fifth and sixth parameters (if any) was in mof and srp 171171+ ;; the fifth and sixth parameters (if any) was in mof and srp172172 ;; respectively, and we need to put them on the stack.173173174174 push $srp175175 push $mof176176-176176+177177 jsr [$r9+sys_call_table] ; actually do the system call178178 addq 3*4, $sp ; pop the mof, srp and regs parameters179179 move.d $r10, [$sp+PT_r10] ; save the return value180180181181 moveq 1, $r9 ; "parameter" to ret_from_sys_call to show it was a sys call182182-182182+183183 ;; fall through into ret_from_sys_call to return184184-184184+185185ret_from_sys_call:186186 ;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq187187-187187+188188 ;; get the current task-struct pointer (see top for defs)189189190190- movs.w -8192, $r0 ; THREAD_SIZE == 8192 190190+ movs.w -8192, $r0 ; THREAD_SIZE == 8192191191 and.d $sp, $r0192192193193 di ; make sure need_resched and sigpending don't change···202202 bne _RBFexit ; was not CRIS_FRAME_NORMAL, handle otherwise203203 addq 4, $sp ; skip orig_r10, in delayslot204204 movem [$sp+], $r13 ; registers r0-r13205205- pop $mof ; multiply overflow register 205205+ pop $mof ; multiply overflow register206206 pop $dccr ; condition codes207207 pop $srp ; subroutine return pointer208208 ;; now we have a 4-word SBFS frame which we do not want to restore···216216217217_RBFexit:218218 movem [$sp+], $r13 ; registers r0-r13, in delay slot219219- pop $mof ; multiply overflow register 219219+ pop $mof ; multiply overflow register220220 pop $dccr ; condition codes221221 pop $srp ; subroutine return pointer222222 rbf [$sp+] ; return by popping the CPU status223223224224 ;; We get here after doing a syscall if extra work might need to be done225225 ;; perform syscall exit tracing if needed226226-226226+227227_syscall_exit_work:228228 ;; $r0 contains current at this point and irq's are disabled229229···231231 btstq TIF_SYSCALL_TRACE, $r1232232 bpl _work_pending233233 nop234234-234234+235235 ei236236237237 move.d $r9, $r1 ; preserve r9238238 jsr do_syscall_trace239239 move.d $r1, $r9240240-240240+241241 ba _resume_userspace242242 nop243243-243243+244244_work_pending:245245 move.d [$r0+TI_flags], $r1246246 btstq TIF_NEED_RESCHED, $r1247247 bpl _work_notifysig ; was neither trace nor sched, must be signal/notify248248 nop249249-249249+250250_work_resched:251251 move.d $r9, $r1 ; preserve r9252252 jsr schedule···268268 move.d $sp, $r11 ; the regs param269269 move.d $r1, $r12 ; the thread_info_flags parameter270270 jsr do_notify_resume271271-271271+272272 ba _Rexit273273 nop274274275275 ;; We get here as a sidetrack when we've entered a syscall with the276276 ;; trace-bit set. We need to call do_syscall_trace and then continue277277 ;; with the call.278278-278278+279279_syscall_trace_entry:280280 ;; PT_r10 in the frame contains -ENOSYS as required, at this point281281-281281+282282 jsr do_syscall_trace283283284284 ;; now re-enter the syscall code to do the syscall itself···292292 move.d [$sp+PT_r13], $r13293293 move [$sp+PT_mof], $mof294294 move [$sp+PT_srp], $srp295295-295295+296296 ba _syscall_traced297297 nop298298-298298+299299 ;; resume performs the actual task-switching, by switching stack pointers300300 ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct301301 ;; returns old current in r10···303303 ;; TODO: see the i386 version. The switch_to which calls resume in our version304304 ;; could really be an inline asm of this.305305306306-resume: 307307- push $srp ; we keep the old/new PC on the stack 306306+resume:307307+ push $srp ; we keep the old/new PC on the stack308308 add.d $r12, $r10 ; r10 = current tasks tss309309 move $dccr, [$r10+THREAD_dccr]; save irq enable state310310 di311311312312 move $usp, [$r10+ THREAD_usp] ; save user-mode stackpointer313313-313313+314314 ;; See copy_thread for the reason why register R9 is saved.315315 subq 10*4, $sp316316 movem $r9, [$sp] ; save non-scratch registers and R9.317317-317317+318318 move.d $sp, [$r10+THREAD_ksp] ; save the kernel stack pointer for the old task319319 move.d $sp, $r10 ; return last running task in r10320320 and.d -8192, $r10 ; get thread_info from stackpointer321321- move.d [$r10+TI_task], $r10 ; get task 321321+ move.d [$r10+TI_task], $r10 ; get task322322 add.d $r12, $r11 ; find the new tasks tss323323 move.d [$r11+THREAD_ksp], $sp ; switch into the new stackframe by restoring kernel sp324324325325 movem [$sp+], $r9 ; restore non-scratch registers and R9.326326327327 move [$r11+THREAD_usp], $usp ; restore user-mode stackpointer328328-328328+329329 move [$r11+THREAD_dccr], $dccr ; restore irq enable status330330 jump [$sp+] ; restore PC331331···401401 push $r10 ; frametype == 1, BUSFAULT frame type402402403403 move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault404404-404404+405405 jsr handle_mmu_bus_fault ; in arch/cris/arch-v10/mm/fault.c406406407407 ;; now we need to return through the normal path, we cannot just···410410 ;; whatever.411411412412 moveq 0, $r9 ; busfault is equivalent to an irq413413-413413+414414 ba ret_from_intr415415 nop416416-416416+417417 ;; special handlers for breakpoint and NMI418418hwbreakpoint:419419 push $dccr···429429 pop $dccr430430 retb431431 nop432432-432432+433433IRQ1_interrupt:434434 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!435435 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame···500500 move.d $r10, [$r11]501501502502#endif503503-503503+504504;; Note that we don't do "setf m" here (or after two necessary NOPs),505505;; since *not* doing that saves us from re-entrancy checks. We don't want506506;; to get here again due to possible subsequent NMIs; we want the watchdog···525525526526#endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */527527528528-spurious_interrupt: 528528+spurious_interrupt:529529 di530530 jump hard_reset_now531531532532 ;; this handles the case when multiple interrupts arrive at the same time533533 ;; we jump to the first set interrupt bit in a priority fashion534534 ;; the hardware will call the unserved interrupts after the handler finishes535535-535535+536536multiple_interrupt:537537 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!538538 move $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame···551551 jump ret_from_intr552552553553do_sigtrap:554554- ;; 554554+ ;;555555 ;; SIGTRAP the process that executed the break instruction.556556 ;; Make a frame that Rexit in entry.S expects.557557 ;;···568568 movs.w -8192,$r9 ; THREAD_SIZE == 8192569569 and.d $sp, $r9570570 move.d [$r9+TI_task], $r10571571- move.d [$r10+TASK_pid], $r10 ; current->pid as arg1. 571571+ move.d [$r10+TASK_pid], $r10 ; current->pid as arg1.572572 moveq 5, $r11 ; SIGTRAP as arg2.573573- jsr sys_kill 573573+ jsr sys_kill574574 jump ret_from_intr ; Use the return routine for interrupts.575575576576-gdb_handle_breakpoint: 576576+gdb_handle_breakpoint:577577 push $dccr578578 push $r0579579#ifdef CONFIG_ETRAX_KGDB580580- move $dccr, $r0 ; U-flag not affected by previous insns. 580580+ move $dccr, $r0 ; U-flag not affected by previous insns.581581 btstq 8, $r0 ; Test the U-flag.582582- bmi _ugdb_handle_breakpoint ; Go to user mode debugging. 583583- nop ; Empty delay slot (cannot pop r0 here). 582582+ bmi _ugdb_handle_breakpoint ; Go to user mode debugging.583583+ nop ; Empty delay slot (cannot pop r0 here).584584 pop $r0 ; Restore r0.585585- ba kgdb_handle_breakpoint ; Go to kernel debugging. 585585+ ba kgdb_handle_breakpoint ; Go to kernel debugging.586586 pop $dccr ; Restore dccr in delay slot.587587#endif588588-589589-_ugdb_handle_breakpoint: 588588+589589+_ugdb_handle_breakpoint:590590 move $brp, $r0 ; Use r0 temporarily for calculation.591591 subq 2, $r0 ; Set to address of previous instruction.592592 move $r0, $brp593593- pop $r0 ; Restore r0. 594594- ba do_sigtrap ; SIGTRAP the offending process. 593593+ pop $r0 ; Restore r0.594594+ ba do_sigtrap ; SIGTRAP the offending process.595595 pop $dccr ; Restore dccr in delay slot.596596597597 .data···602602 .dword hw_bp_trigs603603604604 .section .rodata,"a"605605-sys_call_table: 605605+sys_call_table:606606 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */607607 .long sys_exit608608 .long sys_fork···713713 .long sys_newlstat714714 .long sys_newfstat715715 .long sys_ni_syscall /* old sys_uname holder */716716- .long sys_ni_syscall /* sys_iopl in i386 */716716+ .long sys_ni_syscall /* 110 */ /* sys_iopl in i386 */717717 .long sys_vhangup718718 .long sys_ni_syscall /* old "idle" system call */719719 .long sys_ni_syscall /* vm86old in i386 */···730730 .long sys_adjtimex731731 .long sys_mprotect /* 125 */732732 .long sys_sigprocmask733733- .long sys_ni_syscall /* old "create_module" */ 733733+ .long sys_ni_syscall /* old "create_module" */734734 .long sys_init_module735735 .long sys_delete_module736736 .long sys_ni_syscall /* 130: old "get_kernel_syms" */···795795 .long sys_ni_syscall /* streams2 */796796 .long sys_vfork /* 190 */797797 .long sys_getrlimit798798- .long sys_mmap2798798+ .long sys_mmap2 /* mmap_pgoff */799799 .long sys_truncate64800800 .long sys_ftruncate64801801 .long sys_stat64 /* 195 */···861861 .long sys_epoll_ctl /* 255 */862862 .long sys_epoll_wait863863 .long sys_remap_file_pages864864- .long sys_set_tid_address865865- .long sys_timer_create866866- .long sys_timer_settime /* 260 */867867- .long sys_timer_gettime868868- .long sys_timer_getoverrun869869- .long sys_timer_delete870870- .long sys_clock_settime871871- .long sys_clock_gettime /* 265 */872872- .long sys_clock_getres873873- .long sys_clock_nanosleep864864+ .long sys_set_tid_address865865+ .long sys_timer_create866866+ .long sys_timer_settime /* 260 */867867+ .long sys_timer_gettime868868+ .long sys_timer_getoverrun869869+ .long sys_timer_delete870870+ .long sys_clock_settime871871+ .long sys_clock_gettime /* 265 */872872+ .long sys_clock_getres873873+ .long sys_clock_nanosleep874874 .long sys_statfs64875875- .long sys_fstatfs64 876876- .long sys_tgkill /* 270 */875875+ .long sys_fstatfs64876876+ .long sys_tgkill /* 270 */877877 .long sys_utimes878878- .long sys_fadvise64_64878878+ .long sys_fadvise64_64879879 .long sys_ni_syscall /* sys_vserver */880880 .long sys_ni_syscall /* sys_mbind */881881 .long sys_ni_syscall /* 275 sys_get_mempolicy */···886886 .long sys_mq_timedreceive /* 280 */887887 .long sys_mq_notify888888 .long sys_mq_getsetattr889889- .long sys_ni_syscall /* reserved for kexec */889889+ .long sys_ni_syscall890890 .long sys_waitid891891 .long sys_ni_syscall /* 285 */ /* available */892892 .long sys_add_key···939939 .long sys_preadv940940 .long sys_pwritev941941 .long sys_setns /* 335 */942942+ .long sys_name_to_handle_at943943+ .long sys_open_by_handle_at944944+ .long sys_rt_tgsigqueueinfo945945+ .long sys_perf_event_open946946+ .long sys_recvmmsg /* 340 */947947+ .long sys_accept4948948+ .long sys_fanotify_init949949+ .long sys_fanotify_mark950950+ .long sys_prlimit64951951+ .long sys_clock_adjtime /* 345 */952952+ .long sys_syncfs953953+ .long sys_sendmmsg954954+ .long sys_process_vm_readv955955+ .long sys_process_vm_writev956956+ .long sys_kcmp /* 350 */957957+ .long sys_finit_module942958943959 /*944960 * NOTE!! This doesn't have to be exact - we just have···966950 .rept NR_syscalls-(.-sys_call_table)/4967951 .long sys_ni_syscall968952 .endr969969-953953+
+24-8
arch/cris/arch-v32/kernel/entry.S
···424424 bpl 1f425425 nop426426 jsr handle_watchdog_bite ; In time.c.427427- move.d $sp, $r10 ; Pointer to registers427427+ move.d $sp, $r10 ; Pointer to registers4284281: btstq REG_BIT(intr_vect, r_nmi, ext), $r0429429 bpl 1f430430 nop···452452 nop453453454454 ;; This handles the case when multiple interrupts arrive at the same455455- ;; time. Jump to the first set interrupt bit in a priotiry fashion. The455455+ ;; time. Jump to the first set interrupt bit in a priority fashion. The456456 ;; hardware will call the unserved interrupts after the handler457457 ;; finishes.458458 .type multiple_interrupt, @function···885885 .long sys_preadv886886 .long sys_pwritev887887 .long sys_setns /* 335 */888888+ .long sys_name_to_handle_at889889+ .long sys_open_by_handle_at890890+ .long sys_rt_tgsigqueueinfo891891+ .long sys_perf_event_open892892+ .long sys_recvmmsg /* 340 */893893+ .long sys_accept4894894+ .long sys_fanotify_init895895+ .long sys_fanotify_mark896896+ .long sys_prlimit64897897+ .long sys_clock_adjtime /* 345 */898898+ .long sys_syncfs899899+ .long sys_sendmmsg900900+ .long sys_process_vm_readv901901+ .long sys_process_vm_writev902902+ .long sys_kcmp /* 350 */903903+ .long sys_finit_module888904889889- /*890890- * NOTE!! This doesn't have to be exact - we just have891891- * to make sure we have _enough_ of the "sys_ni_syscall"892892- * entries. Don't panic if you notice that this hasn't893893- * been shrunk every time we add a new system call.894894- */905905+ /*906906+ * NOTE!! This doesn't have to be exact - we just have907907+ * to make sure we have _enough_ of the "sys_ni_syscall"908908+ * entries. Don't panic if you notice that this hasn't909909+ * been shrunk every time we add a new system call.910910+ */895911896912 .rept NR_syscalls - (.-sys_call_table) / 4897913 .long sys_ni_syscall