entry.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #include <linux/linkage.h>
  15. #include <linux/unistd.h>
  16. #include <asm/irqflags.h>
  17. #include <asm/processor.h>
  18. #include <arch/abi.h>
  19. #include <arch/spr_def.h>
  20. #ifdef __tilegx__
  21. #define bnzt bnezt
  22. #endif
  23. STD_ENTRY(current_text_addr)
  24. { move r0, lr; jrp lr }
  25. STD_ENDPROC(current_text_addr)
  26. /*
  27. * We don't run this function directly, but instead copy it to a page
  28. * we map into every user process. See vdso_setup().
  29. *
  30. * Note that libc has a copy of this function that it uses to compare
  31. * against the PC when a stack backtrace ends, so if this code is
  32. * changed, the libc implementation(s) should also be updated.
  33. */
  34. .pushsection .data
  35. ENTRY(__rt_sigreturn)
  36. moveli TREG_SYSCALL_NR_NAME,__NR_rt_sigreturn
  37. swint1
  38. ENDPROC(__rt_sigreturn)
  39. ENTRY(__rt_sigreturn_end)
  40. .popsection
  41. STD_ENTRY(dump_stack)
  42. { move r2, lr; lnk r1 }
  43. { move r4, r52; addli r1, r1, dump_stack - . }
  44. { move r3, sp; j _dump_stack }
  45. jrp lr /* keep backtracer happy */
  46. STD_ENDPROC(dump_stack)
  47. STD_ENTRY(KBacktraceIterator_init_current)
  48. { move r2, lr; lnk r1 }
  49. { move r4, r52; addli r1, r1, KBacktraceIterator_init_current - . }
  50. { move r3, sp; j _KBacktraceIterator_init_current }
  51. jrp lr /* keep backtracer happy */
  52. STD_ENDPROC(KBacktraceIterator_init_current)
  53. /* Loop forever on a nap during SMP boot. */
  54. STD_ENTRY(smp_nap)
  55. nap
  56. nop /* avoid provoking the icache prefetch with a jump */
  57. j smp_nap /* we are not architecturally guaranteed not to exit nap */
  58. jrp lr /* clue in the backtracer */
  59. STD_ENDPROC(smp_nap)
  60. /*
  61. * Enable interrupts racelessly and then nap until interrupted.
  62. * Architecturally, we are guaranteed that enabling interrupts via
  63. * mtspr to INTERRUPT_CRITICAL_SECTION only interrupts at the next PC.
  64. * This function's _cpu_idle_nap address is special; see intvec.S.
  65. * When interrupted at _cpu_idle_nap, we bump the PC forward 8, and
  66. * as a result return to the function that called _cpu_idle().
  67. */
  68. STD_ENTRY(_cpu_idle)
  69. movei r1, 1
  70. IRQ_ENABLE_LOAD(r2, r3)
  71. mtspr INTERRUPT_CRITICAL_SECTION, r1
  72. IRQ_ENABLE_APPLY(r2, r3) /* unmask, but still with ICS set */
  73. mtspr INTERRUPT_CRITICAL_SECTION, zero
  74. .global _cpu_idle_nap
  75. _cpu_idle_nap:
  76. nap
  77. nop /* avoid provoking the icache prefetch with a jump */
  78. jrp lr
  79. STD_ENDPROC(_cpu_idle)