bsd-_setjmp.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
  2. /* This file is released under the LGPL, any version you like */
  3. #define _ASM
  4. #define _SETJMP_H
  5. #include <bits/setjmp.h>
  6. .text
  7. .global _setjmp;
  8. .type _setjmp,STT_FUNC;
  9. .align 4;
  10. _setjmp:
  11. [--SP] = P0; // Save P0
  12. P0 = R0;
  13. R0 = [SP++];
  14. [P0 + 0x00] = R0; // Save saved P0
  15. [P0 + 0x04] = P1;
  16. [P0 + 0x08] = P2;
  17. [P0 + 0x0C] = P3;
  18. [P0 + 0x10] = P4;
  19. [P0 + 0x14] = P5;
  20. [P0 + 0x18] = FP; // Frame Pointer
  21. [P0 + 0x1C] = SP; // Stack Pointer
  22. [P0 + 0x20] = P0; // Data Registers
  23. [P0 + 0x24] = R1;
  24. [P0 + 0x28] = R2;
  25. [P0 + 0x2C] = R3;
  26. [P0 + 0x30] = R4;
  27. [P0 + 0x34] = R5;
  28. [P0 + 0x38] = R6;
  29. [P0 + 0x3C] = R7;
  30. R0 = ASTAT;
  31. [P0 + 0x40] = R0;
  32. R0 = LC0; // Loop Counters
  33. [P0 + 0x44] = R0;
  34. R0 = LC1;
  35. [P0 + 0x48] = R0;
  36. R0 = A0.W; // Accumulators
  37. [P0 + 0x4C] = R0;
  38. R0 = A0.X;
  39. [P0 + 0x50] = R0;
  40. R0 = A1.W;
  41. [P0 + 0x54] = R0;
  42. R0 = A1.X;
  43. [P0 + 0x58] = R0;
  44. R0 = I0; // Index Registers
  45. [P0 + 0x5C] = R0;
  46. R0 = I1;
  47. [P0 + 0x60] = R0;
  48. R0 = I2;
  49. [P0 + 0x64] = R0;
  50. R0 = I3;
  51. [P0 + 0x68] = R0;
  52. R0 = M0; // Modifier Registers
  53. [P0 + 0x6C] = R0;
  54. R0 = M1;
  55. [P0 + 0x70] = R0;
  56. R0 = M2;
  57. [P0 + 0x74] = R0;
  58. R0 = M3;
  59. [P0 + 0x78] = R0;
  60. R0 = L0; // Length Registers
  61. [P0 + 0x7c] = R0;
  62. R0 = L1;
  63. [P0 + 0x80] = R0;
  64. R0 = L2;
  65. [P0 + 0x84] = R0;
  66. R0 = L3;
  67. [P0 + 0x88] = R0;
  68. R0 = B0; // Base Registers
  69. [P0 + 0x8C] = R0;
  70. R0 = B1;
  71. [P0 + 0x90] = R0;
  72. R0 = B2;
  73. [P0 + 0x94] = R0;
  74. R0 = B3;
  75. [P0 + 0x98] = R0;
  76. R0 = RETS;
  77. [P0 + 0x9C] = R0;
  78. R0 = [P0 + 0x20];
  79. R0 = 0;
  80. RTS;
  81. .size _setjmp,.-_setjmp