__longjmp.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * longjmp for the Blackfin project
  3. *
  4. * Copyright (C) 2004,
  5. * Based on code from Analog Devices.
  6. *
  7. * This file is subject to the terms and conditions of the GNU Lesser
  8. * General Public License. See the file COPYING.LIB in the main
  9. * directory of this archive for more details.
  10. *
  11. */
  12. #include <features.h>
  13. #define _SETJMP_H
  14. #define _ASM
  15. #include <bits/setjmp.h>
  16. .text
  17. .global ___longjmp;
  18. .type ___longjmp,STT_FUNC;
  19. .align 4;
  20. ___longjmp:
  21. P0 = R0;
  22. R0 = [P0 + 0x00];
  23. [--SP] = R0; // Put P0 on the stack
  24. P1 = [P0 + 0x04];
  25. P2 = [P0 + 0x08];
  26. P3 = [P0 + 0x0C];
  27. P4 = [P0 + 0x10];
  28. P5 = [P0 + 0x14];
  29. FP = [P0 + 0x18];
  30. R0 = [SP++]; // Grab P0 from old stack
  31. SP = [P0 + 0x1C]; // Update Stack Pointer
  32. [--SP] = R0; // Put P0 on new stack
  33. [--SP] = R1; // Put VAL arg on new stack
  34. R0 = [P0 + 0x20]; // Data Registers
  35. R1 = [P0 + 0x24];
  36. R2 = [P0 + 0x28];
  37. R3 = [P0 + 0x2C];
  38. R4 = [P0 + 0x30];
  39. R5 = [P0 + 0x34];
  40. R6 = [P0 + 0x38];
  41. R7 = [P0 + 0x3C];
  42. R0 = [P0 + 0x40];
  43. ASTAT = R0;
  44. R0 = [P0 + 0x44]; // Loop Counters
  45. LC0 = R0;
  46. R0 = [P0 + 0x48];
  47. LC1 = R0;
  48. R0 = [P0 + 0x4C]; // Accumulators
  49. A0.W = R0;
  50. R0 = [P0 + 0x50];
  51. A0.X = R0;
  52. R0 = [P0 + 0x54];
  53. A1.W = R0;
  54. R0 = [P0 + 0x58];
  55. A1.X = R0;
  56. R0 = [P0 + 0x5C]; // Index Registers
  57. I0 = R0;
  58. R0 = [P0 + 0x60];
  59. I1 = R0;
  60. R0 = [P0 + 0x64];
  61. I2 = R0;
  62. R0 = [P0 + 0x68];
  63. I3 = R0;
  64. R0 = [P0 + 0x6C]; // Modifier Registers
  65. M0 = R0;
  66. R0 = [P0 + 0x70];
  67. M1 = R0;
  68. R0 = [P0 + 0x74];
  69. M2 = R0;
  70. R0 = [P0 + 0x78];
  71. M3 = R0;
  72. R0 = [P0 + 0x7C]; // Length Registers
  73. L0 = R0;
  74. R0 = [P0 + 0x80];
  75. L1 = R0;
  76. R0 = [P0 + 0x84];
  77. L2 = R0;
  78. R0 = [P0 + 0x88];
  79. L3 = R0;
  80. R0 = [P0 + 0x8C]; // Base Registers
  81. B0 = R0;
  82. R0 = [P0 + 0x90];
  83. B1 = R0;
  84. R0 = [P0 + 0x94];
  85. B2 = R0;
  86. R0 = [P0 + 0x98];
  87. B3 = R0;
  88. R0 = [P0 + 0x9C]; // Return Address (PC)
  89. RETS = R0;
  90. R0 = [SP++];
  91. P0 = [SP++];
  92. CC = R0 == 0;
  93. IF !CC JUMP finished;
  94. R0 = 1;
  95. finished:
  96. RTS;
  97. .size ___longjmp,.-___longjmp