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. .globl _setjmp;
  7. .align 4;
  8. _setjmp:
  9. [--SP] = P0; // Save P0
  10. P0 = R0;
  11. R0 = [SP++];
  12. [P0 + 0x00] = R0; // Save saved P0
  13. [P0 + 0x04] = P1;
  14. [P0 + 0x08] = P2;
  15. [P0 + 0x0C] = P3;
  16. [P0 + 0x10] = P4;
  17. [P0 + 0x14] = P5;
  18. [P0 + 0x18] = FP; // Frame Pointer
  19. [P0 + 0x1C] = SP; // Stack Pointer
  20. [P0 + 0x20] = P0; // Data Registers
  21. [P0 + 0x24] = R1;
  22. [P0 + 0x28] = R2;
  23. [P0 + 0x2C] = R3;
  24. [P0 + 0x30] = R4;
  25. [P0 + 0x34] = R5;
  26. [P0 + 0x38] = R6;
  27. [P0 + 0x3C] = R7;
  28. R0 = ASTAT;
  29. [P0 + 0x40] = R0;
  30. R0 = LC0; // Loop Counters
  31. [P0 + 0x44] = R0;
  32. R0 = LC1;
  33. [P0 + 0x48] = R0;
  34. R0 = A0.W; // Accumulators
  35. [P0 + 0x4C] = R0;
  36. R0 = A0.X;
  37. [P0 + 0x50] = R0;
  38. R0 = A1.W;
  39. [P0 + 0x54] = R0;
  40. R0 = A1.X;
  41. [P0 + 0x58] = R0;
  42. R0 = I0; // Index Registers
  43. [P0 + 0x5C] = R0;
  44. R0 = I1;
  45. [P0 + 0x60] = R0;
  46. R0 = I2;
  47. [P0 + 0x64] = R0;
  48. R0 = I3;
  49. [P0 + 0x68] = R0;
  50. R0 = M0; // Modifier Registers
  51. [P0 + 0x6C] = R0;
  52. R0 = M1;
  53. [P0 + 0x70] = R0;
  54. R0 = M2;
  55. [P0 + 0x74] = R0;
  56. R0 = M3;
  57. [P0 + 0x78] = R0;
  58. R0 = L0; // Length Registers
  59. [P0 + 0x7c] = R0;
  60. R0 = L1;
  61. [P0 + 0x80] = R0;
  62. R0 = L2;
  63. [P0 + 0x84] = R0;
  64. R0 = L3;
  65. [P0 + 0x88] = R0;
  66. R0 = B0; // Base Registers
  67. [P0 + 0x8C] = R0;
  68. R0 = B1;
  69. [P0 + 0x90] = R0;
  70. R0 = B2;
  71. [P0 + 0x94] = R0;
  72. R0 = B3;
  73. [P0 + 0x98] = R0;
  74. R0 = RETS;
  75. [P0 + 0x9C] = R0;
  76. R0 = [P0 + 0x20];
  77. R0 = 0;
  78. RTS;
  79. _setjmp.end: