diff mbox

[v2,2/4] arc: Add XML target features for Linux targets

Message ID 20171026114020.10213-2-Anton.Kolesov@synopsys.com
State New
Headers show

Commit Message

Anton Kolesov Oct. 26, 2017, 11:40 a.m. UTC
Add XML target features for Linux targets.  Compared to default
Linux features:

- Explicitly specify CPU machine.
- Remove baremetal only ILINK{,1,2} registers.
- Add LP_START and LP_END registers for hardware loops - required to properly
  evaluate possible next instruction during software single instruction
  stepping.
- Add BTA register which contains branch target address - address of next
  instruction when processor is in the delay slot.
- ARC HS description also adds R30, R58 and R59 registers, specific to this
  architecture.

gdb/ChangeLog:
yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* arch/arc.h (arc_create_target_description): Support Linux targets.
	* arch/arc.c (arc_create_target_description): Likewise.
	* arc-tdep.c (arc_tdesc_init): Update invocation of
	  arc_create_target_description.
	* features/Makefile (FEATURE_XMLFILES): Add new files.
	* features/arc/aux-arcompact-linux.xml: New file.
	* features/arc/aux-v2-linux.xml: Likewise.
	* features/arc/core-arcompact-linux.xml: Likewise.
	* features/arc/core-v2-linux.xml: Likewise.
	* features/arc/aux-arcompact-linux.c: Generate.
	* features/arc/aux-v2-linux.c: Likewise.
	* features/arc/core-arcompact-linux.c: Likewise.
	* features/arc/core-v2-linux.c: Likewise.
---
 gdb/arc-tdep.c                            |  2 +-
 gdb/arch/arc.c                            | 42 +++++++++++++++++-----
 gdb/arch/arc.h                            |  3 +-
 gdb/features/Makefile                     |  4 +++
 gdb/features/arc/aux-arcompact-linux.c    | 35 +++++++++++++++++++
 gdb/features/arc/aux-arcompact-linux.xml  | 31 +++++++++++++++++
 gdb/features/arc/aux-v2-linux.c           | 39 +++++++++++++++++++++
 gdb/features/arc/aux-v2-linux.xml         | 35 +++++++++++++++++++
 gdb/features/arc/core-arcompact-linux.c   | 45 ++++++++++++++++++++++++
 gdb/features/arc/core-arcompact-linux.xml | 56 +++++++++++++++++++++++++++++
 gdb/features/arc/core-v2-linux.c          | 48 +++++++++++++++++++++++++
 gdb/features/arc/core-v2-linux.xml        | 58 +++++++++++++++++++++++++++++++
 12 files changed, 388 insertions(+), 10 deletions(-)
 create mode 100644 gdb/features/arc/aux-arcompact-linux.c
 create mode 100644 gdb/features/arc/aux-arcompact-linux.xml
 create mode 100644 gdb/features/arc/aux-v2-linux.c
 create mode 100644 gdb/features/arc/aux-v2-linux.xml
 create mode 100644 gdb/features/arc/core-arcompact-linux.c
 create mode 100644 gdb/features/arc/core-arcompact-linux.xml
 create mode 100644 gdb/features/arc/core-v2-linux.c
 create mode 100644 gdb/features/arc/core-v2-linux.xml
diff mbox

Patch

diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 6ed30da..2782535 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1792,7 +1792,7 @@  arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
   /* If target doesn't provide a description - use default one.  */
   if (!tdesc_has_registers (tdesc_loc))
     {
-      tdesc_loc = arc_create_target_description (arc_debug, is_arcv2);
+      tdesc_loc = arc_create_target_description (arc_debug, is_arcv2, false);
     }
   else
     {
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c
index 8f0d8d6..f0da408 100644
--- a/gdb/arch/arc.c
+++ b/gdb/arch/arc.c
@@ -24,46 +24,72 @@ 
 /* Target description features.  */
 #include "features/arc/core-v2.c"
 #include "features/arc/aux-v2.c"
+#include "features/arc/core-v2-linux.c"
+#include "features/arc/aux-v2-linux.c"
 #include "features/arc/core-arcompact.c"
 #include "features/arc/aux-arcompact.c"
+#include "features/arc/core-arcompact-linux.c"
+#include "features/arc/aux-arcompact-linux.c"
 
 /* Create target description for a target with specified parameters.
    PRINT_DEBUG defines whether to print debug messages to the stderr stream.
    IS_ARCV2 defines if this is an ARCv2 (ARC EM or ARC HS) target or ARCompact
    (ARC600 or ARC700); there is no use for more specific information about
-   target processor.  */
+   target processor.  IS_LINUX defines if this is a Linux target or not.  */
 
 target_desc *
-arc_create_target_description (bool print_debug, bool is_arcv2)
+arc_create_target_description (bool print_debug, bool is_arcv2, bool is_linux)
 {
   target_desc *tdesc = allocate_target_description ();
 
   if (print_debug)
     debug_printf ("arc: Creating target description, "
-	"is_arcv2=%i\n", is_arcv2);
+	"is_arcv2=%i, is_linux=%i\n", is_arcv2, is_linux);
 
   long regnum = 0;
 
 #ifndef IN_PROCESS_AGENT
   if (is_arcv2)
     {
-      set_tdesc_architecture (tdesc, "arc:ARCv2");
+      if (is_linux)
+	/* If this is ARCv2 Linux, then it is ARC HS.  */
+	set_tdesc_architecture (tdesc, "arc:HS");
+      else
+	set_tdesc_architecture (tdesc, "arc:ARCv2");
     }
   else
     {
       set_tdesc_architecture (tdesc, "arc:ARC700");
     }
+  if (is_linux)
+    set_tdesc_osabi (tdesc, "GNU/Linux");
 #endif
 
   if (is_arcv2)
     {
-      regnum = create_feature_arc_core_v2 (tdesc, regnum);
-      regnum = create_feature_arc_aux_v2 (tdesc, regnum);
+      if (is_linux)
+	{
+	  regnum = create_feature_arc_core_v2_linux (tdesc, regnum);
+	  regnum = create_feature_arc_aux_v2_linux (tdesc, regnum);
+	}
+      else
+	{
+	  regnum = create_feature_arc_core_v2 (tdesc, regnum);
+	  regnum = create_feature_arc_aux_v2 (tdesc, regnum);
+	}
     }
   else
     {
-      regnum = create_feature_arc_core_arcompact (tdesc, regnum);
-      regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
+      if (is_linux)
+	{
+	  regnum = create_feature_arc_core_arcompact_linux (tdesc, regnum);
+	  regnum = create_feature_arc_aux_arcompact_linux (tdesc, regnum);
+	}
+      else
+	{
+	  regnum = create_feature_arc_core_arcompact (tdesc, regnum);
+	  regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
+	}
     }
 
   return tdesc;
diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h
index 2d1828e..70b5b52 100644
--- a/gdb/arch/arc.h
+++ b/gdb/arch/arc.h
@@ -17,5 +17,6 @@ 
 
 #include "tdesc.h"
 
-target_desc *arc_create_target_description (bool print_debug, bool is_arcv2);
+target_desc *arc_create_target_description (bool print_debug, bool is_arcv2,
+					    bool is_linux);
 
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index e30a8bd..f12e0ff 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -208,8 +208,12 @@  $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
 FEATURE_XMLFILES = \
 	arc/core-v2.xml \
 	arc/aux-v2.xml \
+	arc/core-v2-linux.xml \
+	arc/aux-v2-linux.xml \
 	arc/core-arcompact.xml \
 	arc/aux-arcompact.xml \
+	arc/core-arcompact-linux.xml \
+	arc/aux-arcompact-linux.xml \
 	i386/32bit-core.xml \
 	i386/32bit-sse.xml \
 	i386/32bit-linux.xml \
diff --git a/gdb/features/arc/aux-arcompact-linux.c b/gdb/features/arc/aux-arcompact-linux.c
new file mode 100644
index 0000000..998929e
--- /dev/null
+++ b/gdb/features/arc/aux-arcompact-linux.c
@@ -0,0 +1,35 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: aux-arcompact-linux.xml */
+
+#include "arch/tdesc.h"
+
+static int
+create_feature_arc_aux_arcompact_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal", "aux-arcompact-linux.xml");
+  struct tdesc_type *field_type;
+  struct tdesc_type *type;
+  type = tdesc_create_flags (feature, "status32_type", 4);
+  tdesc_add_flag (type, 0, "H");
+  tdesc_add_bitfield (type, "E", 1, 2);
+  tdesc_add_bitfield (type, "A", 3, 4);
+  tdesc_add_flag (type, 5, "AE");
+  tdesc_add_flag (type, 6, "DE");
+  tdesc_add_flag (type, 7, "U");
+  tdesc_add_flag (type, 8, "V");
+  tdesc_add_flag (type, 9, "C");
+  tdesc_add_flag (type, 10, "N");
+  tdesc_add_flag (type, 11, "Z");
+  tdesc_add_flag (type, 12, "L");
+  tdesc_add_flag (type, 13, "R");
+  tdesc_add_flag (type, 14, "SE");
+
+  tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type");
+  tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/aux-arcompact-linux.xml b/gdb/features/arc/aux-arcompact-linux.xml
new file mode 100644
index 0000000..2dc0a67
--- /dev/null
+++ b/gdb/features/arc/aux-arcompact-linux.xml
@@ -0,0 +1,31 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.aux-minimal">
+  <flags id="status32_type" size="4">
+      <field name="H"   start="0" end="0"/>
+      <field name="E"   start="1" end="2"/>
+      <field name="A"   start="3" end="4"/>
+      <field name="AE"  start="5" end="5"/>
+      <field name="DE"  start="6" end="6"/>
+      <field name="U"   start="7" end="7"/>
+      <field name="V"   start="8" end="8"/>
+      <field name="C"   start="9" end="9"/>
+      <field name="N"   start="10" end="10"/>
+      <field name="Z"   start="11" end="11"/>
+      <field name="L"   start="12" end="12"/>
+      <field name="R"  start="13" end="13"/>
+      <field name="SE"  start="14" end="14"/>
+  </flags>
+
+  <reg name="pc"       bitsize="32" type="code_ptr"/>
+  <reg name="status32" bitsize="32" type="status32_type"/>
+  <reg name="lp_start" bitsize="32" type="code_ptr"/>
+  <reg name="lp_end"   bitsize="32" type="code_ptr"/>
+  <reg name="bta"      bitsize="32" type="code_ptr"/>
+</feature>
diff --git a/gdb/features/arc/aux-v2-linux.c b/gdb/features/arc/aux-v2-linux.c
new file mode 100644
index 0000000..48b1550
--- /dev/null
+++ b/gdb/features/arc/aux-v2-linux.c
@@ -0,0 +1,39 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: aux-v2-linux.xml */
+
+#include "arch/tdesc.h"
+
+static int
+create_feature_arc_aux_v2_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal", "aux-v2-linux.xml");
+  struct tdesc_type *field_type;
+  struct tdesc_type *type;
+  type = tdesc_create_flags (feature, "status32_type", 4);
+  tdesc_add_flag (type, 0, "H");
+  tdesc_add_bitfield (type, "E", 1, 4);
+  tdesc_add_flag (type, 5, "AE");
+  tdesc_add_flag (type, 6, "DE");
+  tdesc_add_flag (type, 7, "U");
+  tdesc_add_flag (type, 8, "V");
+  tdesc_add_flag (type, 9, "C");
+  tdesc_add_flag (type, 10, "N");
+  tdesc_add_flag (type, 11, "Z");
+  tdesc_add_flag (type, 12, "L");
+  tdesc_add_flag (type, 13, "DZ");
+  tdesc_add_flag (type, 14, "SC");
+  tdesc_add_flag (type, 15, "ES");
+  tdesc_add_bitfield (type, "RB", 16, 18);
+  tdesc_add_flag (type, 19, "AD");
+  tdesc_add_flag (type, 20, "US");
+  tdesc_add_flag (type, 31, "IE");
+
+  tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type");
+  tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/aux-v2-linux.xml b/gdb/features/arc/aux-v2-linux.xml
new file mode 100644
index 0000000..d85b577
--- /dev/null
+++ b/gdb/features/arc/aux-v2-linux.xml
@@ -0,0 +1,35 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.aux-minimal">
+  <flags id="status32_type" size="4">
+      <field name="H"   start="0" end="0"/>
+      <field name="E"   start="1" end="4"/>
+      <field name="AE"  start="5" end="5"/>
+      <field name="DE"  start="6" end="6"/>
+      <field name="U"   start="7" end="7"/>
+      <field name="V"   start="8" end="8"/>
+      <field name="C"   start="9" end="9"/>
+      <field name="N"   start="10" end="10"/>
+      <field name="Z"   start="11" end="11"/>
+      <field name="L"   start="12" end="12"/>
+      <field name="DZ"  start="13" end="13"/>
+      <field name="SC"  start="14" end="14"/>
+      <field name="ES"  start="15" end="15"/>
+      <field name="RB"  start="16" end="18"/>
+      <field name="AD"  start="19" end="19"/>
+      <field name="US"  start="20" end="20"/>
+      <field name="IE"  start="31" end="31"/>
+  </flags>
+
+  <reg name="pc"       bitsize="32" type="code_ptr"/>
+  <reg name="status32" bitsize="32" type="status32_type"/>
+  <reg name="lp_start" bitsize="32" type="code_ptr"/>
+  <reg name="lp_end"   bitsize="32" type="code_ptr"/>
+  <reg name="bta"      bitsize="32" type="code_ptr"/>
+</feature>
diff --git a/gdb/features/arc/core-arcompact-linux.c b/gdb/features/arc/core-arcompact-linux.c
new file mode 100644
index 0000000..9ccefe3
--- /dev/null
+++ b/gdb/features/arc/core-arcompact-linux.c
@@ -0,0 +1,45 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: core-arcompact-linux.xml */
+
+#include "arch/tdesc.h"
+
+static int
+create_feature_arc_core_arcompact_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.arcompact", "core-arcompact-linux.xml");
+  tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r3", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r4", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r5", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r6", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r7", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r8", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r9", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r10", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r11", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r12", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r13", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r14", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r15", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r16", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r17", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r18", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r19", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r20", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r21", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r22", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r23", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r24", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r25", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32");
+  tdesc_create_reg (feature, "pcl", regnum++, 1, "", 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/core-arcompact-linux.xml b/gdb/features/arc/core-arcompact-linux.xml
new file mode 100644
index 0000000..53183a3
--- /dev/null
+++ b/gdb/features/arc/core-arcompact-linux.xml
@@ -0,0 +1,56 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.core.arcompact">
+  <reg name="r0"  bitsize="32"/>
+  <reg name="r1"  bitsize="32"/>
+  <reg name="r2"  bitsize="32"/>
+  <reg name="r3"  bitsize="32"/>
+  <reg name="r4"  bitsize="32"/>
+  <reg name="r5"  bitsize="32"/>
+  <reg name="r6"  bitsize="32"/>
+  <reg name="r7"  bitsize="32"/>
+  <reg name="r8"  bitsize="32"/>
+  <reg name="r9"  bitsize="32"/>
+  <reg name="r10" bitsize="32"/>
+  <reg name="r11" bitsize="32"/>
+  <reg name="r12" bitsize="32"/>
+  <reg name="r13" bitsize="32"/>
+  <reg name="r14" bitsize="32"/>
+  <reg name="r15" bitsize="32"/>
+  <reg name="r16" bitsize="32"/>
+  <reg name="r17" bitsize="32"/>
+  <reg name="r18" bitsize="32"/>
+  <reg name="r19" bitsize="32"/>
+  <reg name="r20" bitsize="32"/>
+  <reg name="r21" bitsize="32"/>
+  <reg name="r22" bitsize="32"/>
+  <reg name="r23" bitsize="32"/>
+  <reg name="r24" bitsize="32"/>
+  <reg name="r25" bitsize="32"/>
+
+  <!-- ARC core data pointer registers.  -->
+  <reg name="gp"  bitsize="32" type="data_ptr"/>
+  <reg name="fp"  bitsize="32" type="data_ptr"/>
+  <reg name="sp"  bitsize="32" type="data_ptr"/>
+
+  <!-- Code pointers.  -->
+  <reg name="blink"  bitsize="32" type="code_ptr"/>
+
+  <!-- Here goes extension core registers: r32 - r59 -->
+
+  <!-- Loop counter.  -->
+  <reg name="lp_count" bitsize="32" type="uint32"/>
+
+  <!-- r61 is a reserved register address.  -->
+
+  <!-- r62 is a long immediate value, not a real register.  -->
+
+  <!-- 4-byte aligned read-only program counter.  -->
+  <reg name="pcl" bitsize="32" type="code_ptr" group=""/>
+</feature>
diff --git a/gdb/features/arc/core-v2-linux.c b/gdb/features/arc/core-v2-linux.c
new file mode 100644
index 0000000..780986b
--- /dev/null
+++ b/gdb/features/arc/core-v2-linux.c
@@ -0,0 +1,48 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: core-v2-linux.xml */
+
+#include "arch/tdesc.h"
+
+static int
+create_feature_arc_core_v2_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.v2", "core-v2-linux.xml");
+  tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r3", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r4", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r5", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r6", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r7", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r8", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r9", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r10", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r11", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r12", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r13", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r14", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r15", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r16", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r17", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r18", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r19", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r20", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r21", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r22", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r23", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r24", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r25", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "r30", regnum++, 1, "", 32, "int");
+  tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "r58", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r59", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32");
+  tdesc_create_reg (feature, "pcl", regnum++, 1, "", 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/core-v2-linux.xml b/gdb/features/arc/core-v2-linux.xml
new file mode 100644
index 0000000..c400874
--- /dev/null
+++ b/gdb/features/arc/core-v2-linux.xml
@@ -0,0 +1,58 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2017 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.core.v2">
+  <reg name="r0"  bitsize="32"/>
+  <reg name="r1"  bitsize="32"/>
+  <reg name="r2"  bitsize="32"/>
+  <reg name="r3"  bitsize="32"/>
+  <reg name="r4"  bitsize="32"/>
+  <reg name="r5"  bitsize="32"/>
+  <reg name="r6"  bitsize="32"/>
+  <reg name="r7"  bitsize="32"/>
+  <reg name="r8"  bitsize="32"/>
+  <reg name="r9"  bitsize="32"/>
+  <reg name="r10" bitsize="32"/>
+  <reg name="r11" bitsize="32"/>
+  <reg name="r12" bitsize="32"/>
+  <reg name="r13" bitsize="32"/>
+  <reg name="r14" bitsize="32"/>
+  <reg name="r15" bitsize="32"/>
+  <reg name="r16" bitsize="32"/>
+  <reg name="r17" bitsize="32"/>
+  <reg name="r18" bitsize="32"/>
+  <reg name="r19" bitsize="32"/>
+  <reg name="r20" bitsize="32"/>
+  <reg name="r21" bitsize="32"/>
+  <reg name="r22" bitsize="32"/>
+  <reg name="r23" bitsize="32"/>
+  <reg name="r24" bitsize="32"/>
+  <reg name="r25" bitsize="32"/>
+
+  <!-- ARC core data pointer registers.  -->
+  <reg name="gp"  bitsize="32" type="data_ptr"/>
+  <reg name="fp"  bitsize="32" type="data_ptr"/>
+  <reg name="sp"  bitsize="32" type="data_ptr"/>
+
+  <reg name="r30"   bitsize="32" group=""/>
+  <reg name="blink" bitsize="32" type="code_ptr"/>
+
+  <!-- Here goes extension core registers: r32 - r57.  -->
+  <reg name="r58"   bitsize="32"/>
+  <reg name="r59"   bitsize="32"/>
+
+  <!-- Loop counter.  -->
+  <reg name="lp_count" bitsize="32" type="uint32"/>
+
+  <!-- r61 is a reserved register address.  -->
+
+  <!-- r62 is a long immediate value, not a real register.  -->
+
+  <!-- 4-byte aligned read-only program counter.  -->
+  <reg name="pcl" bitsize="32" type="code_ptr" group=""/>
+</feature>