__longjmp.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. .globl ___longjmp;
  17. .align 4;
  18. ___longjmp:
  19. P0 = R0;
  20. R0 = [P0 + 0x00];
  21. [--SP] = R0; // Put P0 on the stack
  22. P1 = [P0 + 0x04];
  23. P2 = [P0 + 0x08];
  24. P3 = [P0 + 0x0C];
  25. P4 = [P0 + 0x10];
  26. P5 = [P0 + 0x14];
  27. FP = [P0 + 0x18];
  28. R0 = [SP++]; // Grab P0 from old stack
  29. SP = [P0 + 0x1C]; // Update Stack Pointer
  30. [--SP] = R0; // Put P0 on new stack
  31. [--SP] = R1; // Put VAL arg on new stack
  32. R0 = [P0 + 0x20]; // Data Registers
  33. R1 = [P0 + 0x24];
  34. R2 = [P0 + 0x28];
  35. R3 = [P0 + 0x2C];
  36. R4 = [P0 + 0x30];
  37. R5 = [P0 + 0x34];
  38. R6 = [P0 + 0x38];
  39. R7 = [P0 + 0x3C];
  40. R0 = [P0 + 0x40];
  41. ASTAT = R0;
  42. R0 = [P0 + 0x44]; // Loop Counters
  43. LC0 = R0;
  44. R0 = [P0 + 0x48];
  45. LC1 = R0;
  46. R0 = [P0 + 0x4C]; // Accumulators
  47. A0.W = R0;
  48. R0 = [P0 + 0x50];
  49. A0.X = R0;
  50. R0 = [P0 + 0x54];
  51. A1.W = R0;
  52. R0 = [P0 + 0x58];
  53. A1.X = R0;
  54. R0 = [P0 + 0x5C]; // Index Registers
  55. I0 = R0;
  56. R0 = [P0 + 0x60];
  57. I1 = R0;
  58. R0 = [P0 + 0x64];
  59. I2 = R0;
  60. R0 = [P0 + 0x68];
  61. I3 = R0;
  62. R0 = [P0 + 0x6C]; // Modifier Registers
  63. M0 = R0;
  64. R0 = [P0 + 0x70];
  65. M1 = R0;
  66. R0 = [P0 + 0x74];
  67. M2 = R0;
  68. R0 = [P0 + 0x78];
  69. M3 = R0;
  70. R0 = [P0 + 0x7C]; // Length Registers
  71. L0 = R0;
  72. R0 = [P0 + 0x80];
  73. L1 = R0;
  74. R0 = [P0 + 0x84];
  75. L2 = R0;
  76. R0 = [P0 + 0x88];
  77. L3 = R0;
  78. R0 = [P0 + 0x8C]; // Base Registers
  79. B0 = R0;
  80. R0 = [P0 + 0x90];
  81. B1 = R0;
  82. R0 = [P0 + 0x94];
  83. B2 = R0;
  84. R0 = [P0 + 0x98];
  85. B3 = R0;
  86. R0 = [P0 + 0x9C]; // Return Address (PC)
  87. RETS = R0;
  88. R0 = [SP++];
  89. P0 = [SP++];
  90. CC = R0 == 0;
  91. IF !CC JUMP finished;
  92. R0 = 1;
  93. finished:
  94. RTS;
  95. ___longjmp.end: