This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, nios2] Add mach parameter to nios2_find_opcode_hash


This patch is another installment in the series to add support for multiple ISAs to the Nios II back end.

The disassembler function nios2_find_opcode_hash returns an instruction descriptor object matching the instruction word parameter. It will need to know which set of instruction encodings to match against, so this patch adds a mach parameter to the function. Presently the parameter is unused (there is only one ISA defined so far), but I decided it made sense to push this interface change before a GDB patch that adds a dependency on this function for instruction matching.

Committed as obvious.

-Sandra


2014-11-06  Sandra Loosemore  <sandra@codesourcery.com>

	include/opcode/
	* nios2.h (nios2_find_opcode_hash): Add mach parameter to
	declaration.  Fix obsolete comment.

	opcodes/
	* nios2-dis.c (nios2_find_opcode_hash): Add mach parameter.
	(nios2_disassemble): Adjust call to nios2_find_opcode_hash.

	gas/
	* config/tc-nios2.c (nios2_diagnose_overflow): Adjust call to
	nios2_find_opcode_hash.
diff --git a/include/opcode/nios2.h b/include/opcode/nios2.h
index dc0e058..6b4c2f5 100644
--- a/include/opcode/nios2.h
+++ b/include/opcode/nios2.h
@@ -154,8 +154,8 @@ extern struct nios2_reg *nios2_regs;
 extern const int nios2_num_builtin_regs;
 extern int nios2_num_regs;
 
-/* This is made extern so that the assembler can use it to find out
-   what instruction caused an error.  */
-extern const struct nios2_opcode *nios2_find_opcode_hash (unsigned long);
+/* Return the opcode descriptor for a single instruction.  */
+extern const struct nios2_opcode *
+nios2_find_opcode_hash (unsigned long, unsigned long);
 
 #endif /* _NIOS2_H */
diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
index 00ee342..7243fa9 100644
--- a/opcodes/nios2-dis.c
+++ b/opcodes/nios2-dis.c
@@ -153,9 +153,10 @@ nios2_init_opcode_hash (nios2_disassembler_state *state)
 }
 
 /* Return a pointer to an nios2_opcode struct for a given instruction
-   opcode, or NULL if there is an error.  */
+   word OPCODE for bfd machine MACH, or NULL if there is an error.  */
 const struct nios2_opcode *
-nios2_find_opcode_hash (unsigned long opcode)
+nios2_find_opcode_hash (unsigned long opcode,
+			unsigned long mach ATTRIBUTE_UNUSED)
 {
   nios2_opcode_hash *entry;
   nios2_disassembler_state *state;
@@ -459,7 +460,7 @@ nios2_disassemble (bfd_vma address, unsigned long opcode,
 
   /* Find the major opcode and use this to disassemble
      the instruction and its arguments.  */
-  op = nios2_find_opcode_hash (opcode);
+  op = nios2_find_opcode_hash (opcode, info->mach);
 
   if (op != NULL)
     {
diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index 3ed7a9e..7691fd1 100644
--- a/gas/config/tc-nios2.c
+++ b/gas/config/tc-nios2.c
@@ -1033,7 +1033,7 @@ nios2_diagnose_overflow (valueT fixup, reloc_howto_type *howto,
       unsigned int range_max;
       unsigned int address;
 
-      opcode = nios2_find_opcode_hash (value);
+      opcode = nios2_find_opcode_hash (value, bfd_get_mach (stdoutput));
       gas_assert (opcode);
       gas_assert (fixP->fx_size == opcode->size);
       overflow_msg_type = opcode->overflow_msg;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]