6.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * amd64 definition
  3. */
  4. #include <u.h>
  5. #include <libc.h>
  6. #include <bio.h>
  7. #include "/amd64/include/ureg.h"
  8. #include <mach.h>
  9. #define REGOFF(x) offsetof(struct Ureg, x)
  10. #define REGSIZE sizeof(struct Ureg)
  11. #define FP_CTLS(x) (REGSIZE+2*(x))
  12. #define FP_CTL(x) (REGSIZE+4*(x))
  13. #define FP_REG(x) (FP_CTL(8)+16*(x))
  14. #define XM_REG(x) (FP_CTL(8)+8*16+16*(x))
  15. #define FPREGSIZE 512 /* TO DO? currently only 0x1A0 used */
  16. Reglist amd64reglist[] = {
  17. {"AX", REGOFF(ax), RINT, 'Y'},
  18. {"BX", REGOFF(bx), RINT, 'Y'},
  19. {"CX", REGOFF(cx), RINT, 'Y'},
  20. {"DX", REGOFF(dx), RINT, 'Y'},
  21. {"SI", REGOFF(si), RINT, 'Y'},
  22. {"DI", REGOFF(di), RINT, 'Y'},
  23. {"BP", REGOFF(bp), RINT, 'Y'},
  24. {"R8", REGOFF(r8), RINT, 'Y'},
  25. {"R9", REGOFF(r9), RINT, 'Y'},
  26. {"R10", REGOFF(r10), RINT, 'Y'},
  27. {"R11", REGOFF(r11), RINT, 'Y'},
  28. {"R12", REGOFF(r12), RINT, 'Y'},
  29. {"R13", REGOFF(r13), RINT, 'Y'},
  30. {"R14", REGOFF(r14), RINT, 'Y'},
  31. {"R15", REGOFF(r15), RINT, 'Y'},
  32. {"DS", REGOFF(ds), RINT, 'x'},
  33. {"ES", REGOFF(es), RINT, 'x'},
  34. {"FS", REGOFF(fs), RINT, 'x'},
  35. {"GS", REGOFF(gs), RINT, 'x'},
  36. {"TYPE", REGOFF(type), RINT, 'Y'},
  37. {"TRAP", REGOFF(type), RINT, 'Y'}, /* alias for acid */
  38. {"ERROR", REGOFF(error), RINT, 'Y'},
  39. {"IP", REGOFF(ip), RINT, 'Y'},
  40. {"PC", REGOFF(ip), RINT, 'Y'}, /* alias for acid */
  41. {"CS", REGOFF(cs), RINT, 'Y'},
  42. {"FLAGS", REGOFF(flags), RINT, 'Y'},
  43. {"SP", REGOFF(sp), RINT, 'Y'},
  44. {"SS", REGOFF(ss), RINT, 'Y'},
  45. {"FCW", FP_CTLS(0), RFLT, 'x'},
  46. {"FSW", FP_CTLS(1), RFLT, 'x'},
  47. {"FTW", FP_CTLS(2), RFLT, 'b'},
  48. {"FOP", FP_CTLS(3), RFLT, 'x'},
  49. {"RIP", FP_CTL(2), RFLT, 'Y'},
  50. {"RDP", FP_CTL(4), RFLT, 'Y'},
  51. {"MXCSR", FP_CTL(6), RFLT, 'X'},
  52. {"MXCSRMASK", FP_CTL(7), RFLT, 'X'},
  53. {"M0", FP_REG(0), RFLT, 'F'}, /* assumes double */
  54. {"M1", FP_REG(1), RFLT, 'F'},
  55. {"M2", FP_REG(2), RFLT, 'F'},
  56. {"M3", FP_REG(3), RFLT, 'F'},
  57. {"M4", FP_REG(4), RFLT, 'F'},
  58. {"M5", FP_REG(5), RFLT, 'F'},
  59. {"M6", FP_REG(6), RFLT, 'F'},
  60. {"M7", FP_REG(7), RFLT, 'F'},
  61. {"X0", XM_REG(0), RFLT, 'F'}, /* assumes double */
  62. {"X1", XM_REG(1), RFLT, 'F'},
  63. {"X2", XM_REG(2), RFLT, 'F'},
  64. {"X3", XM_REG(3), RFLT, 'F'},
  65. {"X4", XM_REG(4), RFLT, 'F'},
  66. {"X5", XM_REG(5), RFLT, 'F'},
  67. {"X6", XM_REG(6), RFLT, 'F'},
  68. {"X7", XM_REG(7), RFLT, 'F'},
  69. {"X8", XM_REG(8), RFLT, 'F'},
  70. {"X9", XM_REG(9), RFLT, 'F'},
  71. {"X10", XM_REG(10), RFLT, 'F'},
  72. {"X11", XM_REG(11), RFLT, 'F'},
  73. {"X12", XM_REG(12), RFLT, 'F'},
  74. {"X13", XM_REG(13), RFLT, 'F'},
  75. {"X14", XM_REG(14), RFLT, 'F'},
  76. {"X15", XM_REG(15), RFLT, 'F'},
  77. {"X16", XM_REG(16), RFLT, 'F'},
  78. /*
  79. {"F0", FP_REG(7), RFLT, '3'},
  80. {"F1", FP_REG(6), RFLT, '3'},
  81. {"F2", FP_REG(5), RFLT, '3'},
  82. {"F3", FP_REG(4), RFLT, '3'},
  83. {"F4", FP_REG(3), RFLT, '3'},
  84. {"F5", FP_REG(2), RFLT, '3'},
  85. {"F6", FP_REG(1), RFLT, '3'},
  86. {"F7", FP_REG(0), RFLT, '3'},
  87. */
  88. { 0 }
  89. };
  90. Mach mamd64=
  91. {
  92. "amd64",
  93. MAMD64, /* machine type */
  94. amd64reglist, /* register list */
  95. REGSIZE, /* size of registers in bytes */
  96. FPREGSIZE, /* size of fp registers in bytes */
  97. "PC", /* name of PC */
  98. "SP", /* name of SP */
  99. 0, /* link register */
  100. "setSB", /* static base register name (bogus anyways) */
  101. 0, /* static base register value */
  102. 0x1000, /* page size */
  103. 0xFFFFFFFF80110000ULL, /* kernel base */
  104. 0xFFFF800000000000ULL, /* kernel text mask */
  105. 0x00007FFFFFFFF000ULL, /* user stack top */
  106. 1, /* quantization of pc */
  107. 8, /* szaddr */
  108. 4, /* szreg */
  109. 4, /* szfloat */
  110. 8, /* szdouble */
  111. };