This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA] New port: CR16: BFD Changes required by the gdb port
- From: Kaushik Phatak <Kaushik dot Phatak at kpitcummins dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Mon, 26 Nov 2012 07:03:11 +0000
- Subject: [RFA] New port: CR16: BFD Changes required by the gdb port
Hi,
Please find below a patch for CR16 BFD related changes required by the
new CR16 gdb port. The gdb port was pre-approved last week,
http://sourceware.org/ml/gdb-patches/2012-11/msg00600.html
The below changes are needed so that the cr16-tdep code can easily access
the disassembler functions. Kindly review the same and let me know
if these changes are ok.
Thanks,
Kaushik
2012-11-26 Kaushik Phatak <kaushik.phatak@kpitcummins.com>
opcodes/ChangeLog
* cr16-dis.c (match_opcode,make_instruction: Remove static declaration.
(dwordU,wordU): Moved typedefs to opcode/cr16.h
bfd/Changelog
* config.bfd (cr16*-*-uclinux*): New target support.
include/opcode/ChangeLog
* cr16.h (dwordU,wordU): Moved typedefs from cr16-dis.c
(make_instruction,match_opcode): Added function prototypes.
(words,allWords,currInsn): Declare as extern.
diff -uprN ./gdb_src.orig/opcodes/cr16-dis.c ./gdb_src/opcodes/cr16-dis.c
--- ./gdb_src.orig/opcodes/cr16-dis.c 2012-05-17 20:43:25.000000000 +0530
+++ ./gdb_src/opcodes/cr16-dis.c 2012-11-26 11:21:43.000000000 +0530
@@ -36,9 +36,6 @@
/* Set Bit Mask - a mask to set all bits starting from offset 'offs'. */
#define SBM(offs) ((((1 << (32 - offs)) -1) << (offs)))
-typedef unsigned long dwordU;
-typedef unsigned short wordU;
-
typedef struct
{
dwordU val;
@@ -317,7 +314,7 @@ build_mask (void)
/* Search for a matching opcode. Return 1 for success, 0 for failure. */
-static int
+int
match_opcode (void)
{
unsigned long mask;
@@ -734,7 +731,7 @@ print_arguments (ins *currentInsn, bfd_v
/* Build the instruction's arguments. */
-static void
+void
make_instruction (void)
{
int i;
--- ./gdb_src.orig/bfd/config.bfd 2012-05-15 18:25:34.000000000 +0530
+++ ./gdb_src/bfd/config.bfd 2012-10-23 15:09:08.000000000 +0530
@@ -345,6 +345,11 @@ case "${targ}" in
targ_underscore=yes
;;
+ cr16*-*-uclinux*)
+ targ_defvec=bfd_elf32_cr16_vec
+ targ_underscore=yes
+ ;;
+
cr16c-*-elf*)
targ_defvec=bfd_elf32_cr16c_vec
targ_underscore=yes
--- ./gdb_src.orig/include/opcode/cr16.h 2010-04-15 15:56:09.000000000 +0530
+++ ./gdb_src/include/opcode/cr16.h 2012-11-16 12:43:59.000000000 +0530
@@ -435,4 +435,17 @@ extern const inst *instruction;
typedef long long int LONGLONG;
typedef unsigned long long ULONGLONG;
+/* Data types for opcode handling. */
+typedef unsigned long dwordU;
+typedef unsigned short wordU;
+
+/* Globals to store opcode data and build the instruction. */
+extern wordU words[3];
+extern ULONGLONG allWords;
+extern ins currInsn;
+
+/* Prototypes for function in cr16-dis.c. */
+void make_instruction (void);
+int match_opcode (void);
+
#endif /* _CR16_H_ */