entry.S 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  1. /*
  2. * linux/arch/cris/entry.S
  3. *
  4. * Copyright (C) 2000, 2001, 2002 Axis Communications AB
  5. *
  6. * Authors: Bjorn Wesen (bjornw@axis.com)
  7. */
  8. /*
  9. * entry.S contains the system-call and fault low-level handling routines.
  10. *
  11. * NOTE: This code handles signal-recognition, which happens every time
  12. * after a timer-interrupt and after each system call.
  13. *
  14. * Stack layout in 'ret_from_system_call':
  15. * ptrace needs to have all regs on the stack.
  16. * if the order here is changed, it needs to be
  17. * updated in fork.c:copy_process, signal.c:do_signal,
  18. * ptrace.c and ptrace.h
  19. *
  20. */
  21. #include <linux/linkage.h>
  22. #include <linux/sys.h>
  23. #include <asm/unistd.h>
  24. #include <arch/sv_addr_ag.h>
  25. #include <asm/errno.h>
  26. #include <asm/thread_info.h>
  27. #include <asm/asm-offsets.h>
  28. #include <asm/page.h>
  29. #include <asm/pgtable.h>
  30. ;; functions exported from this file
  31. .globl system_call
  32. .globl ret_from_intr
  33. .globl ret_from_fork
  34. .globl ret_from_kernel_thread
  35. .globl resume
  36. .globl multiple_interrupt
  37. .globl hwbreakpoint
  38. .globl IRQ1_interrupt
  39. .globl spurious_interrupt
  40. .globl hw_bp_trigs
  41. .globl mmu_bus_fault
  42. .globl do_sigtrap
  43. .globl gdb_handle_breakpoint
  44. .globl sys_call_table
  45. ;; below are various parts of system_call which are not in the fast-path
  46. #ifdef CONFIG_PREEMPT
  47. ; Check if preemptive kernel scheduling should be done
  48. _resume_kernel:
  49. di
  50. ; Load current task struct
  51. movs.w -8192, $r0 ; THREAD_SIZE = 8192
  52. and.d $sp, $r0
  53. move.d [$r0+TI_preempt_count], $r10 ; Preemption disabled?
  54. bne _Rexit
  55. nop
  56. _need_resched:
  57. move.d [$r0+TI_flags], $r10
  58. btstq TIF_NEED_RESCHED, $r10 ; Check if need_resched is set
  59. bpl _Rexit
  60. nop
  61. ; Ok, lets's do some preemptive kernel scheduling
  62. jsr preempt_schedule_irq
  63. ; Load new task struct
  64. movs.w -8192, $r0 ; THREAD_SIZE = 8192
  65. and.d $sp, $r0
  66. ; One more time (with new task)
  67. ba _need_resched
  68. nop
  69. #else
  70. #define _resume_kernel _Rexit
  71. #endif
  72. ; Called at exit from fork. schedule_tail must be called to drop
  73. ; spinlock if CONFIG_PREEMPT
  74. ret_from_fork:
  75. jsr schedule_tail
  76. ba ret_from_sys_call
  77. nop
  78. ret_from_kernel_thread:
  79. jsr schedule_tail
  80. move.d $r2, $r10 ; argument is here
  81. jsr $r1 ; call the payload
  82. moveq 0, $r9 ; no syscall restarts, TYVM...
  83. ba ret_from_sys_call
  84. ret_from_intr:
  85. ;; check for resched if preemptive kernel or if we're going back to user-mode
  86. ;; this test matches the user_regs(regs) macro
  87. ;; we cannot simply test $dccr, because that does not necessarily
  88. ;; reflect what mode we'll return into.
  89. move.d [$sp + PT_dccr], $r0; regs->dccr
  90. btstq 8, $r0 ; U-flag
  91. bpl _resume_kernel
  92. ; Note that di below is in delay slot
  93. _resume_userspace:
  94. di ; so need_resched and sigpending don't change
  95. movs.w -8192, $r0 ; THREAD_SIZE == 8192
  96. and.d $sp, $r0
  97. move.d [$r0+TI_flags], $r10 ; current->work
  98. and.d _TIF_WORK_MASK, $r10 ; is there any work to be done on return
  99. bne _work_pending
  100. nop
  101. ba _Rexit
  102. nop
  103. ;; The system_call is called by a BREAK instruction, which works like
  104. ;; an interrupt call but it stores the return PC in BRP instead of IRP.
  105. ;; Since we dont really want to have two epilogues (one for system calls
  106. ;; and one for interrupts) we push the contents of BRP instead of IRP in the
  107. ;; system call prologue, to make it look like an ordinary interrupt on the
  108. ;; stackframe.
  109. ;;
  110. ;; Since we can't have system calls inside interrupts, it should not matter
  111. ;; that we don't stack IRP.
  112. ;;
  113. ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp
  114. ;;
  115. ;; This function looks on the _surface_ like spaghetti programming, but it's
  116. ;; really designed so that the fast-path does not force cache-loading of non-used
  117. ;; instructions. Only the non-common cases cause the outlined code to run..
  118. system_call:
  119. ;; stack-frame similar to the irq heads, which is reversed in ret_from_sys_call
  120. move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
  121. push $srp
  122. push $dccr
  123. push $mof
  124. subq 14*4, $sp ; make room for r0-r13
  125. movem $r13, [$sp] ; push r0-r13
  126. push $r10 ; push orig_r10
  127. clear.d [$sp=$sp-4] ; frametype == 0, normal stackframe
  128. movs.w -ENOSYS, $r0
  129. move.d $r0, [$sp+PT_r10] ; put the default return value in r10 in the frame
  130. ;; check if this process is syscall-traced
  131. movs.w -8192, $r0 ; THREAD_SIZE == 8192
  132. and.d $sp, $r0
  133. move.d [$r0+TI_flags], $r0
  134. btstq TIF_SYSCALL_TRACE, $r0
  135. bmi _syscall_trace_entry
  136. nop
  137. _syscall_traced:
  138. ;; check for sanity in the requested syscall number
  139. cmpu.w NR_syscalls, $r9
  140. bcc ret_from_sys_call
  141. lslq 2, $r9 ; multiply by 4, in the delay slot
  142. ;; as a bonus 7th parameter, we give the location on the stack
  143. ;; of the register structure itself. some syscalls need this.
  144. push $sp
  145. ;; the parameter carrying registers r10, r11, r12 and 13 are intact.
  146. ;; the fifth and sixth parameters (if any) was in mof and srp
  147. ;; respectively, and we need to put them on the stack.
  148. push $srp
  149. push $mof
  150. jsr [$r9+sys_call_table] ; actually do the system call
  151. addq 3*4, $sp ; pop the mof, srp and regs parameters
  152. move.d $r10, [$sp+PT_r10] ; save the return value
  153. moveq 1, $r9 ; "parameter" to ret_from_sys_call to show it was a sys call
  154. ;; fall through into ret_from_sys_call to return
  155. ret_from_sys_call:
  156. ;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq
  157. ;; get the current task-struct pointer (see top for defs)
  158. movs.w -8192, $r0 ; THREAD_SIZE == 8192
  159. and.d $sp, $r0
  160. di ; make sure need_resched and sigpending don't change
  161. move.d [$r0+TI_flags],$r1
  162. and.d _TIF_ALLWORK_MASK, $r1
  163. bne _syscall_exit_work
  164. nop
  165. _Rexit:
  166. ;; this epilogue MUST match the prologues in multiple_interrupt, irq.h and ptregs.h
  167. pop $r10 ; frametype
  168. bne _RBFexit ; was not CRIS_FRAME_NORMAL, handle otherwise
  169. addq 4, $sp ; skip orig_r10, in delayslot
  170. movem [$sp+], $r13 ; registers r0-r13
  171. pop $mof ; multiply overflow register
  172. pop $dccr ; condition codes
  173. pop $srp ; subroutine return pointer
  174. ;; now we have a 4-word SBFS frame which we do not want to restore
  175. ;; using RBF since it was not stacked with SBFS. instead we would like to
  176. ;; just get the PC value to restart it with, and skip the rest of
  177. ;; the frame.
  178. ;; Also notice that it's important to use instructions here that
  179. ;; keep the interrupts disabled (since we've already popped DCCR)
  180. move [$sp=$sp+16], $p8; pop the SBFS frame from the sp
  181. jmpu [$sp-16] ; return through the irp field in the sbfs frame
  182. _RBFexit:
  183. movem [$sp+], $r13 ; registers r0-r13, in delay slot
  184. pop $mof ; multiply overflow register
  185. pop $dccr ; condition codes
  186. pop $srp ; subroutine return pointer
  187. rbf [$sp+] ; return by popping the CPU status
  188. ;; We get here after doing a syscall if extra work might need to be done
  189. ;; perform syscall exit tracing if needed
  190. _syscall_exit_work:
  191. ;; $r0 contains current at this point and irq's are disabled
  192. move.d [$r0+TI_flags], $r1
  193. btstq TIF_SYSCALL_TRACE, $r1
  194. bpl _work_pending
  195. nop
  196. ei
  197. move.d $r9, $r1 ; preserve r9
  198. jsr do_syscall_trace
  199. move.d $r1, $r9
  200. ba _resume_userspace
  201. nop
  202. _work_pending:
  203. move.d [$r0+TI_flags], $r1
  204. btstq TIF_NEED_RESCHED, $r1
  205. bpl _work_notifysig ; was neither trace nor sched, must be signal/notify
  206. nop
  207. _work_resched:
  208. move.d $r9, $r1 ; preserve r9
  209. jsr schedule
  210. move.d $r1, $r9
  211. di
  212. move.d [$r0+TI_flags], $r1
  213. and.d _TIF_WORK_MASK, $r1; ignore the syscall trace counter
  214. beq _Rexit
  215. nop
  216. btstq TIF_NEED_RESCHED, $r1
  217. bmi _work_resched ; current->work.need_resched
  218. nop
  219. _work_notifysig:
  220. ;; deal with pending signals and notify-resume requests
  221. move.d $r9, $r10 ; do_notify_resume syscall/irq param
  222. move.d $sp, $r11 ; the regs param
  223. move.d $r1, $r12 ; the thread_info_flags parameter
  224. jsr do_notify_resume
  225. ba _Rexit
  226. nop
  227. ;; We get here as a sidetrack when we've entered a syscall with the
  228. ;; trace-bit set. We need to call do_syscall_trace and then continue
  229. ;; with the call.
  230. _syscall_trace_entry:
  231. ;; PT_r10 in the frame contains -ENOSYS as required, at this point
  232. jsr do_syscall_trace
  233. ;; now re-enter the syscall code to do the syscall itself
  234. ;; we need to restore $r9 here to contain the wanted syscall, and
  235. ;; the other parameter-bearing registers
  236. move.d [$sp+PT_r9], $r9
  237. move.d [$sp+PT_orig_r10], $r10 ; PT_r10 is already filled with -ENOSYS.
  238. move.d [$sp+PT_r11], $r11
  239. move.d [$sp+PT_r12], $r12
  240. move.d [$sp+PT_r13], $r13
  241. move [$sp+PT_mof], $mof
  242. move [$sp+PT_srp], $srp
  243. ba _syscall_traced
  244. nop
  245. ;; resume performs the actual task-switching, by switching stack pointers
  246. ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct
  247. ;; returns old current in r10
  248. ;;
  249. ;; TODO: see the i386 version. The switch_to which calls resume in our version
  250. ;; could really be an inline asm of this.
  251. resume:
  252. push $srp ; we keep the old/new PC on the stack
  253. add.d $r12, $r10 ; r10 = current tasks tss
  254. move $dccr, [$r10+THREAD_dccr]; save irq enable state
  255. di
  256. move $usp, [$r10+ THREAD_usp] ; save user-mode stackpointer
  257. ;; See copy_thread for the reason why register R9 is saved.
  258. subq 10*4, $sp
  259. movem $r9, [$sp] ; save non-scratch registers and R9.
  260. move.d $sp, [$r10+THREAD_ksp] ; save the kernel stack pointer for the old task
  261. move.d $sp, $r10 ; return last running task in r10
  262. and.d -8192, $r10 ; get thread_info from stackpointer
  263. move.d [$r10+TI_task], $r10 ; get task
  264. add.d $r12, $r11 ; find the new tasks tss
  265. move.d [$r11+THREAD_ksp], $sp ; switch into the new stackframe by restoring kernel sp
  266. movem [$sp+], $r9 ; restore non-scratch registers and R9.
  267. move [$r11+THREAD_usp], $usp ; restore user-mode stackpointer
  268. move [$r11+THREAD_dccr], $dccr ; restore irq enable status
  269. jump [$sp+] ; restore PC
  270. ;; This is the MMU bus fault handler.
  271. ;; It needs to stack the CPU status and overall is different
  272. ;; from the other interrupt handlers.
  273. mmu_bus_fault:
  274. ;; For refills we try to do a quick page table lookup. If it is
  275. ;; a real fault we let the mm subsystem handle it.
  276. ;; the first longword in the sbfs frame was the interrupted PC
  277. ;; which fits nicely with the "IRP" slot in pt_regs normally used to
  278. ;; contain the return address. used by Oops to print kernel errors.
  279. sbfs [$sp=$sp-16] ; push the internal CPU status
  280. push $dccr
  281. di
  282. subq 2*4, $sp
  283. movem $r1, [$sp]
  284. move.d [R_MMU_CAUSE], $r1
  285. ;; ETRAX 100LX TR89 bugfix: if the second half of an unaligned
  286. ;; write causes a MMU-fault, it will not be restarted correctly.
  287. ;; This could happen if a write crosses a page-boundary and the
  288. ;; second page is not yet COW'ed or even loaded. The workaround
  289. ;; is to clear the unaligned bit in the CPU status record, so
  290. ;; that the CPU will rerun both the first and second halves of
  291. ;; the instruction. This will not have any sideeffects unless
  292. ;; the first half goes to any device or memory that can't be
  293. ;; written twice, and which is mapped through the MMU.
  294. ;;
  295. ;; We only need to do this for writes.
  296. btstq 8, $r1 ; Write access?
  297. bpl 1f
  298. nop
  299. move.d [$sp+16], $r0 ; Clear unaligned bit in csrinstr
  300. and.d ~(1<<5), $r0
  301. move.d $r0, [$sp+16]
  302. 1: btstq 12, $r1 ; Refill?
  303. bpl 2f
  304. lsrq 24, $r1 ; Get PGD index (bit 24-31)
  305. move.d [current_pgd], $r0 ; PGD for the current process
  306. move.d [$r0+$r1.d], $r0 ; Get PMD
  307. beq 2f
  308. nop
  309. and.w PAGE_MASK, $r0 ; Remove PMD flags
  310. move.d [R_MMU_CAUSE], $r1
  311. lsrq PAGE_SHIFT, $r1
  312. and.d 0x7ff, $r1 ; Get PTE index into PGD (bit 13-23)
  313. move.d [$r0+$r1.d], $r1 ; Get PTE
  314. beq 2f
  315. nop
  316. ;; Store in TLB
  317. move.d $r1, [R_TLB_LO]
  318. ;; Return
  319. movem [$sp+], $r1
  320. pop $dccr
  321. rbf [$sp+] ; return by popping the CPU status
  322. 2: ; PMD or PTE missing, let the mm subsystem fix it up.
  323. movem [$sp+], $r1
  324. pop $dccr
  325. ; Ok, not that easy, pass it on to the mm subsystem
  326. ; The MMU status record is now on the stack
  327. push $srp ; make a stackframe similar to pt_regs
  328. push $dccr
  329. push $mof
  330. di
  331. subq 14*4, $sp
  332. movem $r13, [$sp]
  333. push $r10 ; dummy orig_r10
  334. moveq 1, $r10
  335. push $r10 ; frametype == 1, BUSFAULT frame type
  336. move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault
  337. jsr handle_mmu_bus_fault ; in arch/cris/arch-v10/mm/fault.c
  338. ;; now we need to return through the normal path, we cannot just
  339. ;; do the RBFexit since we might have killed off the running
  340. ;; process due to a SEGV, scheduled due to a page blocking or
  341. ;; whatever.
  342. moveq 0, $r9 ; busfault is equivalent to an irq
  343. ba ret_from_intr
  344. nop
  345. ;; special handlers for breakpoint and NMI
  346. hwbreakpoint:
  347. push $dccr
  348. di
  349. push $r10
  350. push $r11
  351. move.d [hw_bp_trig_ptr],$r10
  352. move $brp,$r11
  353. move.d $r11,[$r10+]
  354. move.d $r10,[hw_bp_trig_ptr]
  355. 1: pop $r11
  356. pop $r10
  357. pop $dccr
  358. retb
  359. nop
  360. IRQ1_interrupt:
  361. ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
  362. move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
  363. push $srp
  364. push $dccr
  365. push $mof
  366. di
  367. subq 14*4, $sp
  368. movem $r13, [$sp]
  369. push $r10 ; push orig_r10
  370. clear.d [$sp=$sp-4] ; frametype == 0, normal frame
  371. ;; If there is a glitch on the NMI pin shorter than ~100ns
  372. ;; (i.e. non-active by the time we get here) then the nmi_pin bit
  373. ;; in R_IRQ_MASK0_RD will already be cleared. The watchdog_nmi bit
  374. ;; is cleared by us however (when feeding the watchdog), which is why
  375. ;; we use that bit to determine what brought us here.
  376. move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
  377. and.d (1<<30), $r1
  378. bne wdog
  379. move.d $sp, $r10
  380. jsr handle_nmi
  381. setf m ; Enable NMI again
  382. ba _Rexit ; Return the standard way
  383. nop
  384. wdog:
  385. #if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
  386. ;; Check if we're waiting for reset to happen, as signalled by
  387. ;; hard_reset_now setting cause_of_death to a magic value. If so, just
  388. ;; get stuck until reset happens.
  389. .comm cause_of_death, 4 ;; Don't declare this anywhere.
  390. move.d [cause_of_death], $r10
  391. cmp.d 0xbedead, $r10
  392. _killed_by_death:
  393. beq _killed_by_death
  394. nop
  395. ;; We'll see this in ksymoops dumps.
  396. Watchdog_bite:
  397. #ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
  398. ;; We just restart the watchdog here to be sure we dont get
  399. ;; hit while printing the watchdogmsg below
  400. ;; This restart is compatible with the rest of the C-code, so
  401. ;; the C-code can keep restarting the watchdog after this point.
  402. ;; The non-NICE_DOGGY code below though, disables the possibility
  403. ;; to restart since it changes the watchdog key, to avoid any
  404. ;; buggy loops etc. keeping the watchdog alive after this.
  405. jsr reset_watchdog
  406. #else
  407. ;; We need to extend the 3.3ms after the NMI at watchdog bite, so we have
  408. ;; time for an oops-dump over a 115k2 serial wire. Another 100ms should do.
  409. ;; Change the watchdog key to an arbitrary 3-bit value and restart the
  410. ;; watchdog.
  411. #define WD_INIT 2
  412. moveq IO_FIELD (R_WATCHDOG, key, WD_INIT), $r10
  413. move.d R_WATCHDOG, $r11
  414. move.d $r10, [$r11]
  415. moveq IO_FIELD (R_WATCHDOG, key, \
  416. IO_EXTRACT (R_WATCHDOG, key, \
  417. IO_MASK (R_WATCHDOG, key)) \
  418. ^ WD_INIT) \
  419. | IO_STATE (R_WATCHDOG, enable, start), $r10
  420. move.d $r10, [$r11]
  421. #endif
  422. ;; Note that we don't do "setf m" here (or after two necessary NOPs),
  423. ;; since *not* doing that saves us from re-entrancy checks. We don't want
  424. ;; to get here again due to possible subsequent NMIs; we want the watchdog
  425. ;; to reset us.
  426. move.d _watchdogmsg,$r10
  427. jsr printk
  428. move.d $sp, $r10
  429. jsr watchdog_bite_hook
  430. ;; This nop is here so we see the "Watchdog_bite" label in ksymoops dumps
  431. ;; rather than "spurious_interrupt".
  432. nop
  433. ;; At this point we drop down into spurious_interrupt, which will do a
  434. ;; hard reset.
  435. .section .rodata,"a"
  436. _watchdogmsg:
  437. .ascii "Oops: bitten by watchdog\n\0"
  438. .previous
  439. #endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */
  440. spurious_interrupt:
  441. di
  442. jump hard_reset_now
  443. ;; this handles the case when multiple interrupts arrive at the same time
  444. ;; we jump to the first set interrupt bit in a priority fashion
  445. ;; the hardware will call the unserved interrupts after the handler finishes
  446. multiple_interrupt:
  447. ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
  448. move $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
  449. push $srp
  450. push $dccr
  451. push $mof
  452. di
  453. subq 14*4, $sp
  454. movem $r13, [$sp]
  455. push $r10 ; push orig_r10
  456. clear.d [$sp=$sp-4] ; frametype == 0, normal frame
  457. move.d $sp, $r10
  458. jsr do_multiple_IRQ
  459. jump ret_from_intr
  460. do_sigtrap:
  461. ;;
  462. ;; SIGTRAP the process that executed the break instruction.
  463. ;; Make a frame that Rexit in entry.S expects.
  464. ;;
  465. move $brp, [$sp=$sp-16] ; Push BRP while faking a cpu status record.
  466. push $srp ; Push subroutine return pointer.
  467. push $dccr ; Push condition codes.
  468. push $mof ; Push multiply overflow reg.
  469. di ; Need to disable irq's at this point.
  470. subq 14*4, $sp ; Make room for r0-r13.
  471. movem $r13, [$sp] ; Push the r0-r13 registers.
  472. push $r10 ; Push orig_r10.
  473. clear.d [$sp=$sp-4] ; Frametype - this is a normal stackframe.
  474. movs.w -8192,$r9 ; THREAD_SIZE == 8192
  475. and.d $sp, $r9
  476. move.d [$r9+TI_task], $r10
  477. move.d [$r10+TASK_pid], $r10 ; current->pid as arg1.
  478. moveq 5, $r11 ; SIGTRAP as arg2.
  479. jsr sys_kill
  480. jump ret_from_intr ; Use the return routine for interrupts.
  481. gdb_handle_breakpoint:
  482. push $dccr
  483. push $r0
  484. #ifdef CONFIG_ETRAX_KGDB
  485. move $dccr, $r0 ; U-flag not affected by previous insns.
  486. btstq 8, $r0 ; Test the U-flag.
  487. bmi _ugdb_handle_breakpoint ; Go to user mode debugging.
  488. nop ; Empty delay slot (cannot pop r0 here).
  489. pop $r0 ; Restore r0.
  490. ba kgdb_handle_breakpoint ; Go to kernel debugging.
  491. pop $dccr ; Restore dccr in delay slot.
  492. #endif
  493. _ugdb_handle_breakpoint:
  494. move $brp, $r0 ; Use r0 temporarily for calculation.
  495. subq 2, $r0 ; Set to address of previous instruction.
  496. move $r0, $brp
  497. pop $r0 ; Restore r0.
  498. ba do_sigtrap ; SIGTRAP the offending process.
  499. pop $dccr ; Restore dccr in delay slot.
  500. .data
  501. hw_bp_trigs:
  502. .space 64*4
  503. hw_bp_trig_ptr:
  504. .dword hw_bp_trigs
  505. .section .rodata,"a"
  506. sys_call_table:
  507. .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
  508. .long sys_exit
  509. .long sys_fork
  510. .long sys_read
  511. .long sys_write
  512. .long sys_open /* 5 */
  513. .long sys_close
  514. .long sys_waitpid
  515. .long sys_creat
  516. .long sys_link
  517. .long sys_unlink /* 10 */
  518. .long sys_execve
  519. .long sys_chdir
  520. .long sys_time
  521. .long sys_mknod
  522. .long sys_chmod /* 15 */
  523. .long sys_lchown16
  524. .long sys_ni_syscall /* old break syscall holder */
  525. .long sys_stat
  526. .long sys_lseek
  527. .long sys_getpid /* 20 */
  528. .long sys_mount
  529. .long sys_oldumount
  530. .long sys_setuid16
  531. .long sys_getuid16
  532. .long sys_stime /* 25 */
  533. .long sys_ptrace
  534. .long sys_alarm
  535. .long sys_fstat
  536. .long sys_pause
  537. .long sys_utime /* 30 */
  538. .long sys_ni_syscall /* old stty syscall holder */
  539. .long sys_ni_syscall /* old gtty syscall holder */
  540. .long sys_access
  541. .long sys_nice
  542. .long sys_ni_syscall /* 35 old ftime syscall holder */
  543. .long sys_sync
  544. .long sys_kill
  545. .long sys_rename
  546. .long sys_mkdir
  547. .long sys_rmdir /* 40 */
  548. .long sys_dup
  549. .long sys_pipe
  550. .long sys_times
  551. .long sys_ni_syscall /* old prof syscall holder */
  552. .long sys_brk /* 45 */
  553. .long sys_setgid16
  554. .long sys_getgid16
  555. .long sys_signal
  556. .long sys_geteuid16
  557. .long sys_getegid16 /* 50 */
  558. .long sys_acct
  559. .long sys_umount /* recycled never used phys( */
  560. .long sys_ni_syscall /* old lock syscall holder */
  561. .long sys_ioctl
  562. .long sys_fcntl /* 55 */
  563. .long sys_ni_syscall /* old mpx syscall holder */
  564. .long sys_setpgid
  565. .long sys_ni_syscall /* old ulimit syscall holder */
  566. .long sys_ni_syscall /* old sys_olduname holder */
  567. .long sys_umask /* 60 */
  568. .long sys_chroot
  569. .long sys_ustat
  570. .long sys_dup2
  571. .long sys_getppid
  572. .long sys_getpgrp /* 65 */
  573. .long sys_setsid
  574. .long sys_sigaction
  575. .long sys_sgetmask
  576. .long sys_ssetmask
  577. .long sys_setreuid16 /* 70 */
  578. .long sys_setregid16
  579. .long sys_sigsuspend
  580. .long sys_sigpending
  581. .long sys_sethostname
  582. .long sys_setrlimit /* 75 */
  583. .long sys_old_getrlimit
  584. .long sys_getrusage
  585. .long sys_gettimeofday
  586. .long sys_settimeofday
  587. .long sys_getgroups16 /* 80 */
  588. .long sys_setgroups16
  589. .long sys_select /* was old_select in Linux/E100 */
  590. .long sys_symlink
  591. .long sys_lstat
  592. .long sys_readlink /* 85 */
  593. .long sys_uselib
  594. .long sys_swapon
  595. .long sys_reboot
  596. .long sys_old_readdir
  597. .long sys_old_mmap /* 90 */
  598. .long sys_munmap
  599. .long sys_truncate
  600. .long sys_ftruncate
  601. .long sys_fchmod
  602. .long sys_fchown16 /* 95 */
  603. .long sys_getpriority
  604. .long sys_setpriority
  605. .long sys_ni_syscall /* old profil syscall holder */
  606. .long sys_statfs
  607. .long sys_fstatfs /* 100 */
  608. .long sys_ni_syscall /* sys_ioperm in i386 */
  609. .long sys_socketcall
  610. .long sys_syslog
  611. .long sys_setitimer
  612. .long sys_getitimer /* 105 */
  613. .long sys_newstat
  614. .long sys_newlstat
  615. .long sys_newfstat
  616. .long sys_ni_syscall /* old sys_uname holder */
  617. .long sys_ni_syscall /* sys_iopl in i386 */
  618. .long sys_vhangup
  619. .long sys_ni_syscall /* old "idle" system call */
  620. .long sys_ni_syscall /* vm86old in i386 */
  621. .long sys_wait4
  622. .long sys_swapoff /* 115 */
  623. .long sys_sysinfo
  624. .long sys_ipc
  625. .long sys_fsync
  626. .long sys_sigreturn
  627. .long sys_clone /* 120 */
  628. .long sys_setdomainname
  629. .long sys_newuname
  630. .long sys_ni_syscall /* sys_modify_ldt */
  631. .long sys_adjtimex
  632. .long sys_mprotect /* 125 */
  633. .long sys_sigprocmask
  634. .long sys_ni_syscall /* old "create_module" */
  635. .long sys_init_module
  636. .long sys_delete_module
  637. .long sys_ni_syscall /* 130: old "get_kernel_syms" */
  638. .long sys_quotactl
  639. .long sys_getpgid
  640. .long sys_fchdir
  641. .long sys_bdflush
  642. .long sys_sysfs /* 135 */
  643. .long sys_personality
  644. .long sys_ni_syscall /* for afs_syscall */
  645. .long sys_setfsuid16
  646. .long sys_setfsgid16
  647. .long sys_llseek /* 140 */
  648. .long sys_getdents
  649. .long sys_select
  650. .long sys_flock
  651. .long sys_msync
  652. .long sys_readv /* 145 */
  653. .long sys_writev
  654. .long sys_getsid
  655. .long sys_fdatasync
  656. .long sys_sysctl
  657. .long sys_mlock /* 150 */
  658. .long sys_munlock
  659. .long sys_mlockall
  660. .long sys_munlockall
  661. .long sys_sched_setparam
  662. .long sys_sched_getparam /* 155 */
  663. .long sys_sched_setscheduler
  664. .long sys_sched_getscheduler
  665. .long sys_sched_yield
  666. .long sys_sched_get_priority_max
  667. .long sys_sched_get_priority_min /* 160 */
  668. .long sys_sched_rr_get_interval
  669. .long sys_nanosleep
  670. .long sys_mremap
  671. .long sys_setresuid16
  672. .long sys_getresuid16 /* 165 */
  673. .long sys_ni_syscall /* sys_vm86 */
  674. .long sys_ni_syscall /* Old sys_query_module */
  675. .long sys_poll
  676. .long sys_ni_syscall /* old nfsservctl */
  677. .long sys_setresgid16 /* 170 */
  678. .long sys_getresgid16
  679. .long sys_prctl
  680. .long sys_rt_sigreturn
  681. .long sys_rt_sigaction
  682. .long sys_rt_sigprocmask /* 175 */
  683. .long sys_rt_sigpending
  684. .long sys_rt_sigtimedwait
  685. .long sys_rt_sigqueueinfo
  686. .long sys_rt_sigsuspend
  687. .long sys_pread64 /* 180 */
  688. .long sys_pwrite64
  689. .long sys_chown16
  690. .long sys_getcwd
  691. .long sys_capget
  692. .long sys_capset /* 185 */
  693. .long sys_sigaltstack
  694. .long sys_sendfile
  695. .long sys_ni_syscall /* streams1 */
  696. .long sys_ni_syscall /* streams2 */
  697. .long sys_vfork /* 190 */
  698. .long sys_getrlimit
  699. .long sys_mmap2
  700. .long sys_truncate64
  701. .long sys_ftruncate64
  702. .long sys_stat64 /* 195 */
  703. .long sys_lstat64
  704. .long sys_fstat64
  705. .long sys_lchown
  706. .long sys_getuid
  707. .long sys_getgid /* 200 */
  708. .long sys_geteuid
  709. .long sys_getegid
  710. .long sys_setreuid
  711. .long sys_setregid
  712. .long sys_getgroups /* 205 */
  713. .long sys_setgroups
  714. .long sys_fchown
  715. .long sys_setresuid
  716. .long sys_getresuid
  717. .long sys_setresgid /* 210 */
  718. .long sys_getresgid
  719. .long sys_chown
  720. .long sys_setuid
  721. .long sys_setgid
  722. .long sys_setfsuid /* 215 */
  723. .long sys_setfsgid
  724. .long sys_pivot_root
  725. .long sys_mincore
  726. .long sys_madvise
  727. .long sys_getdents64 /* 220 */
  728. .long sys_fcntl64
  729. .long sys_ni_syscall /* reserved for TUX */
  730. .long sys_ni_syscall
  731. .long sys_gettid
  732. .long sys_readahead /* 225 */
  733. .long sys_setxattr
  734. .long sys_lsetxattr
  735. .long sys_fsetxattr
  736. .long sys_getxattr
  737. .long sys_lgetxattr /* 230 */
  738. .long sys_fgetxattr
  739. .long sys_listxattr
  740. .long sys_llistxattr
  741. .long sys_flistxattr
  742. .long sys_removexattr /* 235 */
  743. .long sys_lremovexattr
  744. .long sys_fremovexattr
  745. .long sys_tkill
  746. .long sys_sendfile64
  747. .long sys_futex /* 240 */
  748. .long sys_sched_setaffinity
  749. .long sys_sched_getaffinity
  750. .long sys_ni_syscall /* sys_set_thread_area */
  751. .long sys_ni_syscall /* sys_get_thread_area */
  752. .long sys_io_setup /* 245 */
  753. .long sys_io_destroy
  754. .long sys_io_getevents
  755. .long sys_io_submit
  756. .long sys_io_cancel
  757. .long sys_fadvise64 /* 250 */
  758. .long sys_ni_syscall
  759. .long sys_exit_group
  760. .long sys_lookup_dcookie
  761. .long sys_epoll_create
  762. .long sys_epoll_ctl /* 255 */
  763. .long sys_epoll_wait
  764. .long sys_remap_file_pages
  765. .long sys_set_tid_address
  766. .long sys_timer_create
  767. .long sys_timer_settime /* 260 */
  768. .long sys_timer_gettime
  769. .long sys_timer_getoverrun
  770. .long sys_timer_delete
  771. .long sys_clock_settime
  772. .long sys_clock_gettime /* 265 */
  773. .long sys_clock_getres
  774. .long sys_clock_nanosleep
  775. .long sys_statfs64
  776. .long sys_fstatfs64
  777. .long sys_tgkill /* 270 */
  778. .long sys_utimes
  779. .long sys_fadvise64_64
  780. .long sys_ni_syscall /* sys_vserver */
  781. .long sys_ni_syscall /* sys_mbind */
  782. .long sys_ni_syscall /* 275 sys_get_mempolicy */
  783. .long sys_ni_syscall /* sys_set_mempolicy */
  784. .long sys_mq_open
  785. .long sys_mq_unlink
  786. .long sys_mq_timedsend
  787. .long sys_mq_timedreceive /* 280 */
  788. .long sys_mq_notify
  789. .long sys_mq_getsetattr
  790. .long sys_ni_syscall /* reserved for kexec */
  791. .long sys_waitid
  792. .long sys_ni_syscall /* 285 */ /* available */
  793. .long sys_add_key
  794. .long sys_request_key
  795. .long sys_keyctl
  796. .long sys_ioprio_set
  797. .long sys_ioprio_get /* 290 */
  798. .long sys_inotify_init
  799. .long sys_inotify_add_watch
  800. .long sys_inotify_rm_watch
  801. .long sys_migrate_pages
  802. .long sys_openat /* 295 */
  803. .long sys_mkdirat
  804. .long sys_mknodat
  805. .long sys_fchownat
  806. .long sys_futimesat
  807. .long sys_fstatat64 /* 300 */
  808. .long sys_unlinkat
  809. .long sys_renameat
  810. .long sys_linkat
  811. .long sys_symlinkat
  812. .long sys_readlinkat /* 305 */
  813. .long sys_fchmodat
  814. .long sys_faccessat
  815. .long sys_pselect6
  816. .long sys_ppoll
  817. .long sys_unshare /* 310 */
  818. .long sys_set_robust_list
  819. .long sys_get_robust_list
  820. .long sys_splice
  821. .long sys_sync_file_range
  822. .long sys_tee /* 315 */
  823. .long sys_vmsplice
  824. .long sys_move_pages
  825. .long sys_getcpu
  826. .long sys_epoll_pwait
  827. .long sys_utimensat /* 320 */
  828. .long sys_signalfd
  829. .long sys_timerfd_create
  830. .long sys_eventfd
  831. .long sys_fallocate
  832. .long sys_timerfd_settime /* 325 */
  833. .long sys_timerfd_gettime
  834. .long sys_signalfd4
  835. .long sys_eventfd2
  836. .long sys_epoll_create1
  837. .long sys_dup3 /* 330 */
  838. .long sys_pipe2
  839. .long sys_inotify_init1
  840. .long sys_preadv
  841. .long sys_pwritev
  842. .long sys_setns /* 335 */
  843. /*
  844. * NOTE!! This doesn't have to be exact - we just have
  845. * to make sure we have _enough_ of the "sys_ni_syscall"
  846. * entries. Don't panic if you notice that this hasn't
  847. * been shrunk every time we add a new system call.
  848. */
  849. .rept NR_syscalls-(.-sys_call_table)/4
  850. .long sys_ni_syscall
  851. .endr