2
0

cpubase.inc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {
  2. Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
  3. Contains the basic declarations for the x86-64 architecture
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. { This include file contains the basic declarations for the x86-64 architecture.
  18. }
  19. {*****************************************************************************
  20. Operand Sizes
  21. *****************************************************************************}
  22. type
  23. topsize = (S_NO,
  24. S_B,S_W,S_L,S_Q,S_BW,S_BL,S_WL,S_BQ,S_WQ,S_LQ,
  25. S_IS,S_IL,S_IQ,
  26. S_FS,S_FL,S_FX,S_FV,S_FXX,
  27. S_MD,
  28. S_NEAR,S_FAR,S_SHORT,
  29. S_T
  30. );
  31. {*****************************************************************************
  32. Registers
  33. *****************************************************************************}
  34. const
  35. { Standard opcode string table (for each tasmop enumeration). The
  36. opcode strings should conform to the names as defined by the
  37. processor manufacturer.
  38. }
  39. std_op2str:op2strtable={$i x8664int.inc}
  40. {*****************************************************************************
  41. Constants
  42. *****************************************************************************}
  43. const
  44. c_countusableregsint = 4;
  45. {*****************************************************************************
  46. GDB Information
  47. *****************************************************************************}
  48. {# Register indexes for stabs information, when some
  49. parameters or variables are stored in registers.
  50. Taken from i386.c (dbx_register_map) and i386.h
  51. (FIXED_REGISTERS) from GCC 3.x source code
  52. }
  53. stab_regindex : array[tregisterindex] of shortint = (
  54. {$i r8664stab.inc}
  55. );
  56. {*****************************************************************************
  57. Default generic sizes
  58. *****************************************************************************}
  59. { Defines the default address size for a processor, }
  60. OS_ADDR = OS_64;
  61. { the natural int size for a processor, }
  62. OS_INT = OS_64;
  63. { the maximum float size for a processor, }
  64. OS_FLOAT = OS_F80;
  65. { the size of a vector register for a processor }
  66. OS_VECTOR = OS_M64;
  67. {*****************************************************************************
  68. Generic Register names
  69. *****************************************************************************}
  70. {# Stack pointer register }
  71. RS_STACK_POINTER_REG = RS_RSP;
  72. NR_STACK_POINTER_REG = NR_RSP;
  73. {# Frame pointer register }
  74. RS_FRAME_POINTER_REG = RS_RBP;
  75. NR_FRAME_POINTER_REG = NR_RBP;
  76. { Return address for DWARF }
  77. NR_RETURN_ADDRESS_REG = NR_EIP;
  78. { Register for addressing absolute data in a position independant way,
  79. such as in PIC code. The exact meaning is ABI specific. For
  80. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  81. }
  82. NR_PIC_OFFSET_REG = NR_RBX;
  83. { Results are returned in this register (both 32 and 64 bits }
  84. NR_FUNCTION_RETURN_REG = NR_RAX;
  85. RS_FUNCTION_RETURN_REG = RS_RAX;
  86. { The value returned from a function is available in this register }
  87. NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
  88. RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
  89. { WARNING: don't change to R_ST0!! See comments above implementation of }
  90. { a_loadfpu* methods in rgcpu (JM) }
  91. NR_FPU_RESULT_REG = NR_ST;
  92. NR_MM_RESULT_REG = NR_XMM0;
  93. { Offset where the parent framepointer is pushed }
  94. PARENT_FRAMEPOINTER_OFFSET = 16;
  95. {*****************************************************************************
  96. GCC /ABI linking information
  97. *****************************************************************************}
  98. const
  99. { Registers which must be saved when calling a routine declared as
  100. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  101. saved should be the ones as defined in the target ABI and / or GCC.
  102. This value can be deduced from the CALLED_USED_REGISTERS array in the
  103. GCC source.
  104. }
  105. saved_standard_registers : array[0..4] of tsuperregister = (RS_EBX,RS_R12,RS_R13,RS_R14,RS_R15);
  106. { Registers which must be saved when calling a routine declared as
  107. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  108. saved should be the ones as defined in the target ABI and / or GCC.
  109. This value can be deduced from the CALLED_USED_REGISTERS array in the
  110. GCC source.
  111. }
  112. saved_xmm_registers : array[0..4] of tsuperregister = (RS_EBX,RS_R12,RS_R13,RS_R14,RS_R15);
  113. { Required parameter alignment when calling a routine declared as
  114. stdcall and cdecl. The alignment value should be the one defined
  115. by GCC or the target ABI.
  116. The value of this constant is equal to the constant
  117. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  118. }
  119. std_param_align = 8;