cpubase.inc 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
  4. Contains the basic declarations for the i386 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 i386 architecture.
  19. }
  20. {*****************************************************************************
  21. Operand Sizes
  22. *****************************************************************************}
  23. type
  24. topsize = (S_NO,
  25. S_B,S_W,S_L,S_BW,S_BL,S_WL,
  26. S_IS,S_IL,S_IQ,
  27. S_FS,S_FL,S_FX,S_D,S_Q,S_FV,S_FXX,
  28. S_NEAR,S_FAR,S_SHORT
  29. );
  30. {*****************************************************************************
  31. Registers
  32. *****************************************************************************}
  33. const
  34. {# Standard opcode string table (for each tasmop enumeration). The
  35. opcode strings should conform to the names as defined by the
  36. processor manufacturer.
  37. }
  38. std_op2str:op2strtable={$i i386int.inc}
  39. {# Standard register table (for each tregister enumeration). The
  40. register strings should conform to the the names as defined
  41. by the processor manufacturer
  42. }
  43. std_reg2str : reg2strtable = ('',
  44. 'eax','ecx','edx','ebx','esp','ebp','esi','edi',
  45. 'ax','cx','dx','bx','sp','bp','si','di',
  46. 'al','cl','dl','bl','ah','ch','bh','dh',
  47. 'cs','ds','es','ss','fs','gs',
  48. 'st','st(0)','st(1)','st(2)','st(3)','st(4)','st(5)','st(6)','st(7)',
  49. 'dr0','dr1','dr2','dr3','dr6','dr7',
  50. 'cr0','cr2','cr3','cr4',
  51. 'tr3','tr4','tr5','tr6','tr7',
  52. 'mm0','mm1','mm2','mm3','mm4','mm5','mm6','mm7',
  53. 'xmm0','xmm1','xmm2','xmm3','xmm4','xmm5','xmm6','xmm7'
  54. );
  55. {*****************************************************************************
  56. Constants
  57. *****************************************************************************}
  58. firstsaveintreg = RS_EAX;
  59. lastsaveintreg = RS_EDX;
  60. firstsavefpureg = R_NO;
  61. lastsavefpureg = R_NO;
  62. firstsavemmreg = R_MM0;
  63. lastsavemmreg = R_MM7;
  64. general_registers = [R_EAX,R_EBX,R_ECX,R_EDX];
  65. general_superregisters = [RS_EAX,RS_EBX,RS_ECX,RS_EDX];
  66. {$ifdef newra}
  67. usableregsint = [first_imreg..last_imreg];
  68. {$else}
  69. usableregsint = [RS_EAX,RS_EBX,RS_ECX,RS_EDX];
  70. {$endif}
  71. c_countusableregsint = 4;
  72. maxaddrregs = 1;
  73. addrregs = [R_ESI];
  74. usableregsaddr = [RS_ESI];
  75. c_countusableregsaddr = 1;
  76. maxvarregs = 4;
  77. varregs : array[1..maxvarregs] of Toldregister =
  78. (R_EBX,R_EDX,R_ECX,R_EAX);
  79. maxfpuvarregs = 8;
  80. {# Registers which are defined as scratch and no need to save across
  81. routine calls or in assembler blocks.
  82. }
  83. {$ifndef newra}
  84. max_scratch_regs = 1;
  85. scratch_regs : array[1..max_scratch_regs] of Tsuperregister = (RS_EDI);
  86. {$endif}
  87. {*****************************************************************************
  88. GDB Information
  89. *****************************************************************************}
  90. {# Register indexes for stabs information, when some
  91. parameters or variables are stored in registers.
  92. Taken from i386.c (dbx_register_map) and i386.h
  93. (FIXED_REGISTERS) from GCC 3.x source code
  94. }
  95. stab_regindex : array[firstreg..lastreg] of shortint =
  96. (-1,
  97. 0,1,2,3,4,5,6,7,
  98. 0,1,2,3,4,5,6,7,
  99. 0,1,2,3,0,1,2,3,
  100. -1,-1,-1,-1,-1,-1,
  101. 12,12,13,14,15,16,17,18,19,
  102. -1,-1,-1,-1,-1,-1,
  103. -1,-1,-1,-1,
  104. -1,-1,-1,-1,-1,
  105. 29,30,31,32,33,34,35,36,
  106. 21,22,23,24,25,26,27,28
  107. );
  108. {*****************************************************************************
  109. Default generic sizes
  110. *****************************************************************************}
  111. {# Defines the default address size for a processor, }
  112. OS_ADDR = OS_32;
  113. {# the natural int size for a processor, }
  114. OS_INT = OS_32;
  115. {# the maximum float size for a processor, }
  116. OS_FLOAT = OS_F80;
  117. {# the size of a vector register for a processor }
  118. OS_VECTOR = OS_M64;
  119. {*****************************************************************************
  120. Generic Register names
  121. *****************************************************************************}
  122. {# Stack pointer register }
  123. stack_pointer_reg = R_ESP;
  124. NR_STACK_POINTER_REG = NR_ESP;
  125. {# Frame pointer register }
  126. frame_pointer_reg = R_EBP;
  127. NR_FRAME_POINTER_REG = NR_EBP;
  128. {# Register for addressing absolute data in a position independant way,
  129. such as in PIC code. The exact meaning is ABI specific. For
  130. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  131. }
  132. pic_offset_reg = R_EBX;
  133. {# Results are returned in this register (32-bit values) }
  134. accumulator = R_EAX;
  135. RS_ACCUMULATOR = RS_EAX;
  136. NR_ACCUMULATOR = NR_EAX;
  137. { The return_result_reg is used inside the called function to store its return
  138. value when that is a scalar value otherwise a pointer to the address of the
  139. result is placed inside it}
  140. return_result_reg = accumulator;
  141. RS_RETURN_RESULT_REG = RS_ACCUMULATOR;
  142. NR_RETURN_RESULT_REG = NR_ACCUMULATOR;
  143. {the function_result_reg contains the function result after a call to a scalar
  144. function othewise it contains a pointer to the returned result}
  145. function_result_reg = accumulator;
  146. {# Hi-Results are returned in this register (64-bit value high register) }
  147. accumulatorhigh = R_EDX;
  148. RS_ACCUMULATORHIGH = RS_EDX;
  149. NR_ACCUMULATORHIGH = NR_EDX;
  150. { WARNING: don't change to R_ST0!! See comments above implementation of }
  151. { a_loadfpu* methods in rgcpu (JM) }
  152. fpu_result_reg = R_ST;
  153. mmresultreg = R_MM0;
  154. {*****************************************************************************
  155. GCC /ABI linking information
  156. *****************************************************************************}
  157. const
  158. {# Registers which must be saved when calling a routine declared as
  159. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  160. saved should be the ones as defined in the target ABI and / or GCC.
  161. This value can be deduced from the CALLED_USED_REGISTERS array in the
  162. GCC source.
  163. }
  164. std_saved_registers = [R_ESI,R_EDI,R_EBX];
  165. {# Required parameter alignment when calling a routine declared as
  166. stdcall and cdecl. The alignment value should be the one defined
  167. by GCC or the target ABI.
  168. The value of this constant is equal to the constant
  169. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  170. }
  171. std_param_align = 4;
  172. {
  173. $Log$
  174. Revision 1.2 2002-04-25 16:12:09 florian
  175. * fixed more problems with cpubase and x86-64
  176. Revision 1.1 2003/04/25 11:12:09 florian
  177. * merged i386/cpubase and x86_64/cpubase to x86/cpubase;
  178. different stuff went to cpubase.inc
  179. }