summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@xilinx.com>2020-01-27 10:34:43 -0800
committerMark Hatle <mark.hatle@xilinx.com>2020-01-27 11:04:13 -0800
commitac744e63e208b5ddb6f799b041d0c0cd4ea2d144 (patch)
tree7c5ee79b27b9f9fa44351e76d012ec470dc205c2
parentd64011b4e8e4fbc42a16ae6c11ec7198a2605f46 (diff)
downloadmeta-xilinx-ac744e63e208b5ddb6f799b041d0c0cd4ea2d144.tar.gz
binutils: Merge latest binutils work
Update gdb item (not really applicable, but included to be complete). Fix an issue w/ microblaze 64 IMML instruction. Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
-rw-r--r--meta-xilinx-bsp/recipes-microblaze/binutils/binutils-microblaze.inc2
-rw-r--r--meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch364
-rw-r--r--meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch86
3 files changed, 452 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-microblaze.inc b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-microblaze.inc
index 3cb4dc26..5ccd78b2 100644
--- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-microblaze.inc
+++ b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-microblaze.inc
@@ -44,4 +44,6 @@ SRC_URI_append = " \
44 file://0041-patch-MicroBlaze-porting-GDB-for-linux.patch \ 44 file://0041-patch-MicroBlaze-porting-GDB-for-linux.patch \
45 file://0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch \ 45 file://0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch \
46 file://0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch \ 46 file://0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch \
47 file://0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch \
48 file://0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \
47 " 49 "
diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
new file mode 100644
index 00000000..29e198cd
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
@@ -0,0 +1,364 @@
1From 4f0e06249d23629e1d56b296e7a040b6968484e9 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Mon, 20 Jan 2020 12:48:13 -0800
4Subject: [PATCH 44/45] gdb/microblaze-linux-nat.c: Fix target compilation of
5 gdb
6
7Add the nat to the configure file
8
9Remove gdb_assert.h and gdb_string.h.
10
11Adjust include for opcodes as well.
12
13Update to match latest style of components, similar to ppc-linux-nat.c
14
15Update:
16 get_regcache_arch(regcache) to regcache->arch()
17 regcache_raw_supply(regcache, ...) to regcache->raw_supply(...)
18 regcache_raw_collect(regcache, ...) to regcache->raw_collect(...)
19
20Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
21---
22 gdb/configure.nat | 4 +
23 gdb/microblaze-linux-nat.c | 149 +++++++++++++------------------------
24 gdb/microblaze-tdep.c | 3 +-
25 3 files changed, 57 insertions(+), 99 deletions(-)
26
27diff --git a/gdb/configure.nat b/gdb/configure.nat
28index 3118263ac6..b8dc7398a5 100644
29--- a/gdb/configure.nat
30+++ b/gdb/configure.nat
31@@ -260,6 +260,10 @@ case ${gdb_host} in
32 # Host: Motorola m68k running GNU/Linux.
33 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
34 ;;
35+ microblaze*)
36+ # Host: Microblaze, running Linux
37+ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o"
38+ ;;
39 mips)
40 # Host: Linux/MIPS
41 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
42diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
43index e9b8c9c522..e09a86bb3f 100644
44--- a/gdb/microblaze-linux-nat.c
45+++ b/gdb/microblaze-linux-nat.c
46@@ -36,11 +36,9 @@
47 #include "dwarf2-frame.h"
48 #include "osabi.h"
49
50-#include "gdb_assert.h"
51-#include "gdb_string.h"
52 #include "target-descriptions.h"
53-#include "opcodes/microblaze-opcm.h"
54-#include "opcodes/microblaze-dis.h"
55+#include "../opcodes/microblaze-opcm.h"
56+#include "../opcodes/microblaze-dis.h"
57
58 #include "linux-nat.h"
59 #include "target-descriptions.h"
60@@ -61,34 +59,27 @@
61 /* Defines ps_err_e, struct ps_prochandle. */
62 #include "gdb_proc_service.h"
63
64-/* On GNU/Linux, threads are implemented as pseudo-processes, in which
65- case we may be tracing more than one process at a time. In that
66- case, inferior_ptid will contain the main process ID and the
67- individual thread (process) ID. get_thread_id () is used to get
68- the thread id if it's available, and the process id otherwise. */
69-
70-int
71-get_thread_id (ptid_t ptid)
72-{
73- int tid = TIDGET (ptid);
74- if (0 == tid)
75- tid = PIDGET (ptid);
76- return tid;
77-}
78-
79-#define GET_THREAD_ID(PTID) get_thread_id (PTID)
80-
81 /* Non-zero if our kernel may support the PTRACE_GETREGS and
82 PTRACE_SETREGS requests, for reading and writing the
83 general-purpose registers. Zero if we've tried one of
84 them and gotten an error. */
85 int have_ptrace_getsetregs = 1;
86
87+struct microblaze_linux_nat_target final : public linux_nat_target
88+{
89+ /* Add our register access methods. */
90+ void fetch_registers (struct regcache *, int) override;
91+ void store_registers (struct regcache *, int) override;
92+
93+ const struct target_desc *read_description () override;
94+};
95+
96+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
97+
98 static int
99 microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
100 {
101 int u_addr = -1;
102- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
103 /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
104 interface, and not the wordsize of the program's ABI. */
105 int wordsize = sizeof (long);
106@@ -105,18 +96,16 @@ microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
107 static void
108 fetch_register (struct regcache *regcache, int tid, int regno)
109 {
110- struct gdbarch *gdbarch = get_regcache_arch (regcache);
111- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
112+ struct gdbarch *gdbarch = regcache->arch();
113 /* This isn't really an address. But ptrace thinks of it as one. */
114 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
115 int bytes_transferred;
116- unsigned int offset; /* Offset of registers within the u area. */
117- char buf[MAX_REGISTER_SIZE];
118+ char buf[sizeof(long)];
119
120 if (regaddr == -1)
121 {
122 memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
123- regcache_raw_supply (regcache, regno, buf);
124+ regcache->raw_supply (regno, buf);
125 return;
126 }
127
128@@ -149,14 +138,14 @@ fetch_register (struct regcache *regcache, int tid, int regno)
129 {
130 /* Little-endian values are always found at the left end of the
131 bytes transferred. */
132- regcache_raw_supply (regcache, regno, buf);
133+ regcache->raw_supply (regno, buf);
134 }
135 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
136 {
137 /* Big-endian values are found at the right end of the bytes
138 transferred. */
139 size_t padding = (bytes_transferred - register_size (gdbarch, regno));
140- regcache_raw_supply (regcache, regno, buf + padding);
141+ regcache->raw_supply (regno, buf + padding);
142 }
143 else
144 internal_error (__FILE__, __LINE__,
145@@ -175,8 +164,6 @@ fetch_register (struct regcache *regcache, int tid, int regno)
146 static int
147 fetch_all_gp_regs (struct regcache *regcache, int tid)
148 {
149- struct gdbarch *gdbarch = get_regcache_arch (regcache);
150- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
151 gdb_gregset_t gregset;
152
153 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
154@@ -204,8 +191,6 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
155 static void
156 fetch_gp_regs (struct regcache *regcache, int tid)
157 {
158- struct gdbarch *gdbarch = get_regcache_arch (regcache);
159- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
160 int i;
161
162 if (have_ptrace_getsetregs)
163@@ -219,17 +204,29 @@ fetch_gp_regs (struct regcache *regcache, int tid)
164 fetch_register (regcache, tid, i);
165 }
166
167+/* Fetch registers from the child process. Fetch all registers if
168+ regno == -1, otherwise fetch all general registers or all floating
169+ point registers depending upon the value of regno. */
170+void
171+microblaze_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
172+{
173+ pid_t tid = get_ptrace_pid (regcache->ptid ());
174+
175+ if (regno == -1)
176+ fetch_gp_regs (regcache, tid);
177+ else
178+ fetch_register (regcache, tid, regno);
179+}
180
181 static void
182 store_register (const struct regcache *regcache, int tid, int regno)
183 {
184- struct gdbarch *gdbarch = get_regcache_arch (regcache);
185- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
186+ struct gdbarch *gdbarch = regcache->arch();
187 /* This isn't really an address. But ptrace thinks of it as one. */
188 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
189 int i;
190 size_t bytes_to_transfer;
191- char buf[MAX_REGISTER_SIZE];
192+ char buf[sizeof(long)];
193
194 if (regaddr == -1)
195 return;
196@@ -242,13 +239,13 @@ store_register (const struct regcache *regcache, int tid, int regno)
197 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
198 {
199 /* Little-endian values always sit at the left end of the buffer. */
200- regcache_raw_collect (regcache, regno, buf);
201+ regcache->raw_collect (regno, buf);
202 }
203 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
204 {
205 /* Big-endian values sit at the right end of the buffer. */
206 size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
207- regcache_raw_collect (regcache, regno, buf + padding);
208+ regcache->raw_collect (regno, buf + padding);
209 }
210
211 for (i = 0; i < bytes_to_transfer; i += sizeof (long))
212@@ -281,8 +278,6 @@ store_register (const struct regcache *regcache, int tid, int regno)
213 static int
214 store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
215 {
216- struct gdbarch *gdbarch = get_regcache_arch (regcache);
217- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
218 gdb_gregset_t gregset;
219
220 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
221@@ -319,8 +314,6 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
222 static void
223 store_gp_regs (const struct regcache *regcache, int tid, int regno)
224 {
225- struct gdbarch *gdbarch = get_regcache_arch (regcache);
226- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
227 int i;
228
229 if (have_ptrace_getsetregs)
230@@ -335,33 +328,10 @@ store_gp_regs (const struct regcache *regcache, int tid, int regno)
231 }
232
233
234-/* Fetch registers from the child process. Fetch all registers if
235- regno == -1, otherwise fetch all general registers or all floating
236- point registers depending upon the value of regno. */
237-
238-static void
239-microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
240- struct regcache *regcache, int regno)
241-{
242- /* Get the thread id for the ptrace call. */
243- int tid = GET_THREAD_ID (inferior_ptid);
244-
245- if (regno == -1)
246- fetch_gp_regs (regcache, tid);
247- else
248- fetch_register (regcache, tid, regno);
249-}
250-
251-/* Store registers back into the inferior. Store all registers if
252- regno == -1, otherwise store all general registers or all floating
253- point registers depending upon the value of regno. */
254-
255-static void
256-microblaze_linux_store_inferior_registers (struct target_ops *ops,
257- struct regcache *regcache, int regno)
258+void
259+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
260 {
261- /* Get the thread id for the ptrace call. */
262- int tid = GET_THREAD_ID (inferior_ptid);
263+ pid_t tid = get_ptrace_pid (regcache->ptid ());
264
265 if (regno >= 0)
266 store_register (regcache, tid, regno);
267@@ -373,59 +343,44 @@ microblaze_linux_store_inferior_registers (struct target_ops *ops,
268 thread debugging. */
269
270 void
271-fill_gregset (const struct regcache *regcache,
272- gdb_gregset_t *gregsetp, int regno)
273+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
274 {
275- microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
276+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
277 }
278
279 void
280-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
281+fill_gregset (const struct regcache *regcache,
282+ gdb_gregset_t *gregsetp, int regno)
283 {
284- microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
285+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
286 }
287
288 void
289-fill_fpregset (const struct regcache *regcache,
290- gdb_fpregset_t *fpregsetp, int regno)
291+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
292 {
293 /* FIXME. */
294+ return;
295 }
296
297 void
298-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
299+fill_fpregset (const struct regcache *regcache,
300+ gdb_fpregset_t *fpregsetp, int regno)
301 {
302 /* FIXME. */
303+ return;
304 }
305
306-static const struct target_desc *
307-microblaze_linux_read_description (struct target_ops *ops)
308+const struct target_desc *
309+microblaze_linux_nat_target::read_description ()
310 {
311- CORE_ADDR microblaze_hwcap = 0;
312-
313- if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
314- return NULL;
315-
316 return NULL;
317 }
318
319-
320-void _initialize_microblaze_linux_nat (void);
321-
322 void
323 _initialize_microblaze_linux_nat (void)
324 {
325- struct target_ops *t;
326-
327- /* Fill in the generic GNU/Linux methods. */
328- t = linux_target ();
329-
330- /* Add our register access methods. */
331- t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
332- t->to_store_registers = microblaze_linux_store_inferior_registers;
333-
334- t->to_read_description = microblaze_linux_read_description;
335+ linux_target = &the_microblaze_linux_nat_target;
336
337 /* Register the target. */
338- linux_nat_add_target (t);
339+ add_inf_child_target (linux_target);
340 }
341diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
342index 7a0c2527f4..23deb24d26 100644
343--- a/gdb/microblaze-tdep.c
344+++ b/gdb/microblaze-tdep.c
345@@ -657,7 +657,7 @@ static std::vector<CORE_ADDR>
346 microblaze_software_single_step (struct regcache *regcache)
347 {
348 // struct gdbarch *arch = get_frame_arch(frame);
349- struct gdbarch *arch = get_regcache_arch (regcache);
350+ struct gdbarch *arch = regcache->arch();
351 struct address_space *aspace = get_regcache_aspace (regcache);
352 // struct address_space *aspace = get_frame_address_space (frame);
353 struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
354@@ -876,7 +876,6 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
355 static void
356 make_regs (struct gdbarch *arch)
357 {
358- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
359 int mach = gdbarch_bfd_arch_info (arch)->mach;
360
361 if (mach == bfd_mach_microblaze64)
362--
3632.17.1
364
diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
new file mode 100644
index 00000000..118c5629
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
@@ -0,0 +1,86 @@
1From d64ce07a2b9206ce1e53d8958b28de02cc7cca2b Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Wed, 22 Jan 2020 16:31:12 +0530
4Subject: [PATCH 45/45] Fixed bug in generation of IMML instruction for the new
5 MB-64 instructions with single register.
6
7---
8 gas/config/tc-microblaze.c | 50 +++++++++++++++++++++++++++++++++++---
9 1 file changed, 47 insertions(+), 3 deletions(-)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 95a1e69729..dc79328df6 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -1642,12 +1642,56 @@ md_assemble (char * str)
16 exp.X_add_symbol,
17 exp.X_add_number,
18 (char *) opc);
19- immedl = 0L;
20+ immed = 0L;
21 }
22 else
23 {
24 output = frag_more (isize);
25 immed = exp.X_add_number;
26+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
27+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
28+ {
29+ /* Needs an immediate inst. */
30+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
31+ {
32+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
33+ if (opcode1 == NULL)
34+ {
35+ as_bad (_("unknown opcode \"%s\""), "imml");
36+ return;
37+ }
38+ inst1 = opcode1->bit_sequence;
39+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
40+ output[0] = INST_BYTE0 (inst1);
41+ output[1] = INST_BYTE1 (inst1);
42+ output[2] = INST_BYTE2 (inst1);
43+ output[3] = INST_BYTE3 (inst1);
44+ output = frag_more (isize);
45+ }
46+ else {
47+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
48+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
49+ if (opcode1 == NULL || opcode2 == NULL)
50+ {
51+ as_bad (_("unknown opcode \"%s\""), "imml");
52+ return;
53+ }
54+ inst1 = opcode2->bit_sequence;
55+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
56+ output[0] = INST_BYTE0 (inst1);
57+ output[1] = INST_BYTE1 (inst1);
58+ output[2] = INST_BYTE2 (inst1);
59+ output[3] = INST_BYTE3 (inst1);
60+ output = frag_more (isize);
61+ inst1 = opcode1->bit_sequence;
62+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
63+ output[0] = INST_BYTE0 (inst1);
64+ output[1] = INST_BYTE1 (inst1);
65+ output[2] = INST_BYTE2 (inst1);
66+ output[3] = INST_BYTE3 (inst1);
67+ output = frag_more (isize);
68+ }
69+ }
70 }
71 inst |= (reg1 << RD_LOW) & RD_MASK;
72 inst |= (immed << IMM_LOW) & IMM16_MASK;
73@@ -2141,8 +2185,8 @@ md_assemble (char * str)
74 streq (name, "breaid") ||
75 streq (name, "brai") || streq (name, "braid")))
76 {
77- temp = immed & 0xFFFFFFFFFFFF8000;
78- if (temp != 0)
79+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
80+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
81 {
82 /* Needs an immediate inst. */
83 if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
84--
852.17.1
86