Subversion Repositories Kolibri OS

Rev

Rev 5222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5222 Rev 6324
Line 1... Line 1...
1
/* tc-i386.c -- Assemble Intel syntax code for ix86/x86-64
1
/* tc-i386.c -- Assemble Intel syntax code for ix86/x86-64
2
   Copyright 2009, 2010
-
 
3
   Free Software Foundation, Inc.
2
   Copyright (C) 2009-2015 Free Software Foundation, Inc.
Line 4... Line 3...
4
 
3
 
Line 5... Line 4...
5
   This file is part of GAS, the GNU Assembler.
4
   This file is part of GAS, the GNU Assembler.
6
 
5
 
Line 140... Line 139...
140
	  if (this_operand >= 0 && i.reloc[this_operand] == NO_RELOC)
139
	  if (this_operand >= 0 && i.reloc[this_operand] == NO_RELOC)
141
	    {
140
	    {
142
	      int adjust = 0;
141
	      int adjust = 0;
143
	      char *gotfree_input_line = lex_got (&i.reloc[this_operand],
142
	      char *gotfree_input_line = lex_got (&i.reloc[this_operand],
144
						  &adjust,
143
						  &adjust,
145
						  &intel_state.reloc_types,
144
						  &intel_state.reloc_types);
146
						  (i.bnd_prefix != NULL
-
 
147
						   || add_bnd_prefix));
-
 
Line 148... Line 145...
148
 
145
 
149
	      if (!gotfree_input_line)
146
	      if (!gotfree_input_line)
150
		break;
147
		break;
151
	      free (gotfree_input_line);
148
	      free (gotfree_input_line);
Line 169... Line 166...
169
      }
166
      }
Line 170... Line 167...
170
 
167
 
171
  for (j = 0; i386_types[j].name; ++j)
168
  for (j = 0; i386_types[j].name; ++j)
172
    if (strcasecmp (i386_types[j].name, name) == 0)
169
    if (strcasecmp (i386_types[j].name, name) == 0)
-
 
170
      break;
173
      break;
171
 
174
  if (i386_types[j].name && *pc == ' ')
172
  if (i386_types[j].name && *pc == ' ')
-
 
173
    {
-
 
174
      char *pname;
-
 
175
      char c;
175
    {
176
 
176
      char *pname = ++input_line_pointer;
177
      ++input_line_pointer;
Line 177... Line 178...
177
      char c = get_symbol_end ();
178
      c = get_symbol_name (&pname);
178
 
179
 
-
 
180
      if (strcasecmp (pname, "ptr") == 0)
179
      if (strcasecmp (pname, "ptr") == 0)
181
	{
180
	{
182
	  /* FIXME: What if c == '"' ?  */
181
	  pname[-1] = *pc;
183
	  pname[-1] = *pc;
182
	  *pc = c;
184
	  *pc = c;
183
	  if (intel_syntax > 0 || operands != 1)
185
	  if (intel_syntax > 0 || operands != 1)
184
	    return O_illegal;
186
	    return O_illegal;
Line 185... Line 187...
185
	  return i386_types[j].op;
187
	  return i386_types[j].op;
186
	}
188
	}
187
 
189
 
Line 188... Line 190...
188
      *input_line_pointer = c;
190
      (void) restore_line_pointer (c);
189
      input_line_pointer = pname - 1;
191
      input_line_pointer = pname - 1;
Line 291... Line 293...
291
  else if (!intel_state.base && !intel_state.in_scale)
293
  else if (!intel_state.base && !intel_state.in_scale)
292
    intel_state.base = i386_regtab + reg_num;
294
    intel_state.base = i386_regtab + reg_num;
293
  else if (!intel_state.index)
295
  else if (!intel_state.index)
294
    {
296
    {
295
      if (intel_state.in_scale
297
      if (intel_state.in_scale
-
 
298
	  || current_templates->start->base_opcode == 0xf30f1b /* bndmk */
-
 
299
	  || (current_templates->start->base_opcode & ~1) == 0x0f1a /* bnd{ld,st}x */
296
	  || i386_regtab[reg_num].reg_type.bitfield.baseindex)
300
	  || i386_regtab[reg_num].reg_type.bitfield.baseindex)
297
	intel_state.index = i386_regtab + reg_num;
301
	intel_state.index = i386_regtab + reg_num;
298
      else
302
      else
299
	{
303
	{
300
	  /* Convert base to index and make ESP/RSP the base.  */
304
	  /* Convert base to index and make ESP/RSP the base.  */
Line 413... Line 417...
413
 
417
 
414
    case O_multiply:
418
    case O_multiply:
415
      if (this_operand >= 0 && intel_state.in_bracket)
419
      if (this_operand >= 0 && intel_state.in_bracket)
416
	{
420
	{
417
	  expressionS *scale = NULL;
-
 
418
 
421
	  expressionS *scale = NULL;
419
	  if (intel_state.index)
-
 
Line 420... Line 422...
420
	    --scale;
422
	  int has_index = (intel_state.index != NULL);
421
 
423
 
Line 422... Line 424...
422
	  if (!intel_state.in_scale++)
424
	  if (!intel_state.in_scale++)
423
	    intel_state.scale_factor = 1;
425
	    intel_state.scale_factor = 1;
424
 
426
 
Line 425... Line 427...
425
	  ret = i386_intel_simplify_symbol (e->X_add_symbol);
427
	  ret = i386_intel_simplify_symbol (e->X_add_symbol);
426
	  if (ret && !scale && intel_state.index)
428
	  if (ret && !has_index && intel_state.index)
427
	    scale = symbol_get_value_expression (e->X_op_symbol);
429
	    scale = symbol_get_value_expression (e->X_op_symbol);
428
 
430
 
Line 429... Line 431...
429
	  if (ret)
431
	  if (ret)
430
	    ret = i386_intel_simplify_symbol (e->X_op_symbol);
432
	    ret = i386_intel_simplify_symbol (e->X_op_symbol);
431
	  if (ret && !scale && intel_state.index)
433
	  if (ret && !scale && !has_index && intel_state.index)
432
	    scale = symbol_get_value_expression (e->X_add_symbol);
434
	    scale = symbol_get_value_expression (e->X_add_symbol);
433
 
435
 
434
	  if (ret && scale && (scale + 1))
436
	  if (ret && scale)