cpubase.inc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. firstsaveintreg = RS_EAX;
  56. lastsaveintreg = RS_EDX;
  57. firstsavefpureg = R_NO;
  58. lastsavefpureg = R_NO;
  59. firstsavemmreg = R_MM0;
  60. lastsavemmreg = R_MM7;
  61. {*****************************************************************************
  62. GDB Information
  63. *****************************************************************************}
  64. {# Register indexes for stabs information, when some
  65. parameters or variables are stored in registers.
  66. Taken from i386.c (dbx_register_map) and i386.h
  67. (FIXED_REGISTERS) from GCC 3.x source code
  68. }
  69. stab_regindex : array[firstreg..lastreg] of shortint =
  70. (-1,
  71. 0,1,2,3,4,5,6,7,
  72. 0,1,2,3,4,5,6,7,
  73. 0,1,2,3,0,1,2,3,
  74. -1,-1,-1,-1,-1,-1,
  75. 12,12,13,14,15,16,17,18,19,
  76. -1,-1,-1,-1,-1,-1,
  77. -1,-1,-1,-1,
  78. -1,-1,-1,-1,-1,
  79. 29,30,31,32,33,34,35,36,
  80. 21,22,23,24,25,26,27,28
  81. );
  82. {*****************************************************************************
  83. Default generic sizes
  84. *****************************************************************************}
  85. {# Defines the default address size for a processor, }
  86. OS_ADDR = OS_32;
  87. {# the natural int size for a processor, }
  88. OS_INT = OS_32;
  89. {# the maximum float size for a processor, }
  90. OS_FLOAT = OS_F80;
  91. {# the size of a vector register for a processor }
  92. OS_VECTOR = OS_M64;
  93. {*****************************************************************************
  94. Generic Register names
  95. *****************************************************************************}
  96. {# Stack pointer register }
  97. stack_pointer_reg = R_ESP;
  98. NR_STACK_POINTER_REG = NR_ESP;
  99. {# Frame pointer register }
  100. frame_pointer_reg = R_EBP;
  101. NR_FRAME_POINTER_REG = NR_EBP;
  102. {# Register for addressing absolute data in a position independant way,
  103. such as in PIC code. The exact meaning is ABI specific. For
  104. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  105. }
  106. pic_offset_reg = R_EBX;
  107. {# Results are returned in this register (32-bit values) }
  108. accumulator = R_EAX;
  109. RS_ACCUMULATOR = RS_EAX;
  110. NR_ACCUMULATOR = NR_EAX;
  111. { The return_result_reg is used inside the called function to store its return
  112. value when that is a scalar value otherwise a pointer to the address of the
  113. result is placed inside it}
  114. return_result_reg = accumulator;
  115. RS_RETURN_RESULT_REG = RS_ACCUMULATOR;
  116. NR_RETURN_RESULT_REG = NR_ACCUMULATOR;
  117. {the function_result_reg contains the function result after a call to a scalar
  118. function othewise it contains a pointer to the returned result}
  119. function_result_reg = accumulator;
  120. {# Hi-Results are returned in this register (64-bit value high register) }
  121. accumulatorhigh = R_EDX;
  122. RS_ACCUMULATORHIGH = RS_EDX;
  123. NR_ACCUMULATORHIGH = NR_EDX;
  124. { WARNING: don't change to R_ST0!! See comments above implementation of }
  125. { a_loadfpu* methods in rgcpu (JM) }
  126. fpu_result_reg = R_ST;
  127. mmresultreg = R_MM0;
  128. {*****************************************************************************
  129. GCC /ABI linking information
  130. *****************************************************************************}
  131. const
  132. {# Registers which must be saved when calling a routine declared as
  133. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  134. saved should be the ones as defined in the target ABI and / or GCC.
  135. This value can be deduced from the CALLED_USED_REGISTERS array in the
  136. GCC source.
  137. }
  138. std_saved_registers = [R_ESI,R_EDI,R_EBX];
  139. {# Required parameter alignment when calling a routine declared as
  140. stdcall and cdecl. The alignment value should be the one defined
  141. by GCC or the target ABI.
  142. The value of this constant is equal to the constant
  143. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  144. }
  145. std_param_align = 4;
  146. {
  147. $Log$
  148. Revision 1.1 2003-04-25 11:12:09 florian
  149. * merged i386/cpubase and x86_64/cpubase to x86/cpubase;
  150. different stuff went to cpubase.inc
  151. }