tbiroot.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * tbiroot.S
  3. *
  4. * Copyright (C) 2001, 2002, 2012 Imagination Technologies.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it under
  7. * the terms of the GNU General Public License version 2 as published by the
  8. * Free Software Foundation.
  9. *
  10. * Module that creates and via ___TBI function returns a TBI Root Block for
  11. * interrupt and background processing on the current thread.
  12. */
  13. .file "tbiroot.S"
  14. #include <asm/metag_regs.h>
  15. /*
  16. * Get data structures and defines from the TBI C header
  17. */
  18. #include <asm/tbx.h>
  19. /* If signals need to be exchanged we must create a TBI Root Block */
  20. .data
  21. .balign 8
  22. .global ___pTBIs
  23. .type ___pTBIs,object
  24. ___pTBIs:
  25. .long 0 /* Bgnd+Int root block ptrs */
  26. .long 0
  27. .size ___pTBIs,.-___pTBIs
  28. /*
  29. * Return ___pTBIs value specific to execution level with promotion/demotion
  30. *
  31. * Register Usage: D1Ar1 is Id, D0Re0 is the primary result
  32. * D1Re0 is secondary result (___pTBIs for other exec level)
  33. */
  34. .text
  35. .balign 4
  36. .global ___TBI
  37. .type ___TBI,function
  38. ___TBI:
  39. TSTT D1Ar1,#HI(TBID_ISTAT_BIT) /* Bgnd or Int level? */
  40. MOVT A1LbP,#HI(___pTBIs)
  41. ADD A1LbP,A1LbP,#LO(___pTBIs)
  42. GETL D0Re0,D1Re0,[A1LbP] /* Base of root block table */
  43. SWAPNZ D0Re0,D1Re0 /* Swap if asked */
  44. MOV PC,D1RtP
  45. .size ___TBI,.-___TBI
  46. /*
  47. * Return identifier of the current thread in TBI segment or signal format with
  48. * secondary mask to indicate privilege and interrupt level of thread
  49. */
  50. .text
  51. .balign 4
  52. .global ___TBIThrdPrivId
  53. .type ___TBIThrdPrivId,function
  54. ___TBIThrdPrivId:
  55. .global ___TBIThreadId
  56. .type ___TBIThreadId,function
  57. ___TBIThreadId:
  58. #ifndef METAC_0_1
  59. MOV D1Re0,TXSTATUS /* Are we privileged or int? */
  60. MOV D0Re0,TXENABLE /* Which thread are we? */
  61. /* Disable privilege adaption for now */
  62. ANDT D1Re0,D1Re0,#HI(TXSTATUS_ISTAT_BIT) /* +TXSTATUS_PSTAT_BIT) */
  63. LSL D1Re0,D1Re0,#TBID_ISTAT_S-TXSTATUS_ISTAT_S
  64. AND D0Re0,D0Re0,#TXENABLE_THREAD_BITS
  65. LSL D0Re0,D0Re0,#TBID_THREAD_S-TXENABLE_THREAD_S
  66. #else
  67. /* Thread 0 only */
  68. XOR D0Re0,D0Re0,D0Re0
  69. XOR D1Re0,D1Re0,D1Re0
  70. #endif
  71. MOV PC,D1RtP /* Return */
  72. .size ___TBIThrdPrivId,.-___TBIThrdPrivId
  73. .size ___TBIThreadId,.-___TBIThreadId
  74. /*
  75. * End of tbiroot.S
  76. */