cpubase.inc 6.5 KB

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