cpubase.inc 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. );
  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. { Register for addressing absolute data in a position independant way,
  77. such as in PIC code. The exact meaning is ABI specific. For
  78. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  79. }
  80. NR_PIC_OFFSET_REG = NR_EBX;
  81. { Results are returned in this register (both 32 and 64 bits }
  82. NR_FUNCTION_RETURN_REG = NR_RAX;
  83. RS_FUNCTION_RETURN_REG = RS_RAX;
  84. { The value returned from a function is available in this register }
  85. NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
  86. RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
  87. { WARNING: don't change to R_ST0!! See comments above implementation of }
  88. { a_loadfpu* methods in rgcpu (JM) }
  89. NR_FPU_RESULT_REG = NR_ST;
  90. NR_MM_RESULT_REG = NR_MM0;
  91. { Offset where the parent framepointer is pushed }
  92. PARENT_FRAMEPOINTER_OFFSET = 16;
  93. {*****************************************************************************
  94. GCC /ABI linking information
  95. *****************************************************************************}
  96. const
  97. { Registers which must be saved when calling a routine declared as
  98. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  99. saved should be the ones as defined in the target ABI and / or GCC.
  100. This value can be deduced from the CALLED_USED_REGISTERS array in the
  101. GCC source.
  102. }
  103. saved_standard_registers : array[0..4] of tsuperregister = (RS_EBX,RS_R12,RS_R13,RS_R14,RS_R15);
  104. { Required parameter alignment when calling a routine declared as
  105. stdcall and cdecl. The alignment value should be the one defined
  106. by GCC or the target ABI.
  107. The value of this constant is equal to the constant
  108. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  109. }
  110. std_param_align = 8;
  111. {
  112. $Log$
  113. Revision 1.12 2004-02-05 18:28:37 peter
  114. * x86_64 fixes for opsize
  115. Revision 1.11 2004/01/15 13:57:58 florian
  116. * renamed instruction tables
  117. Revision 1.10 2004/01/14 23:39:05 florian
  118. * another bunch of x86-64 fixes mainly calling convention and
  119. assembler reader related
  120. Revision 1.9 2003/12/22 19:00:17 florian
  121. * fixed some x86-64 issues
  122. Revision 1.8 2003/09/25 13:13:32 florian
  123. * more x86-64 fixes
  124. Revision 1.7 2003/09/24 17:12:02 florian
  125. * several fixes for new reg allocator
  126. Revision 1.6 2003/06/03 13:01:59 daniel
  127. * Register allocator finished
  128. Revision 1.5 2003/05/31 15:05:28 peter
  129. * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
  130. Revision 1.4 2003/05/30 23:57:08 peter
  131. * more sparc cleanup
  132. * accumulator removed, splitted in function_return_reg (called) and
  133. function_result_reg (caller)
  134. Revision 1.3 2003/04/30 15:45:35 florian
  135. * merged more x86-64/i386 code
  136. Revision 1.2 2002/04/25 16:12:09 florian
  137. * fixed more problems with cpubase and x86-64
  138. Revision 1.1 2003/04/25 11:12:09 florian
  139. * merged i386/cpubase and x86_64/cpubase to x86/cpubase;
  140. different stuff went to cpubase.inc
  141. }