summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2024-07-23 16:33:38 -0600
committerMark Hatle <mark.hatle@amd.com>2024-07-24 11:52:53 -0600
commitd059ba9a0a3c5cc209cfb10d4f81ad4cbc3c5700 (patch)
tree5815fd5a4d1200c398b85f59697666b518d103d9
parent990ab65ee197cfdb56029deb056312785d34f0fb (diff)
downloadmeta-xilinx-d059ba9a0a3c5cc209cfb10d4f81ad4cbc3c5700.tar.gz
meta-microblaze: gdb: Update to latest version
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc55
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch)40
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch50
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch)42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch45
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch)774
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch1891
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch300
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch)19
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch)2139
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch)43
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch133
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch43
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch88
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch150
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch82
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch69
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch113
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch176
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch29
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch44
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch79
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch107
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch83
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch89
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch185
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch177
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch61
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch125
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch46
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch27
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch116
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch51
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch29
47 files changed, 5280 insertions, 2771 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
index d3618229..151e7c25 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
@@ -4,14 +4,51 @@ LTTNGUST:microblaze = ""
4# Add MicroBlaze patches 4# Add MicroBlaze patches
5FILESEXTRAPATHS:append := ":${THISDIR}/gdb" 5FILESEXTRAPATHS:append := ":${THISDIR}/gdb"
6 6
7# Our changes are all local, no real patch-status
8ERROR_QA:remove = "patch-status"
9
7SRC_URI:append:microblaze = " \ 10SRC_URI:append:microblaze = " \
8 file://0001-Add-initial-port-of-linux-gdbserver.patch \ 11 file://0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
9 file://0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch \ 12 file://0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
10 file://0003-Fix-debug-message-when-register-is-unavailable.patch \ 13 file://0003-Initial-port-of-core-reading-support-Added-support-f.patch \
11 file://0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch \ 14 file://0004-Fix-debug-message-when-register-is-unavailable.patch \
12 file://0005-Patch-microblaze-Adding-64-bit-MB-support.patch \ 15 file://0005-MicroBlaze-native-gdb-port.patch \
13 file://0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \ 16 file://0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch \
14 file://0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch \ 17 file://0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch \
15 file://0008-Patch-MicroBlaze.patch \ 18 file://0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch \
16 file://0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch \ 19 file://0009-Depth-Total-number-of-inline-functions-refer-inline-.patch \
20 file://0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch \
21 file://0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch \
22 file://0013-Disable-the-warning-message-for-eh_frame_hdr.patch \
23 file://0015-upstream-change-to-garbage-collection-sweep-causes-m.patch \
24 file://0016-Add-new-bit-field-instructions.patch \
25 file://0019-initial-support-for-MicroBlaze-64-bit-m64.patch \
26 file://0020-initial-support-for-MicroBlaze-64-bit-m64.patch \
27 file://0021-Added-relocations-for-MB-X.patch \
28 file://0022-initial-support-for-MicroBlaze-64-bit-m64.patch \
29 file://0023-Added-relocations-for-MB-X.patch \
30 file://0025-Fixed-address-computation-issues-with-64bit-address-.patch \
31 file://0028-fixing-the-long-long-long-mingw-toolchain-issue.patch \
32 file://0029-Added-support-to-new-arithmetic-single-register-inst.patch \
33 file://0030-double-imml-generation-for-64-bit-values.patch \
34 file://0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
35 file://0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch \
36 file://0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch \
37 file://0038-MB-binutils-Upstream-port-issues.patch \
38 file://0039-Initial-port-of-core-reading-support-Added-support-f.patch \
39 file://0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch \
40 file://0041-disable-truncated-register-warning-gdb-remote.c.patch \
41 file://0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch \
42 file://0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch \
43 file://0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch \
44 file://0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch \
45 file://0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch \
46 file://0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch \
47 file://0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch \
48 file://0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch \
49 file://0050-When-unwinding-pc-value-adjust-return-pc-value.patch \
50 file://0051-info-reg-pc-does-not-print-symbolic-value.patch \
51 file://0052-Wrong-target-description-accepted-by-microblaze-arch.patch \
52 file://0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch \
53 file://0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch \
17 " 54 "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
new file mode 100644
index 00000000..bf7b3363
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -0,0 +1,42 @@
1From fc4e376f932514d9e5e3c04a18952d5900334c09 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 01/54] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux
6
7gdbserver needs to initialise the microblaze registers
8
9other archs use this step to run a *_arch_setup() to carry out all
10architecture specific setup - may need to add in future
11
12 * add linux-ptrace.o to gdbserver configure
13 * Update breakpoint opcode
14 * fix segfault on connecting gdbserver
15 * add microblaze_linux_memory_remove_breakpoint
16 * add set_solib_svr4_fetch_link_map_offsets
17 * add set_gdbarch_fetch_tls_load_module_address
18 * Force reading of r0 as 0, prevent stores
19
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdbserver/Makefile.in | 1 +
26 1 file changed, 1 insertion(+)
27
28diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
29index b597515d428..faf32cd9d42 100644
30--- a/gdbserver/Makefile.in
31+++ b/gdbserver/Makefile.in
32@@ -180,6 +180,7 @@ SFILES = \
33 $(srcdir)/linux-loongarch-low.cc \
34 $(srcdir)/linux-low.cc \
35 $(srcdir)/linux-m68k-low.cc \
36+ $(srcdir)/linux-microblaze-low.cc \
37 $(srcdir)/linux-mips-low.cc \
38 $(srcdir)/linux-nios2-low.cc \
39 $(srcdir)/linux-or1k-low.cc \
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
index 050bdde5..02b42cbd 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -1,7 +1,7 @@
1From baac387700a72407b3994bfd0a03825112c9745f Mon Sep 17 00:00:00 2001 1From fa91dbd8c23e519760213f32de572cbf98ad6bc3 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530 3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 1/8] Add initial port of linux gdbserver add 4Subject: [PATCH 02/54] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux 5 gdb_proc_service_h to gdbserver microblaze-linux
6 6
7gdbserver needs to initialise the microblaze registers 7gdbserver needs to initialise the microblaze registers
@@ -17,11 +17,10 @@ architecture specific setup - may need to add in future
17 * add set_gdbarch_fetch_tls_load_module_address 17 * add set_gdbarch_fetch_tls_load_module_address
18 * Force reading of r0 as 0, prevent stores 18 * Force reading of r0 as 0, prevent stores
19 19
20Upstream-Status: Pending
21
22Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
23Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
24Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
25--- 24---
26 gdb/configure.host | 2 + 25 gdb/configure.host | 2 +
27 gdb/features/Makefile | 1 + 26 gdb/features/Makefile | 1 +
@@ -31,10 +30,9 @@ Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
31 gdb/microblaze-tdep.h | 4 +- 30 gdb/microblaze-tdep.h | 4 +-
32 gdb/regformats/microblaze-linux.dat | 64 +++++++ 31 gdb/regformats/microblaze-linux.dat | 64 +++++++
33 gdb/regformats/reg-microblaze.dat | 41 +++++ 32 gdb/regformats/reg-microblaze.dat | 41 +++++
34 gdbserver/Makefile.in | 1 +
35 gdbserver/configure.srv | 10 ++ 33 gdbserver/configure.srv | 10 ++
36 gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++ 34 gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++
37 11 files changed, 466 insertions(+), 3 deletions(-) 35 10 files changed, 465 insertions(+), 3 deletions(-)
38 create mode 100644 gdb/features/microblaze-linux.xml 36 create mode 100644 gdb/features/microblaze-linux.xml
39 create mode 100644 gdb/regformats/microblaze-linux.dat 37 create mode 100644 gdb/regformats/microblaze-linux.dat
40 create mode 100644 gdb/regformats/reg-microblaze.dat 38 create mode 100644 gdb/regformats/reg-microblaze.dat
@@ -61,7 +59,7 @@ index da71675b201..877537d06ef 100644
61 mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu) 59 mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu)
62 gdb_host=nbsd ;; 60 gdb_host=nbsd ;;
63diff --git a/gdb/features/Makefile b/gdb/features/Makefile 61diff --git a/gdb/features/Makefile b/gdb/features/Makefile
64index 68e17d0085d..fc3196864c9 100644 62index 32341f71815..0af9d67c2f7 100644
65--- a/gdb/features/Makefile 63--- a/gdb/features/Makefile
66+++ b/gdb/features/Makefile 64+++ b/gdb/features/Makefile
67@@ -46,6 +46,7 @@ 65@@ -46,6 +46,7 @@
@@ -92,7 +90,7 @@ index 00000000000..688a3f83d1e
92+ <xi:include href="microblaze-core.xml"/> 90+ <xi:include href="microblaze-core.xml"/>
93+</target> 91+</target>
94diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 92diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
95index daa7ddf7e4d..5748556a556 100644 93index ae33cb5c014..9160b4ad464 100644
96--- a/gdb/microblaze-linux-tdep.c 94--- a/gdb/microblaze-linux-tdep.c
97+++ b/gdb/microblaze-linux-tdep.c 95+++ b/gdb/microblaze-linux-tdep.c
98@@ -37,6 +37,22 @@ 96@@ -37,6 +37,22 @@
@@ -152,7 +150,7 @@ index daa7ddf7e4d..5748556a556 100644
152 150
153 void _initialize_microblaze_linux_tdep (); 151 void _initialize_microblaze_linux_tdep ();
154diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 152diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
155index 3d5dd669341..3e8e8fe35b9 100644 153index f254a54305c..28a647e940b 100644
156--- a/gdb/microblaze-tdep.c 154--- a/gdb/microblaze-tdep.c
157+++ b/gdb/microblaze-tdep.c 155+++ b/gdb/microblaze-tdep.c
158@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) 156@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
@@ -195,7 +193,7 @@ index 3d5dd669341..3e8e8fe35b9 100644
195 193
196 /* Allocate and initialize a frame cache. */ 194 /* Allocate and initialize a frame cache. */
197 195
198@@ -716,6 +747,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 196@@ -714,6 +745,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
199 microblaze_breakpoint::kind_from_pc); 197 microblaze_breakpoint::kind_from_pc);
200 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 198 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
201 microblaze_breakpoint::bp_from_kind); 199 microblaze_breakpoint::bp_from_kind);
@@ -203,14 +201,14 @@ index 3d5dd669341..3e8e8fe35b9 100644
203 201
204 set_gdbarch_frame_args_skip (gdbarch, 8); 202 set_gdbarch_frame_args_skip (gdbarch, 8);
205 203
206@@ -756,4 +788,5 @@ When non-zero, microblaze specific debugging is enabled."), 204@@ -754,4 +786,5 @@ When non-zero, microblaze specific debugging is enabled."),
207 NULL, 205 NULL,
208 &setdebuglist, &showdebuglist); 206 &setdebuglist, &showdebuglist);
209 207
210+ 208+
211 } 209 }
212diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 210diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
213index 4d90e8785dc..53fcb2297e6 100644 211index 892e5b3b849..e9f57e97c26 100644
214--- a/gdb/microblaze-tdep.h 212--- a/gdb/microblaze-tdep.h
215+++ b/gdb/microblaze-tdep.h 213+++ b/gdb/microblaze-tdep.h
216@@ -118,6 +118,8 @@ struct microblaze_frame_cache 214@@ -118,6 +118,8 @@ struct microblaze_frame_cache
@@ -340,23 +338,11 @@ index 00000000000..bd8a4384424
340+32:fsr 338+32:fsr
341+32:slr 339+32:slr
342+32:shr 340+32:shr
343diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
344index 47648b8d962..55a5f5b81ae 100644
345--- a/gdbserver/Makefile.in
346+++ b/gdbserver/Makefile.in
347@@ -178,6 +178,7 @@ SFILES = \
348 $(srcdir)/linux-ia64-low.cc \
349 $(srcdir)/linux-low.cc \
350 $(srcdir)/linux-m68k-low.cc \
351+ $(srcdir)/linux-microblaze-low.cc \
352 $(srcdir)/linux-mips-low.cc \
353 $(srcdir)/linux-nios2-low.cc \
354 $(srcdir)/linux-or1k-low.cc \
355diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv 341diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
356index 6e09b0eeb79..1817f1f04fb 100644 342index 9e861a75088..11ce617e72f 100644
357--- a/gdbserver/configure.srv 343--- a/gdbserver/configure.srv
358+++ b/gdbserver/configure.srv 344+++ b/gdbserver/configure.srv
359@@ -145,6 +145,16 @@ case "${gdbserver_host}" in 345@@ -159,6 +159,16 @@ case "${gdbserver_host}" in
360 srv_linux_regsets=yes 346 srv_linux_regsets=yes
361 srv_linux_thread_db=yes 347 srv_linux_thread_db=yes
362 ;; 348 ;;
@@ -649,5 +635,5 @@ index 00000000000..bf9eecc41ab
649+} 635+}
650+ 636+
651-- 637--
6522.37.1 (Apple Git-137.1) 6382.34.1
653 639
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
deleted file mode 100644
index d8ba6fca..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 6ecb1de66a6a5f55e69c9b108a3d5a85b0ebf315 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 3/8] Fix debug message when register is unavailable
5
6Upstream-Status: Pending
7
8Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
9
10Conflicts:
11 gdb/frame.c
12---
13 gdb/frame.c | 21 ++++++++++++++-------
14 1 file changed, 14 insertions(+), 7 deletions(-)
15
16diff --git a/gdb/frame.c b/gdb/frame.c
17index ce95cf8343b..c49ab9feab2 100644
18--- a/gdb/frame.c
19+++ b/gdb/frame.c
20@@ -1261,13 +1261,20 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
21 else
22 {
23 int i;
24- gdb::array_view<const gdb_byte> buf = value_contents (value);
25-
26- fprintf_unfiltered (&debug_file, " bytes=");
27- fprintf_unfiltered (&debug_file, "[");
28- for (i = 0; i < register_size (gdbarch, regnum); i++)
29- fprintf_unfiltered (&debug_file, "%02x", buf[i]);
30- fprintf_unfiltered (&debug_file, "]");
31+ const gdb_byte *buf = NULL;
32+ if (value_entirely_available(value)) {
33+ gdb::array_view<const gdb_byte> buf = value_contents (value);
34+ }
35+
36+ fprintf_unfiltered (gdb_stdlog, " bytes=");
37+ fprintf_unfiltered (gdb_stdlog, "[");
38+ if (buf != NULL) {
39+ for (i = 0; i < register_size (gdbarch, regnum); i++)
40+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
41+ } else {
42+ fprintf_unfiltered (gdb_stdlog, "unavailable");
43+ }
44+ fprintf_unfiltered (gdb_stdlog, "]");
45 }
46 }
47
48--
492.37.1 (Apple Git-137.1)
50
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch
index f7af2a62..6e86a773 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -1,16 +1,14 @@
1From 7da397cae8c0f8826184d6e12fda9ccd11f92753 Mon Sep 17 00:00:00 2001 1From 118ce6c252a56ca592a7fdd40919522be00d5fb4 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530 3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 2/8] [Patch,MicroBlaze]: Initial port of core reading support 4Subject: [PATCH 03/54] Initial port of core reading support Added support for
5 Added support for reading notes in linux core dumps Support for reading of 5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 PRSTATUS and PSINFO information for rebuilding ".reg" sections of core dumps 6 information for rebuilding ".reg" sections of core dumps at run time.
7 at run time.
8
9Upstream-Status: Pending
10 7
11Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
12Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
13Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
14--- 12---
15 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++ 13 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
16 gdb/configure.tgt | 2 +- 14 gdb/configure.tgt | 2 +-
@@ -20,10 +18,10 @@ Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
20 5 files changed, 177 insertions(+), 2 deletions(-) 18 5 files changed, 177 insertions(+), 2 deletions(-)
21 19
22diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 20diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
23index d09b3f7095d..d3b3c66cf00 100644 21index a7e81c70fc8..487ddeafc5a 100644
24--- a/bfd/elf32-microblaze.c 22--- a/bfd/elf32-microblaze.c
25+++ b/bfd/elf32-microblaze.c 23+++ b/bfd/elf32-microblaze.c
26@@ -713,6 +713,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 24@@ -754,6 +754,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
27 return _bfd_elf_is_local_label_name (abfd, name); 25 return _bfd_elf_is_local_label_name (abfd, name);
28 } 26 }
29 27
@@ -111,7 +109,7 @@ index d09b3f7095d..d3b3c66cf00 100644
111 /* ELF linker hash entry. */ 109 /* ELF linker hash entry. */
112 110
113 struct elf32_mb_link_hash_entry 111 struct elf32_mb_link_hash_entry
114@@ -3434,4 +3515,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 112@@ -3480,4 +3561,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
115 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 113 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
116 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 114 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
117 115
@@ -120,10 +118,10 @@ index d09b3f7095d..d3b3c66cf00 100644
120+ 118+
121 #include "elf32-target.h" 119 #include "elf32-target.h"
122diff --git a/gdb/configure.tgt b/gdb/configure.tgt 120diff --git a/gdb/configure.tgt b/gdb/configure.tgt
123index 0705ccf32b8..7ea186481f3 100644 121index 47a674201f9..d0673abd2b8 100644
124--- a/gdb/configure.tgt 122--- a/gdb/configure.tgt
125+++ b/gdb/configure.tgt 123+++ b/gdb/configure.tgt
126@@ -400,7 +400,7 @@ mep-*-*) 124@@ -415,7 +415,7 @@ mep-*-*)
127 125
128 microblaze*-linux-*|microblaze*-*-linux*) 126 microblaze*-linux-*|microblaze*-*-linux*)
129 # Target: Xilinx MicroBlaze running Linux 127 # Target: Xilinx MicroBlaze running Linux
@@ -133,7 +131,7 @@ index 0705ccf32b8..7ea186481f3 100644
133 ;; 131 ;;
134 microblaze*-*-*) 132 microblaze*-*-*)
135diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 133diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
136index 5748556a556..d6197c49dfd 100644 134index 9160b4ad464..17bcb50fd4f 100644
137--- a/gdb/microblaze-linux-tdep.c 135--- a/gdb/microblaze-linux-tdep.c
138+++ b/gdb/microblaze-linux-tdep.c 136+++ b/gdb/microblaze-linux-tdep.c
139@@ -36,6 +36,7 @@ 137@@ -36,6 +36,7 @@
@@ -179,10 +177,10 @@ index 5748556a556..d6197c49dfd 100644
179 set_gdbarch_fetch_tls_load_module_address (gdbarch, 177 set_gdbarch_fetch_tls_load_module_address (gdbarch,
180 svr4_fetch_objfile_link_map); 178 svr4_fetch_objfile_link_map);
181diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 179diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
182index 3e8e8fe35b9..ccd37d085d6 100644 180index 28a647e940b..6ab36bd746b 100644
183--- a/gdb/microblaze-tdep.c 181--- a/gdb/microblaze-tdep.c
184+++ b/gdb/microblaze-tdep.c 182+++ b/gdb/microblaze-tdep.c
185@@ -666,6 +666,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 183@@ -665,6 +665,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
186 tdesc_microblaze_with_stack_protect); 184 tdesc_microblaze_with_stack_protect);
187 } 185 }
188 186
@@ -226,9 +224,9 @@ index 3e8e8fe35b9..ccd37d085d6 100644
226 static struct gdbarch * 224 static struct gdbarch *
227 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 225 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
228 { 226 {
229@@ -718,6 +755,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 227@@ -716,6 +753,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
230 microblaze_gdbarch_tdep *tdep = new microblaze_gdbarch_tdep; 228 gdbarch *gdbarch
231 gdbarch = gdbarch_alloc (&info, tdep); 229 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
232 230
233+ tdep->gregset = NULL; 231+ tdep->gregset = NULL;
234+ tdep->sizeof_gregset = 0; 232+ tdep->sizeof_gregset = 0;
@@ -237,7 +235,7 @@ index 3e8e8fe35b9..ccd37d085d6 100644
237 set_gdbarch_long_double_bit (gdbarch, 128); 235 set_gdbarch_long_double_bit (gdbarch, 128);
238 236
239 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 237 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
240@@ -766,6 +807,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 238@@ -764,6 +805,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
241 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 239 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
242 if (tdesc_data != NULL) 240 if (tdesc_data != NULL)
243 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); 241 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
@@ -252,7 +250,7 @@ index 3e8e8fe35b9..ccd37d085d6 100644
252 return gdbarch; 250 return gdbarch;
253 } 251 }
254diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 252diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
255index 53fcb2297e6..2e853d84d72 100644 253index e9f57e97c26..738da4f0531 100644
256--- a/gdb/microblaze-tdep.h 254--- a/gdb/microblaze-tdep.h
257+++ b/gdb/microblaze-tdep.h 255+++ b/gdb/microblaze-tdep.h
258@@ -23,8 +23,23 @@ 256@@ -23,8 +23,23 @@
@@ -267,7 +265,7 @@ index 53fcb2297e6..2e853d84d72 100644
267+ unsigned int pregs[16]; 265+ unsigned int pregs[16];
268+}; 266+};
269+ 267+
270 struct microblaze_gdbarch_tdep : gdbarch_tdep 268 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
271 { 269 {
272+ int dummy; // declare something. 270+ int dummy; // declare something.
273+ 271+
@@ -299,5 +297,5 @@ index 53fcb2297e6..2e853d84d72 100644
299 297
300 #endif /* microblaze-tdep.h */ 298 #endif /* microblaze-tdep.h */
301-- 299--
3022.37.1 (Apple Git-137.1) 3002.34.1
303 301
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch
new file mode 100644
index 00000000..1e6aff76
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch
@@ -0,0 +1,45 @@
1From a027a1ce861f93bd00d814d6aef28414069330a1 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 04/54] Fix debug message when register is unavailable
5
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7
8Conflicts:
9 gdb/frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gdb/frame.c | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15diff --git a/gdb/frame.c b/gdb/frame.c
16index 87fb3d7a2d5..c4d967e01d5 100644
17--- a/gdb/frame.c
18+++ b/gdb/frame.c
19@@ -1313,12 +1313,20 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
20 else
21 {
22 int i;
23- gdb::array_view<const gdb_byte> buf = value->contents ();
24+
25+ const gdb_byte *buf = NULL;
26+ if (value_entirely_available(value)) {
27+ gdb::array_view<const gdb_byte> buf = value->contents ();
28+ }
29
30 gdb_printf (&debug_file, " bytes=");
31 gdb_printf (&debug_file, "[");
32- for (i = 0; i < register_size (gdbarch, regnum); i++)
33- gdb_printf (&debug_file, "%02x", buf[i]);
34+ if (buf != NULL) {
35+ for (i = 0; i < register_size (gdbarch, regnum); i++)
36+ gdb_printf (&debug_file, "%02x", buf[i]);
37+ } else {
38+ gdb_printf (&debug_file, "unavailable");
39+ }
40 gdb_printf (&debug_file, "]");
41 }
42 }
43--
442.34.1
45
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch
index 08b0ae17..a9c6aee4 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch
@@ -1,13 +1,11 @@
1From 8d05b79cda7617f228fa4bb6e5147689b662699e Mon Sep 17 00:00:00 2001 1From 2e84106b932f40eeaa4ae40b441b9eb7b713b2fa Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 18:53:46 +0530 3Date: Mon, 10 Oct 2022 18:53:46 +0530
4Subject: [PATCH 4/8] [Patch,MicroBlaze] : MicroBlaze native gdb port. 4Subject: [PATCH 05/54] MicroBlaze native gdb port.
5 5
6signed-off-by : Mahesh Bodapati <mbodapat@amd.com> 6signed-off-by : Mahesh Bodapati <mbodapat@amd.com>
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
11--- 9---
12 gdb/Makefile.in | 2 + 10 gdb/Makefile.in | 2 +
13 gdb/configure.nat | 4 + 11 gdb/configure.nat | 4 +
@@ -23,10 +21,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
23 create mode 100644 gdb/microblaze-linux-tdep.h 21 create mode 100644 gdb/microblaze-linux-tdep.h
24 22
25diff --git a/gdb/Makefile.in b/gdb/Makefile.in 23diff --git a/gdb/Makefile.in b/gdb/Makefile.in
26index aecab41eeb8..fb63e1662c1 100644 24index 9c0a0bff2cd..1ad975b50ae 100644
27--- a/gdb/Makefile.in 25--- a/gdb/Makefile.in
28+++ b/gdb/Makefile.in 26+++ b/gdb/Makefile.in
29@@ -1374,6 +1374,7 @@ HFILES_NO_SRCDIR = \ 27@@ -1406,6 +1406,7 @@ HFILES_NO_SRCDIR = \
30 memory-map.h \ 28 memory-map.h \
31 memrange.h \ 29 memrange.h \
32 microblaze-tdep.h \ 30 microblaze-tdep.h \
@@ -34,7 +32,7 @@ index aecab41eeb8..fb63e1662c1 100644
34 mips-linux-tdep.h \ 32 mips-linux-tdep.h \
35 mips-netbsd-tdep.h \ 33 mips-netbsd-tdep.h \
36 mips-tdep.h \ 34 mips-tdep.h \
37@@ -2249,6 +2250,7 @@ ALLDEPFILES = \ 35@@ -1754,6 +1755,7 @@ ALLDEPFILES = \
38 m68k-linux-nat.c \ 36 m68k-linux-nat.c \
39 m68k-linux-tdep.c \ 37 m68k-linux-tdep.c \
40 m68k-tdep.c \ 38 m68k-tdep.c \
@@ -43,10 +41,10 @@ index aecab41eeb8..fb63e1662c1 100644
43 microblaze-tdep.c \ 41 microblaze-tdep.c \
44 mingw-hdep.c \ 42 mingw-hdep.c \
45diff --git a/gdb/configure.nat b/gdb/configure.nat 43diff --git a/gdb/configure.nat b/gdb/configure.nat
46index b45519fd116..256c666e760 100644 44index 1dc4206b69c..05003e57020 100644
47--- a/gdb/configure.nat 45--- a/gdb/configure.nat
48+++ b/gdb/configure.nat 46+++ b/gdb/configure.nat
49@@ -270,6 +270,10 @@ case ${gdb_host} in 47@@ -274,6 +274,10 @@ case ${gdb_host} in
50 # Host: Motorola m68k running GNU/Linux. 48 # Host: Motorola m68k running GNU/Linux.
51 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o" 49 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
52 ;; 50 ;;
@@ -144,378 +142,378 @@ index 00000000000..267e12f6d59
144+} 142+}
145diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 143diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
146new file mode 100755 144new file mode 100755
147index 00000000000..6b9daa23120 145index 00000000000..a348001a3e2
148--- /dev/null 146--- /dev/null
149+++ b/gdb/microblaze-linux-nat.c 147+++ b/gdb/microblaze-linux-nat.c
150@@ -0,0 +1,366 @@ 148@@ -0,0 +1,366 @@
151+/* Native-dependent code for GNU/Linux MicroBlaze. 149+/* Native-dependent code for GNU/Linux MicroBlaze.
152+ Copyright (C) 2021 Free Software Foundation, Inc. 150+ Copyright (C) 2021 Free Software Foundation, Inc.
153+ 151+
154+ This file is part of GDB. 152+ This file is part of GDB.
155+ 153+
156+ This program is free software; you can redistribute it and/or modify 154+ This program is free software; you can redistribute it and/or modify
157+ it under the terms of the GNU General Public License as published by 155+ it under the terms of the GNU General Public License as published by
158+ the Free Software Foundation; either version 3 of the License, or 156+ the Free Software Foundation; either version 3 of the License, or
159+ (at your option) any later version. 157+ (at your option) any later version.
160+ 158+
161+ This program is distributed in the hope that it will be useful, 159+ This program is distributed in the hope that it will be useful,
162+ but WITHOUT ANY WARRANTY; without even the implied warranty of 160+ but WITHOUT ANY WARRANTY; without even the implied warranty of
163+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 161+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164+ GNU General Public License for more details. 162+ GNU General Public License for more details.
165+ 163+
166+ You should have received a copy of the GNU General Public License 164+ You should have received a copy of the GNU General Public License
167+ along with this program. If not, see <http://www.gnu.org/licenses/>. */ 165+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
168+ 166+
169+#include "defs.h" 167+#include "defs.h"
170+#include "arch-utils.h" 168+#include "arch-utils.h"
171+#include "dis-asm.h" 169+#include "dis-asm.h"
172+#include "frame.h" 170+#include "frame.h"
173+#include "trad-frame.h" 171+#include "trad-frame.h"
174+#include "symtab.h" 172+#include "symtab.h"
175+#include "value.h" 173+#include "value.h"
176+#include "gdbcmd.h" 174+#include "gdbcmd.h"
177+#include "breakpoint.h" 175+#include "breakpoint.h"
178+#include "inferior.h" 176+#include "inferior.h"
179+#include "gdbthread.h" 177+#include "gdbthread.h"
180+#include "gdbcore.h" 178+#include "gdbcore.h"
181+#include "regcache.h" 179+#include "regcache.h"
182+#include "regset.h" 180+#include "regset.h"
183+#include "target.h" 181+#include "target.h"
184+#include "frame.h" 182+#include "frame.h"
185+#include "frame-base.h" 183+#include "frame-base.h"
186+#include "frame-unwind.h" 184+#include "frame-unwind.h"
187+#include "osabi.h" 185+#include "osabi.h"
188+#include "gdbsupport/gdb_assert.h" 186+#include "gdbsupport/gdb_assert.h"
189+#include <string.h> 187+#include <string.h>
190+#include "target-descriptions.h" 188+#include "target-descriptions.h"
191+#include "opcodes/microblaze-opcm.h" 189+#include "opcodes/microblaze-opcm.h"
192+#include "opcodes/microblaze-dis.h" 190+#include "opcodes/microblaze-dis.h"
193+#include "gregset.h" 191+#include "gregset.h"
194+ 192+
195+#include "linux-nat.h" 193+#include "linux-nat.h"
196+#include "linux-tdep.h" 194+#include "linux-tdep.h"
197+#include "target-descriptions.h" 195+#include "target-descriptions.h"
198+ 196+
199+#include <sys/user.h> 197+#include <sys/user.h>
200+#include <sys/ioctl.h> 198+#include <sys/ioctl.h>
201+#include <sys/uio.h> 199+#include <sys/uio.h>
202+#include "gdbsupport/gdb_wait.h" 200+#include "gdbsupport/gdb_wait.h"
203+#include <fcntl.h> 201+#include <fcntl.h>
204+#include <sys/procfs.h> 202+#include <sys/procfs.h>
205+#include "nat/gdb_ptrace.h" 203+#include "nat/gdb_ptrace.h"
206+#include "nat/linux-ptrace.h" 204+#include "nat/linux-ptrace.h"
207+#include "inf-ptrace.h" 205+#include "inf-ptrace.h"
208+#include <algorithm> 206+#include <algorithm>
209+#include <unordered_map> 207+#include <unordered_map>
210+#include <list> 208+#include <list>
211+#include <sys/ptrace.h> 209+#include <sys/ptrace.h>
212+ 210+
213+/* Prototypes for supply_gregset etc. */ 211+/* Prototypes for supply_gregset etc. */
214+#include "gregset.h" 212+#include "gregset.h"
215+ 213+
216+#include "microblaze-tdep.h" 214+#include "microblaze-tdep.h"
217+#include "microblaze-linux-tdep.h" 215+#include "microblaze-linux-tdep.h"
218+#include "inferior.h" 216+#include "inferior.h"
219+ 217+
220+#include "elf/common.h" 218+#include "elf/common.h"
221+ 219+
222+#include "auxv.h" 220+#include "auxv.h"
223+#include "linux-tdep.h" 221+#include "linux-tdep.h"
224+ 222+
225+#include <sys/ptrace.h> 223+#include <sys/ptrace.h>
226+ 224+
227+ 225+
228+//int have_ptrace_getsetregs=1; 226+//int have_ptrace_getsetregs=1;
229+ 227+
230+/* MicroBlaze Linux native additions to the default linux support. */ 228+/* MicroBlaze Linux native additions to the default linux support. */
231+ 229+
232+class microblaze_linux_nat_target final : public linux_nat_target 230+class microblaze_linux_nat_target final : public linux_nat_target
233+{ 231+{
234+public: 232+public:
235+ /* Add our register access methods. */ 233+ /* Add our register access methods. */
236+ void fetch_registers (struct regcache *regcache, int regnum) override; 234+ void fetch_registers (struct regcache *regcache, int regnum) override;
237+ void store_registers (struct regcache *regcache, int regnum) override; 235+ void store_registers (struct regcache *regcache, int regnum) override;
238+ 236+
239+ /* Read suitable target description. */ 237+ /* Read suitable target description. */
240+ const struct target_desc *read_description () override; 238+ const struct target_desc *read_description () override;
241+}; 239+};
242+ 240+
243+static microblaze_linux_nat_target the_microblaze_linux_nat_target; 241+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
244+ 242+
245+static int 243+static int
246+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno) 244+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
247+{ 245+{
248+ int u_addr = -1; 246+ int u_addr = -1;
249+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 247+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
250+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace 248+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
251+ * interface, and not the wordsize of the program's ABI. */ 249+ * interface, and not the wordsize of the program's ABI. */
252+ int wordsize = sizeof (long); 250+ int wordsize = sizeof (long);
253+ 251+
254+ /* General purpose registers occupy 1 slot each in the buffer. */ 252+ /* General purpose registers occupy 1 slot each in the buffer. */
255+ if (regno >= MICROBLAZE_R0_REGNUM 253+ if (regno >= MICROBLAZE_R0_REGNUM
256+ && regno <= MICROBLAZE_FSR_REGNUM) 254+ && regno <= MICROBLAZE_FSR_REGNUM)
257+ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize); 255+ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize);
258+ 256+
259+ return u_addr; 257+ return u_addr;
260+} 258+}
261+ 259+
262+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1) 260+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
263+ from regset GREGS into REGCACHE. */ 261+ from regset GREGS into REGCACHE. */
264+ 262+
265+static void 263+static void
266+supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs, 264+supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs,
267+ int regnum) 265+ int regnum)
268+{ 266+{
269+ int i; 267+ int i;
270+ const elf_greg_t *regp = *gregs; 268+ const elf_greg_t *regp = *gregs;
271+ /* Access all registers */ 269+ /* Access all registers */
272+ if (regnum == -1) 270+ if (regnum == -1)
273+ { 271+ {
274+ /* We fill the general purpose registers. */ 272+ /* We fill the general purpose registers. */
275+ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++) 273+ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
276+ regcache->raw_supply (i, regp + i); 274+ regcache->raw_supply (i, regp + i);
277+ 275+
278+ /* Supply MICROBLAZE_PC_REGNUM from index 32. */ 276+ /* Supply MICROBLAZE_PC_REGNUM from index 32. */
279+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32); 277+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
280+ 278+
281+ /* Fill the inaccessible zero register with zero. */ 279+ /* Fill the inaccessible zero register with zero. */
282+ regcache->raw_supply_zeroed (0); 280+ regcache->raw_supply_zeroed (0);
283+ } 281+ }
284+ else if (regnum == MICROBLAZE_R0_REGNUM) 282+ else if (regnum == MICROBLAZE_R0_REGNUM)
285+ regcache->raw_supply_zeroed (0); 283+ regcache->raw_supply_zeroed (0);
286+ else if (regnum == MICROBLAZE_PC_REGNUM) 284+ else if (regnum == MICROBLAZE_PC_REGNUM)
287+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32); 285+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
288+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM) 286+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
289+ regcache->raw_supply (regnum, regp + regnum); 287+ regcache->raw_supply (regnum, regp + regnum);
290+} 288+}
291+ 289+
292+/* Copy all general purpose registers from regset GREGS into REGCACHE. */ 290+/* Copy all general purpose registers from regset GREGS into REGCACHE. */
293+ 291+
294+void 292+void
295+supply_gregset (struct regcache *regcache, const prgregset_t *gregs) 293+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
296+{ 294+{
297+ supply_gregset_regnum (regcache, gregs, -1); 295+ supply_gregset_regnum (regcache, gregs, -1);
298+} 296+}
299+ 297+
300+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1) 298+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
301+ from REGCACHE into regset GREGS. */ 299+ from REGCACHE into regset GREGS. */
302+ 300+
303+void 301+void
304+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum) 302+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
305+{ 303+{
306+ elf_greg_t *regp = *gregs; 304+ elf_greg_t *regp = *gregs;
307+ if (regnum == -1) 305+ if (regnum == -1)
308+ { 306+ {
309+ /* We fill the general purpose registers. */ 307+ /* We fill the general purpose registers. */
310+ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++) 308+ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
311+ regcache->raw_collect (i, regp + i); 309+ regcache->raw_collect (i, regp + i);
312+ 310+
313+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32); 311+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
314+ } 312+ }
315+ else if (regnum == MICROBLAZE_R0_REGNUM) 313+ else if (regnum == MICROBLAZE_R0_REGNUM)
316+ /* Nothing to do here. */ 314+ /* Nothing to do here. */
317+ ; 315+ ;
318+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM) 316+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
319+ regcache->raw_collect (regnum, regp + regnum); 317+ regcache->raw_collect (regnum, regp + regnum);
320+ else if (regnum == MICROBLAZE_PC_REGNUM) 318+ else if (regnum == MICROBLAZE_PC_REGNUM)
321+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32); 319+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
322+} 320+}
323+ 321+
324+/* Transfering floating-point registers between GDB, inferiors and cores. 322+/* Transfering floating-point registers between GDB, inferiors and cores.
325+ Since MicroBlaze floating-point registers are the same as GPRs these do 323+ Since MicroBlaze floating-point registers are the same as GPRs these do
326+ nothing. */ 324+ nothing. */
327+ 325+
328+void 326+void
329+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs) 327+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
330+{ 328+{
331+} 329+}
332+ 330+
333+void 331+void
334+fill_fpregset (const struct regcache *regcache, 332+fill_fpregset (const struct regcache *regcache,
335+ gdb_fpregset_t *fpregs, int regno) 333+ gdb_fpregset_t *fpregs, int regno)
336+{ 334+{
337+} 335+}
338+ 336+
339+ 337+
340+static void 338+static void
341+fetch_register (struct regcache *regcache, int tid, int regno) 339+fetch_register (struct regcache *regcache, int tid, int regno)
342+{ 340+{
343+ struct gdbarch *gdbarch = regcache->arch (); 341+ struct gdbarch *gdbarch = regcache->arch ();
344+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 342+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
345+ /* This isn't really an address. But ptrace thinks of it as one. */ 343+ /* This isn't really an address. But ptrace thinks of it as one. */
346+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); 344+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
347+ int bytes_transferred; 345+ int bytes_transferred;
348+ char buf[MICROBLAZE_MAX_REGISTER_SIZE]; 346+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
349+ 347+
350+ if (regaddr == -1) 348+ if (regaddr == -1)
351+ { 349+ {
352+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ 350+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
353+ regcache->raw_supply (regno, buf); 351+ regcache->raw_supply (regno, buf);
354+ return; 352+ return;
355+ } 353+ }
356+ 354+
357+ /* Read the raw register using sizeof(long) sized chunks. On a 355+ /* Read the raw register using sizeof(long) sized chunks. On a
358+ * 32-bit platform, 64-bit floating-point registers will require two 356+ * 32-bit platform, 64-bit floating-point registers will require two
359+ * transfers. */ 357+ * transfers. */
360+ for (bytes_transferred = 0; 358+ for (bytes_transferred = 0;
361+ bytes_transferred < register_size (gdbarch, regno); 359+ bytes_transferred < register_size (gdbarch, regno);
362+ bytes_transferred += sizeof (long)) 360+ bytes_transferred += sizeof (long))
363+ { 361+ {
364+ long l; 362+ long l;
365+ 363+
366+ errno = 0; 364+ errno = 0;
367+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); 365+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
368+ if (errno == EIO) 366+ if (errno == EIO)
369+ { 367+ {
370+ printf("ptrace io error\n"); 368+ printf("ptrace io error\n");
371+ } 369+ }
372+ regaddr += sizeof (long); 370+ regaddr += sizeof (long);
373+ if (errno != 0) 371+ if (errno != 0)
374+ { 372+ {
375+ char message[128]; 373+ char message[128];
376+ sprintf (message, "reading register %s (#%d)", 374+ sprintf (message, "reading register %s (#%d)",
377+ gdbarch_register_name (gdbarch, regno), regno); 375+ gdbarch_register_name (gdbarch, regno), regno);
378+ perror_with_name (message); 376+ perror_with_name (message);
379+ } 377+ }
380+ memcpy (&buf[bytes_transferred], &l, sizeof (l)); 378+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
381+ } 379+ }
382+ 380+
383+ /* Now supply the register. Keep in mind that the regcache's idea 381+ /* Now supply the register. Keep in mind that the regcache's idea
384+ * of the register's size may not be a multiple of sizeof 382+ * of the register's size may not be a multiple of sizeof
385+ * (long). */ 383+ * (long). */
386+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) 384+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
387+ { 385+ {
388+ /* Little-endian values are always found at the left end of the 386+ /* Little-endian values are always found at the left end of the
389+ * bytes transferred. */ 387+ * bytes transferred. */
390+ regcache->raw_supply (regno, buf); 388+ regcache->raw_supply (regno, buf);
391+ } 389+ }
392+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 390+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
393+ { 391+ {
394+ /* Big-endian values are found at the right end of the bytes 392+ /* Big-endian values are found at the right end of the bytes
395+ * transferred. */ 393+ * transferred. */
396+ size_t padding = (bytes_transferred - register_size (gdbarch, regno)); 394+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
397+ regcache->raw_supply (regno, buf + padding); 395+ regcache->raw_supply (regno, buf + padding);
398+ } 396+ }
399+ else 397+ else
400+ internal_error (__FILE__, __LINE__, 398+ internal_error (__FILE__, __LINE__,
401+ _("fetch_register: unexpected byte order: %d"), 399+ _("fetch_register: unexpected byte order: %d"),
402+ gdbarch_byte_order (gdbarch)); 400+ gdbarch_byte_order (gdbarch));
403+} 401+}
404+ 402+
405+ 403+
406+/* This is a wrapper for the fetch_all_gp_regs function. It is 404+/* This is a wrapper for the fetch_all_gp_regs function. It is
407+ * responsible for verifying if this target has the ptrace request 405+ * responsible for verifying if this target has the ptrace request
408+ * that can be used to fetch all general-purpose registers at one 406+ * that can be used to fetch all general-purpose registers at one
409+ * shot. If it doesn't, then we should fetch them using the 407+ * shot. If it doesn't, then we should fetch them using the
410+ * old-fashioned way, which is to iterate over the registers and 408+ * old-fashioned way, which is to iterate over the registers and
411+ * request them one by one. */ 409+ * request them one by one. */
412+static void 410+static void
413+fetch_gp_regs (struct regcache *regcache, int tid) 411+fetch_gp_regs (struct regcache *regcache, int tid)
414+{ 412+{
415+ int i; 413+ int i;
416+/* If we've hit this point, it doesn't really matter which 414+/* If we've hit this point, it doesn't really matter which
417+ architecture we are using. We just need to read the 415+ architecture we are using. We just need to read the
418+ registers in the "old-fashioned way". */ 416+ registers in the "old-fashioned way". */
419+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) 417+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
420+ fetch_register (regcache, tid, i); 418+ fetch_register (regcache, tid, i);
421+} 419+}
422+ 420+
423+/* Return a target description for the current target. */ 421+/* Return a target description for the current target. */
424+ 422+
425+const struct target_desc * 423+const struct target_desc *
426+microblaze_linux_nat_target::read_description () 424+microblaze_linux_nat_target::read_description ()
427+{ 425+{
428+ return tdesc_microblaze_linux; 426+ return tdesc_microblaze_linux;
429+} 427+}
430+ 428+
431+/* Fetch REGNUM (or all registers if REGNUM == -1) from the target 429+/* Fetch REGNUM (or all registers if REGNUM == -1) from the target
432+ into REGCACHE using PTRACE_GETREGSET. */ 430+ into REGCACHE using PTRACE_GETREGSET. */
433+ 431+
434+void 432+void
435+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache, 433+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache,
436+ int regno) 434+ int regno)
437+{ 435+{
438+ /* Get the thread id for the ptrace call. */ 436+ /* Get the thread id for the ptrace call. */
439+ int tid = regcache->ptid ().lwp (); 437+ int tid = regcache->ptid ().lwp ();
440+//int tid = get_ptrace_pid (regcache->ptid()); 438+//int tid = get_ptrace_pid (regcache->ptid());
441+#if 1 439+#if 1
442+ if (regno == -1) 440+ if (regno == -1)
443+#endif 441+#endif
444+ fetch_gp_regs (regcache, tid); 442+ fetch_gp_regs (regcache, tid);
445+#if 1 443+#if 1
446+ else 444+ else
447+ fetch_register (regcache, tid, regno); 445+ fetch_register (regcache, tid, regno);
448+#endif 446+#endif
449+} 447+}
450+ 448+
451+ 449+
452+/* Store REGNUM (or all registers if REGNUM == -1) to the target 450+/* Store REGNUM (or all registers if REGNUM == -1) to the target
453+ from REGCACHE using PTRACE_SETREGSET. */ 451+ from REGCACHE using PTRACE_SETREGSET. */
454+ 452+
455+void 453+void
456+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno) 454+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
457+{ 455+{
458+ int tid; 456+ int tid;
459+ 457+
460+ tid = get_ptrace_pid (regcache->ptid ()); 458+ tid = get_ptrace_pid (regcache->ptid ());
461+ 459+
462+ struct gdbarch *gdbarch = regcache->arch (); 460+ struct gdbarch *gdbarch = regcache->arch ();
463+ /* This isn't really an address. But ptrace thinks of it as one. */ 461+ /* This isn't really an address. But ptrace thinks of it as one. */
464+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); 462+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
465+ int i; 463+ int i;
466+ size_t bytes_to_transfer; 464+ size_t bytes_to_transfer;
467+ char buf[MICROBLAZE_MAX_REGISTER_SIZE]; 465+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
468+ 466+
469+ if (regaddr == -1) 467+ if (regaddr == -1)
470+ return; 468+ return;
471+ 469+
472+ /* First collect the register. Keep in mind that the regcache's 470+ /* First collect the register. Keep in mind that the regcache's
473+ * idea of the register's size may not be a multiple of sizeof 471+ * idea of the register's size may not be a multiple of sizeof
474+ * (long). */ 472+ * (long). */
475+ memset (buf, 0, sizeof buf); 473+ memset (buf, 0, sizeof buf);
476+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); 474+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
477+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) 475+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
478+ { 476+ {
479+ /* Little-endian values always sit at the left end of the buffer. */ 477+ /* Little-endian values always sit at the left end of the buffer. */
480+ regcache->raw_collect (regno, buf); 478+ regcache->raw_collect (regno, buf);
481+ } 479+ }
482+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 480+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
483+ { 481+ {
484+ /* Big-endian values sit at the right end of the buffer. */ 482+ /* Big-endian values sit at the right end of the buffer. */
485+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); 483+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
486+ regcache->raw_collect (regno, buf + padding); 484+ regcache->raw_collect (regno, buf + padding);
487+ } 485+ }
488+ 486+
489+ for (i = 0; i < bytes_to_transfer; i += sizeof (long)) 487+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
490+ { 488+ {
491+ long l; 489+ long l;
492+ 490+
493+ memcpy (&l, &buf[i], sizeof (l)); 491+ memcpy (&l, &buf[i], sizeof (l));
494+ errno = 0; 492+ errno = 0;
495+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l); 493+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
496+ regaddr += sizeof (long); 494+ regaddr += sizeof (long);
497+ 495+
498+ if (errno != 0) 496+ if (errno != 0)
499+ { 497+ {
500+ char message[128]; 498+ char message[128];
501+ sprintf (message, "writing register %s (#%d)", 499+ sprintf (message, "writing register %s (#%d)",
502+ gdbarch_register_name (gdbarch, regno), regno); 500+ gdbarch_register_name (gdbarch, regno), regno);
503+ perror_with_name (message); 501+ perror_with_name (message);
504+ } 502+ }
505+ } 503+ }
506+} 504+}
507+ 505+
508+void _initialize_microblaze_linux_nat (void); 506+void _initialize_microblaze_linux_nat (void);
509+ 507+
510+void 508+void
511+_initialize_microblaze_linux_nat (void) 509+_initialize_microblaze_linux_nat (void)
512+{ 510+{
513+ /* Register the target. */ 511+ /* Register the target. */
514+ linux_target = &the_microblaze_linux_nat_target; 512+ linux_target = &the_microblaze_linux_nat_target;
515+ add_inf_child_target (linux_target); 513+ add_inf_child_target (linux_target);
516+} 514+}
517diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 515diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
518index d6197c49dfd..fc52adffb72 100644 516index 17bcb50fd4f..5b57bb4d3ba 100644
519--- a/gdb/microblaze-linux-tdep.c 517--- a/gdb/microblaze-linux-tdep.c
520+++ b/gdb/microblaze-linux-tdep.c 518+++ b/gdb/microblaze-linux-tdep.c
521@@ -37,6 +37,7 @@ 519@@ -37,6 +37,7 @@
@@ -563,7 +561,7 @@ index 00000000000..a2c744e2961
563+ 561+
564+#endif /* MICROBLAZE_LINUX_TDEP_H */ 562+#endif /* MICROBLAZE_LINUX_TDEP_H */
565diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 563diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
566index ccd37d085d6..ccb6b730d64 100644 564index 6ab36bd746b..066602b385a 100644
567--- a/gdb/microblaze-tdep.c 565--- a/gdb/microblaze-tdep.c
568+++ b/gdb/microblaze-tdep.c 566+++ b/gdb/microblaze-tdep.c
569@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, 567@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
@@ -595,7 +593,7 @@ index ccd37d085d6..ccb6b730d64 100644
595 if (ostart_pc > start_pc) 593 if (ostart_pc > start_pc)
596 return ostart_pc; 594 return ostart_pc;
597 return start_pc; 595 return start_pc;
598@@ -453,6 +456,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) 596@@ -453,6 +456,7 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
599 struct microblaze_frame_cache *cache; 597 struct microblaze_frame_cache *cache;
600 struct gdbarch *gdbarch = get_frame_arch (next_frame); 598 struct gdbarch *gdbarch = get_frame_arch (next_frame);
601 int rn; 599 int rn;
@@ -603,7 +601,7 @@ index ccd37d085d6..ccb6b730d64 100644
603 601
604 if (*this_cache) 602 if (*this_cache)
605 return (struct microblaze_frame_cache *) *this_cache; 603 return (struct microblaze_frame_cache *) *this_cache;
606@@ -466,10 +470,17 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) 604@@ -466,10 +470,17 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
607 cache->register_offsets[rn] = -1; 605 cache->register_offsets[rn] = -1;
608 606
609 /* Call for side effects. */ 607 /* Call for side effects. */
@@ -625,7 +623,7 @@ index ccd37d085d6..ccb6b730d64 100644
625 return cache; 623 return cache;
626 } 624 }
627 625
628@@ -494,6 +505,25 @@ microblaze_frame_prev_register (struct frame_info *this_frame, 626@@ -494,6 +505,25 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
629 struct microblaze_frame_cache *cache = 627 struct microblaze_frame_cache *cache =
630 microblaze_frame_cache (this_frame, this_cache); 628 microblaze_frame_cache (this_frame, this_cache);
631 629
@@ -651,7 +649,7 @@ index ccd37d085d6..ccb6b730d64 100644
651 if (cache->frameless_p) 649 if (cache->frameless_p)
652 { 650 {
653 if (regnum == MICROBLAZE_PC_REGNUM) 651 if (regnum == MICROBLAZE_PC_REGNUM)
654@@ -506,7 +536,9 @@ microblaze_frame_prev_register (struct frame_info *this_frame, 652@@ -506,7 +536,9 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
655 else 653 else
656 return trad_frame_get_prev_register (this_frame, cache->saved_regs, 654 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
657 regnum); 655 regnum);
@@ -662,8 +660,8 @@ index ccd37d085d6..ccb6b730d64 100644
662 } 660 }
663 661
664 static const struct frame_unwind microblaze_frame_unwind = 662 static const struct frame_unwind microblaze_frame_unwind =
665@@ -622,7 +654,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) 663@@ -621,7 +653,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
666 return (TYPE_LENGTH (type) == 16); 664 return (type->length () == 16);
667 } 665 }
668 666
669- 667-
@@ -770,7 +768,7 @@ index ccd37d085d6..ccb6b730d64 100644
770 static int dwarf2_to_reg_map[78] = 768 static int dwarf2_to_reg_map[78] =
771 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 769 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
772 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 770 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
773@@ -790,6 +921,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 771@@ -788,6 +919,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
774 microblaze_breakpoint::bp_from_kind); 772 microblaze_breakpoint::bp_from_kind);
775 set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 773 set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
776 774
@@ -780,7 +778,7 @@ index ccd37d085d6..ccb6b730d64 100644
780 778
781 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); 779 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
782diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 780diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
783index 2e853d84d72..2415acfe7b6 100644 781index 738da4f0531..21f206777f0 100644
784--- a/gdb/microblaze-tdep.h 782--- a/gdb/microblaze-tdep.h
785+++ b/gdb/microblaze-tdep.h 783+++ b/gdb/microblaze-tdep.h
786@@ -60,11 +60,11 @@ enum microblaze_regnum 784@@ -60,11 +60,11 @@ enum microblaze_regnum
@@ -832,5 +830,5 @@ index 2e853d84d72..2415acfe7b6 100644
832 int frameless_p; 830 int frameless_p;
833 831
834-- 832--
8352.37.1 (Apple Git-137.1) 8332.34.1
836 834
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
new file mode 100644
index 00000000..3a069fdf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
@@ -0,0 +1,1891 @@
1From 510b596b8cd25ccb3563555190d5396c7b378522 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 06/54] Adding 64 bit MB support Added new architecture to
5 Microblaze 64-bit support to GDB Signed-off-by :Nagaraju Mekala
6 <nmekala@xilix.com> Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com>
7
8Conflicts:
9 gdb/Makefile.in
10
11Conflicts:
12 bfd/cpu-microblaze.c
13 gdb/microblaze-tdep.c
14 ld/Makefile.am
15 ld/Makefile.in
16 opcodes/microblaze-dis.c
17
18Conflicts:
19 bfd/configure
20 gas/config/tc-microblaze.c
21 ld/Makefile.in
22 opcodes/microblaze-opcm.h
23
24Conflicts:
25 gdb/microblaze-tdep.c
26
27Conflicts:
28 bfd/elf32-microblaze.c
29 gas/config/tc-microblaze.c
30 gdb/features/Makefile
31 gdb/features/microblaze-with-stack-protect.c
32 gdb/microblaze-tdep.c
33 gdb/regformats/microblaze-with-stack-protect.dat
34 gdbserver/linux-microblaze-low.c
35 include/elf/common.h
36
37Signed-off-by: Aayush Misra <aayushm@amd.com>
38---
39 bfd/Makefile.am | 2 +
40 bfd/Makefile.in | 3 +
41 bfd/archures.c | 2 +
42 bfd/bfd-in2.h | 31 +++-
43 bfd/config.bfd | 4 +
44 bfd/configure | 2 +
45 bfd/cpu-microblaze.c | 55 +++++-
46 bfd/elf32-microblaze.c | 155 ++++++++++++++--
47 bfd/libbfd.h | 3 +
48 bfd/reloc.c | 20 +++
49 bfd/targets.c | 6 +
50 gdb/features/Makefile | 2 +
51 gdb/features/microblaze-core.xml | 6 +-
52 gdb/features/microblaze-stack-protect.xml | 4 +-
53 gdb/features/microblaze-with-stack-protect.c | 8 +-
54 gdb/features/microblaze.c | 6 +-
55 gdb/features/microblaze64-core.xml | 69 ++++++++
56 gdb/features/microblaze64-stack-protect.xml | 12 ++
57 .../microblaze64-with-stack-protect.c | 79 +++++++++
58 .../microblaze64-with-stack-protect.xml | 12 ++
59 gdb/features/microblaze64.c | 77 ++++++++
60 gdb/features/microblaze64.xml | 11 ++
61 gdb/microblaze-linux-tdep.c | 36 +++-
62 gdb/microblaze-tdep.c | 125 +++++++++----
63 gdb/microblaze-tdep.h | 4 +-
64 include/elf/common.h | 1 +
65 include/elf/microblaze.h | 4 +
66 opcodes/microblaze-dis.c | 51 +++++-
67 opcodes/microblaze-opc.h | 165 +++++++++++++++++-
68 opcodes/microblaze-opcm.h | 28 ++-
69 30 files changed, 896 insertions(+), 87 deletions(-)
70 create mode 100644 gdb/features/microblaze64-core.xml
71 create mode 100644 gdb/features/microblaze64-stack-protect.xml
72 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
73 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
74 create mode 100644 gdb/features/microblaze64.c
75 create mode 100644 gdb/features/microblaze64.xml
76
77diff --git a/bfd/Makefile.am b/bfd/Makefile.am
78index 378c13198d6..089d86b6191 100644
79--- a/bfd/Makefile.am
80+++ b/bfd/Makefile.am
81@@ -568,6 +568,7 @@ BFD64_BACKENDS = \
82 elf64-ppc.lo \
83 elf64-riscv.lo \
84 elf64-s390.lo \
85+ elf64-microblaze.lo \
86 elf64-sparc.lo \
87 elf64-tilegx.lo \
88 elf64-x86-64.lo \
89@@ -615,6 +616,7 @@ BFD64_BACKENDS_CFILES = \
90 elf64-nfp.c \
91 elf64-ppc.c \
92 elf64-s390.c \
93+ elf64-microblaze.c \
94 elf64-sparc.c \
95 elf64-tilegx.c \
96 elf64-x86-64.c \
97diff --git a/bfd/Makefile.in b/bfd/Makefile.in
98index 8d09f6fa4af..d9fe20f502b 100644
99--- a/bfd/Makefile.in
100+++ b/bfd/Makefile.in
101@@ -1025,6 +1025,7 @@ BFD64_BACKENDS = \
102 elf64-ppc.lo \
103 elf64-riscv.lo \
104 elf64-s390.lo \
105+ elf64-microblaze.lo \
106 elf64-sparc.lo \
107 elf64-tilegx.lo \
108 elf64-x86-64.lo \
109@@ -1072,6 +1073,7 @@ BFD64_BACKENDS_CFILES = \
110 elf64-nfp.c \
111 elf64-ppc.c \
112 elf64-s390.c \
113+ elf64-microblaze.c \
114 elf64-sparc.c \
115 elf64-tilegx.c \
116 elf64-x86-64.c \
117@@ -1646,6 +1648,7 @@ distclean-compile:
118 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
119 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
120 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
121+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
122 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
125diff --git a/bfd/archures.c b/bfd/archures.c
126index b59979e60ac..2994a09bc37 100644
127--- a/bfd/archures.c
128+++ b/bfd/archures.c
129@@ -515,6 +515,8 @@ DESCRIPTION
130 . bfd_arch_lm32, {* Lattice Mico32. *}
131 .#define bfd_mach_lm32 1
132 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
133+.#define bfd_mach_microblaze 1
134+.#define bfd_mach_microblaze64 2
135 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
136 .#define bfd_mach_kv3_unknown 0
137 .#define bfd_mach_kv3_1 1
138diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
139index eddb9902f5e..9db63f254a3 100644
140--- a/bfd/bfd-in2.h
141+++ b/bfd/bfd-in2.h
142@@ -1771,6 +1771,8 @@ enum bfd_architecture
143 bfd_arch_lm32, /* Lattice Mico32. */
144 #define bfd_mach_lm32 1
145 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
146+#define bfd_mach_microblaze 1
147+#define bfd_mach_microblaze64 2
148 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
149 #define bfd_mach_kv3_unknown 0
150 #define bfd_mach_kv3_1 1
151@@ -6461,16 +6463,41 @@ value relative to the read-write small data area anchor */
152 expressions of the form "Symbol Op Symbol" */
153 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
154
155-/* This is a 64 bit reloc that stores the 32 bit pc relative
156+/* This is a 32 bit reloc that stores the 32 bit pc relative
157 value in two words (with an imm instruction). No relocation is
158 done here - only used for relaxing */
159- BFD_RELOC_MICROBLAZE_64_NONE,
160+ BFD_RELOC_MICROBLAZE_32_NONE,
161+
162+/* This is a 64 bit reloc that stores the 32 bit pc relative
163+ * +value in two words (with an imml instruction). No relocation is
164+ * +done here - only used for relaxing */
165+ BFD_RELOC_MICROBLAZE_64_PCREL,
166+
167+/* This is a 64 bit reloc that stores the 32 bit relative
168+ * +value in two words (with an imml instruction). No relocation is
169+ * +done here - only used for relaxing */
170+ BFD_RELOC_MICROBLAZE_64,
171+
172+/* This is a 64 bit reloc that stores the 32 bit relative
173+ * +value in two words (with an imml instruction). No relocation is
174+ * +done here - only used for relaxing */
175+ BFD_RELOC_MICROBLAZE_EA64,
176+
177+/* This is a 64 bit reloc that stores the 32 bit pc relative
178+ * +value in two words (with an imm instruction). No relocation is
179+ * +done here - only used for relaxing */
180+ BFD_RELOC_MICROBLAZE_64_NONE,
181
182 /* This is a 64 bit reloc that stores the 32 bit pc relative
183 value in two words (with an imm instruction). The relocation is
184 PC-relative GOT offset */
185 BFD_RELOC_MICROBLAZE_64_GOTPC,
186
187+/* This is a 64 bit reloc that stores the 32 bit pc relative
188+value in two words (with an imml instruction). The relocation is
189+PC-relative GOT offset */
190+ BFD_RELOC_MICROBLAZE_64_GPC,
191+
192 /* This is a 64 bit reloc that stores the 32 bit pc relative
193 value in two words (with an imm instruction). The relocation is
194 GOT offset */
195diff --git a/bfd/config.bfd b/bfd/config.bfd
196index 08129e6a8cb..3a7d427778c 100644
197--- a/bfd/config.bfd
198+++ b/bfd/config.bfd
199@@ -884,11 +884,15 @@ case "${targ}" in
200 microblazeel*-*)
201 targ_defvec=microblaze_elf32_le_vec
202 targ_selvecs=microblaze_elf32_vec
203+ targ64_selvecs=microblaze_elf64_vec
204+ targ64_selvecs=microblaze_elf64_le_vec
205 ;;
206
207 microblaze*-*)
208 targ_defvec=microblaze_elf32_vec
209 targ_selvecs=microblaze_elf32_le_vec
210+ targ64_selvecs=microblaze_elf64_vec
211+ targ64_selvecs=microblaze_elf64_le_vec
212 ;;
213
214 #ifdef BFD64
215diff --git a/bfd/configure b/bfd/configure
216index f0a07ff675f..b2afdcf9bec 100755
217--- a/bfd/configure
218+++ b/bfd/configure
219@@ -14062,6 +14062,8 @@ do
220 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
221 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
222 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
223+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
224+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
225 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
226 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
227 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
228diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
229index c14b170f94b..7557b3de7b3 100644
230--- a/bfd/cpu-microblaze.c
231+++ b/bfd/cpu-microblaze.c
232@@ -23,13 +23,30 @@
233 #include "bfd.h"
234 #include "libbfd.h"
235
236-const bfd_arch_info_type bfd_microblaze_arch =
237+const bfd_arch_info_type bfd_microblaze_arch[] =
238+{
239+#if BFD_DEFAULT_TARGET_SIZE == 64
240+{
241+ 64, /* 32 bits in a word. */
242+ 64, /* 32 bits in an address. */
243+ 8, /* 8 bits in a byte. */
244+ bfd_arch_microblaze, /* Architecture. */
245+ bfd_mach_microblaze64, /* 64 bit Machine */
246+ "microblaze", /* Architecture name. */
247+ "MicroBlaze", /* Printable name. */
248+ 3, /* Section align power. */
249+ false, /* Is this the default architecture ? */
250+ bfd_default_compatible, /* Architecture comparison function. */
251+ bfd_default_scan, /* String to architecture conversion. */
252+ bfd_arch_default_fill, /* Default fill. */
253+ &bfd_microblaze_arch[1] /* Next in list. */
254+},
255 {
256 32, /* Bits in a word. */
257 32, /* Bits in an address. */
258 8, /* Bits in a byte. */
259 bfd_arch_microblaze, /* Architecture number. */
260- 0, /* Machine number - 0 for now. */
261+ bfd_mach_microblaze, /* Machine number - 0 for now. */
262 "microblaze", /* Architecture name. */
263 "MicroBlaze", /* Printable name. */
264 3, /* Section align power. */
265@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
266 bfd_arch_default_fill, /* Default fill. */
267 NULL, /* Next in list. */
268 0 /* Maximum offset of a reloc from the start of an insn. */
269+}
270+#else
271+{
272+ 32, /* 32 bits in a word. */
273+ 32, /* 32 bits in an address. */
274+ 8, /* 8 bits in a byte. */
275+ bfd_arch_microblaze, /* Architecture. */
276+ bfd_mach_microblaze, /* 32 bit Machine */
277+ "microblaze", /* Architecture name. */
278+ "MicroBlaze", /* Printable name. */
279+ 3, /* Section align power. */
280+ true, /* Is this the default architecture ? */
281+ bfd_default_compatible, /* Architecture comparison function. */
282+ bfd_default_scan, /* String to architecture conversion. */
283+ bfd_arch_default_fill, /* Default fill. */
284+ &bfd_microblaze_arch[1] /* Next in list. */
285+},
286+{
287+ 64, /* 32 bits in a word. */
288+ 64, /* 32 bits in an address. */
289+ 8, /* 8 bits in a byte. */
290+ bfd_arch_microblaze, /* Architecture. */
291+ bfd_mach_microblaze64, /* 64 bit Machine */
292+ "microblaze", /* Architecture name. */
293+ "MicroBlaze", /* Printable name. */
294+ 3, /* Section align power. */
295+ false, /* Is this the default architecture ? */
296+ bfd_default_compatible, /* Architecture comparison function. */
297+ bfd_default_scan, /* String to architecture conversion. */
298+ bfd_arch_default_fill, /* Default fill. */
299+ NULL, /* Next in list. */
300+ 0
301+}
302+#endif
303 };
304diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
305index 487ddeafc5a..6ba28e757be 100644
306--- a/bfd/elf32-microblaze.c
307+++ b/bfd/elf32-microblaze.c
308@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
309 0x0000ffff, /* Dest Mask. */
310 true), /* PC relative offset? */
311
312+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
313+ 0, /* Rightshift. */
314+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
315+ 16, /* Bitsize. */
316+ true, /* PC_relative. */
317+ 0, /* Bitpos. */
318+ complain_overflow_dont, /* Complain on overflow. */
319+ bfd_elf_generic_reloc,/* Special Function. */
320+ "R_MICROBLAZE_IMML_64", /* Name. */
321+ false, /* Partial Inplace. */
322+ 0, /* Source Mask. */
323+ 0x0000ffff, /* Dest Mask. */
324+ false), /* PC relative offset? */
325+
326 /* A 64 bit relocation. Table entry not really used. */
327 HOWTO (R_MICROBLAZE_64, /* Type. */
328 0, /* Rightshift. */
329@@ -174,7 +188,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
330 0x0000ffff, /* Dest Mask. */
331 false), /* PC relative offset? */
332
333- /* This reloc does nothing. Used for relaxation. */
334+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
335+ 0, /* Rightshift. */
336+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
337+ 32, /* Bitsize. */
338+ true, /* PC_relative. */
339+ 0, /* Bitpos. */
340+ complain_overflow_bitfield, /* Complain on overflow. */
341+ NULL, /* Special Function. */
342+ "R_MICROBLAZE_32_NONE",/* Name. */
343+ false, /* Partial Inplace. */
344+ 0, /* Source Mask. */
345+ 0, /* Dest Mask. */
346+ false), /* PC relative offset? */
347+
348+ /* This reloc does nothing. Used for relaxation. */
349 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
350 0, /* Rightshift. */
351 0, /* Size. */
352@@ -264,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
353 0x0000ffff, /* Dest Mask. */
354 true), /* PC relative offset? */
355
356+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
357+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
358+ 0, /* Rightshift. */
359+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
360+ 16, /* Bitsize. */
361+ true, /* PC_relative. */
362+ 0, /* Bitpos. */
363+ complain_overflow_dont, /* Complain on overflow. */
364+ bfd_elf_generic_reloc, /* Special Function. */
365+ "R_MICROBLAZE_GPC_64", /* Name. */
366+ false, /* Partial Inplace. */
367+ 0, /* Source Mask. */
368+ 0x0000ffff, /* Dest Mask. */
369+ true), /* PC relative offset? */
370+
371 /* A 64 bit GOT relocation. Table-entry not really used. */
372 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
373 0, /* Rightshift. */
374@@ -560,6 +603,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
375 case BFD_RELOC_NONE:
376 microblaze_reloc = R_MICROBLAZE_NONE;
377 break;
378+ case BFD_RELOC_MICROBLAZE_32_NONE:
379+ microblaze_reloc = R_MICROBLAZE_32_NONE;
380+ break;
381 case BFD_RELOC_MICROBLAZE_64_NONE:
382 microblaze_reloc = R_MICROBLAZE_64_NONE;
383 break;
384@@ -600,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
385 case BFD_RELOC_VTABLE_ENTRY:
386 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
387 break;
388+ case BFD_RELOC_MICROBLAZE_64:
389+ microblaze_reloc = R_MICROBLAZE_IMML_64;
390+ break;
391 case BFD_RELOC_MICROBLAZE_64_GOTPC:
392 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
393 break;
394+ case BFD_RELOC_MICROBLAZE_64_GPC:
395+ microblaze_reloc = R_MICROBLAZE_GPC_64;
396+ break;
397 case BFD_RELOC_MICROBLAZE_64_GOT:
398 microblaze_reloc = R_MICROBLAZE_GOT_64;
399 break;
400@@ -1564,7 +1616,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
401 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
402 {
403 relocation += addend;
404- if (r_type == R_MICROBLAZE_32)
405+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
406 bfd_put_32 (input_bfd, relocation, contents + offset);
407 else
408 {
409@@ -1969,8 +2021,7 @@ microblaze_elf_relax_section (bfd *abfd,
410 else
411 symval += irel->r_addend;
412
413- if ((symval & 0xffff8000) == 0
414- || (symval & 0xffff8000) == 0xffff8000)
415+ if ((symval & 0xffff8000) == 0)
416 {
417 /* We can delete this instruction. */
418 sdata->relax[sdata->relax_count].addr = irel->r_offset;
419@@ -2034,15 +2085,44 @@ microblaze_elf_relax_section (bfd *abfd,
420 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
421 }
422 break;
423- case R_MICROBLAZE_NONE:
424+ case R_MICROBLAZE_IMML_64:
425+ {
426+ /* This was a PC-relative instruction that was
427+ completely resolved. */
428+ int sfix, efix;
429+ unsigned int val;
430+ bfd_vma target_address;
431+ target_address = irel->r_addend + irel->r_offset;
432+ sfix = calc_fixup (irel->r_offset, 0, sec);
433+ efix = calc_fixup (target_address, 0, sec);
434+
435+ /* Validate the in-band val. */
436+ val = bfd_get_32 (abfd, contents + irel->r_offset);
437+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
438+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
439+ }
440+ irel->r_addend -= (efix - sfix);
441+ /* Should use HOWTO. */
442+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
443+ irel->r_addend);
444+ }
445+ break;
446+ case R_MICROBLAZE_32_NONE:
447 {
448 /* This was a PC-relative instruction that was
449 completely resolved. */
450 size_t sfix, efix;
451+ unsigned int val;
452 bfd_vma target_address;
453 target_address = irel->r_addend + irel->r_offset;
454 sfix = calc_fixup (irel->r_offset, 0, sec);
455 efix = calc_fixup (target_address, 0, sec);
456+
457+ /* Validate the in-band val. */
458+ val = bfd_get_32 (abfd, contents + irel->r_offset);
459+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
460+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
461+ }
462 irel->r_addend -= (efix - sfix);
463 /* Should use HOWTO. */
464 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
465@@ -2059,8 +2139,8 @@ microblaze_elf_relax_section (bfd *abfd,
466 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
467 efix = calc_fixup (target_address, 0, sec);
468 irel->r_addend -= (efix - sfix);
469- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
470- + INST_WORD_SIZE, irel->r_addend);
471+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
472+ irel->r_addend);
473 }
474 break;
475 }
476@@ -2090,9 +2170,50 @@ microblaze_elf_relax_section (bfd *abfd,
477 irelscanend = irelocs + o->reloc_count;
478 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
479 {
480- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
481- {
482- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
483+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
484+ {
485+ unsigned int val;
486+
487+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
488+
489+ /* hax: We only do the following fixup for debug location lists. */
490+ if (strcmp(".debug_loc", o->name))
491+ continue;
492+
493+ /* This was a PC-relative instruction that was completely resolved. */
494+ if (ocontents == NULL)
495+ {
496+ if (elf_section_data (o)->this_hdr.contents != NULL)
497+ ocontents = elf_section_data (o)->this_hdr.contents;
498+ else
499+ {
500+ /* We always cache the section contents.
501+ Perhaps, if info->keep_memory is FALSE, we
502+ should free them, if we are permitted to. */
503+
504+ if (o->rawsize == 0)
505+ o->rawsize = o->size;
506+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
507+ if (ocontents == NULL)
508+ goto error_return;
509+ if (!bfd_get_section_contents (abfd, o, ocontents,
510+ (file_ptr) 0,
511+ o->rawsize))
512+ goto error_return;
513+ elf_section_data (o)->this_hdr.contents = ocontents;
514+ }
515+ }
516+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
517+ if (val != irelscan->r_addend) {
518+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
519+ }
520+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
521+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
522+ irelscan->r_addend);
523+ }
524+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
525+ {
526+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
527
528 /* Look at the reloc only if the value has been resolved. */
529 if (isym->st_shndx == shndx
530@@ -2149,7 +2270,7 @@ microblaze_elf_relax_section (bfd *abfd,
531 elf_section_data (o)->this_hdr.contents = ocontents;
532 }
533 }
534- irelscan->r_addend -= calc_fixup (irel->r_addend
535+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
536 + isym->st_value,
537 0,
538 sec);
539@@ -3490,6 +3611,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
540 return true;
541 }
542
543+
544+static bool
545+elf_microblaze_object_p (bfd *abfd)
546+{
547+ /* Set the right machine number for an s390 elf32 file. */
548+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
549+}
550+
551 /* Hook called by the linker routine which adds symbols from an object
552 file. We use it to put .comm items in .sbss, and not .bss. */
553
554@@ -3560,8 +3689,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
555 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
556 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
557 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
558-
559-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
560-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
561+#define elf_backend_object_p elf_microblaze_object_p
562
563 #include "elf32-target.h"
564diff --git a/bfd/libbfd.h b/bfd/libbfd.h
565index d5f42f22c08..b0e898bf815 100644
566--- a/bfd/libbfd.h
567+++ b/bfd/libbfd.h
568@@ -3010,6 +3010,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
569 "BFD_RELOC_MICROBLAZE_32_ROSDA",
570 "BFD_RELOC_MICROBLAZE_32_RWSDA",
571 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
572+ "BFD_RELOC_MICROBLAZE_32_NONE",
573 "BFD_RELOC_MICROBLAZE_64_NONE",
574 "BFD_RELOC_MICROBLAZE_64_GOTPC",
575 "BFD_RELOC_MICROBLAZE_64_GOT",
576@@ -3017,6 +3018,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
577 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
578 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
579 "BFD_RELOC_MICROBLAZE_COPY",
580+ "BFD_RELOC_MICROBLAZE_64",
581+ "BFD_RELOC_MICROBLAZE_64_PCREL",
582 "BFD_RELOC_MICROBLAZE_64_TLS",
583 "BFD_RELOC_MICROBLAZE_64_TLSGD",
584 "BFD_RELOC_MICROBLAZE_64_TLSLD",
585diff --git a/bfd/reloc.c b/bfd/reloc.c
586index 2ac883d0eac..278876e765e 100644
587--- a/bfd/reloc.c
588+++ b/bfd/reloc.c
589@@ -6694,6 +6694,12 @@ ENUM
590 ENUMDOC
591 This is a 32 bit reloc for the microblaze to handle
592 expressions of the form "Symbol Op Symbol"
593+ENUM
594+ BFD_RELOC_MICROBLAZE_32_NONE
595+ENUMDOC
596+ This is a 32 bit reloc that stores the 32 bit pc relative
597+ value in two words (with an imm instruction). No relocation is
598+ done here - only used for relaxing
599 ENUM
600 BFD_RELOC_MICROBLAZE_64_NONE
601 ENUMDOC
602@@ -7933,6 +7939,20 @@ ENUMX
603 ENUMDOC
604 Tilera TILE-Gx Relocations.
605
606+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
607+ to two words (uses imml instruction).
608+ENUM
609+BFD_RELOC_MICROBLAZE_64,
610+ENUMDOC
611+ This is a 64 bit reloc that stores the 64 bit pc relative
612+ value in two words (with an imml instruction). No relocation is
613+ done here - only used for relaxing
614+ENUM
615+BFD_RELOC_MICROBLAZE_64_PCREL,
616+ENUMDOC
617+ This is a 32 bit reloc that stores the 32 bit pc relative
618+ value in two words (with an imml instruction). No relocation is
619+ done here - only used for relaxing
620 ENUM
621 BFD_RELOC_BPF_64
622 ENUMX
623diff --git a/bfd/targets.c b/bfd/targets.c
624index 63b3abbd287..c48c0929157 100644
625--- a/bfd/targets.c
626+++ b/bfd/targets.c
627@@ -799,6 +799,8 @@ extern const bfd_target mep_elf32_le_vec;
628 extern const bfd_target metag_elf32_vec;
629 extern const bfd_target microblaze_elf32_vec;
630 extern const bfd_target microblaze_elf32_le_vec;
631+extern const bfd_target microblaze_elf64_vec;
632+extern const bfd_target microblaze_elf64_le_vec;
633 extern const bfd_target mips_ecoff_be_vec;
634 extern const bfd_target mips_ecoff_le_vec;
635 extern const bfd_target mips_ecoff_bele_vec;
636@@ -1166,6 +1168,10 @@ static const bfd_target * const _bfd_target_vector[] =
637
638 &metag_elf32_vec,
639
640+#ifdef BFD64
641+ &microblaze_elf64_vec,
642+ &microblaze_elf64_le_vec,
643+#endif
644 &microblaze_elf32_vec,
645
646 &mips_ecoff_be_vec,
647diff --git a/gdb/features/Makefile b/gdb/features/Makefile
648index 0af9d67c2f7..ee053b7557c 100644
649--- a/gdb/features/Makefile
650+++ b/gdb/features/Makefile
651@@ -102,7 +102,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
652 # to make on the command line.
653 XMLTOC = \
654 microblaze-with-stack-protect.xml \
655+ microblaze64-with-stack-protect.xml \
656 microblaze.xml \
657+ microblaze64.xml \
658 mips-dsp-linux.xml \
659 mips-linux.xml \
660 mips64-dsp-linux.xml \
661diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
662index d49aa075bae..ac052365773 100644
663--- a/gdb/features/microblaze-core.xml
664+++ b/gdb/features/microblaze-core.xml
665@@ -8,7 +8,7 @@
666 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
667 <feature name="org.gnu.gdb.microblaze.core">
668 <reg name="r0" bitsize="32" regnum="0"/>
669- <reg name="r1" bitsize="32" type="data_ptr"/>
670+ <reg name="r1" bitsize="32"/>
671 <reg name="r2" bitsize="32"/>
672 <reg name="r3" bitsize="32"/>
673 <reg name="r4" bitsize="32"/>
674@@ -39,7 +39,7 @@
675 <reg name="r29" bitsize="32"/>
676 <reg name="r30" bitsize="32"/>
677 <reg name="r31" bitsize="32"/>
678- <reg name="rpc" bitsize="32" type="code_ptr"/>
679+ <reg name="rpc" bitsize="32"/>
680 <reg name="rmsr" bitsize="32"/>
681 <reg name="rear" bitsize="32"/>
682 <reg name="resr" bitsize="32"/>
683@@ -64,4 +64,6 @@
684 <reg name="rtlbsx" bitsize="32"/>
685 <reg name="rtlblo" bitsize="32"/>
686 <reg name="rtlbhi" bitsize="32"/>
687+ <reg name="slr" bitsize="32"/>
688+ <reg name="shr" bitsize="32"/>
689 </feature>
690diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
691index a5ffe2e50b1..b15369e03a4 100644
692--- a/gdb/features/microblaze-stack-protect.xml
693+++ b/gdb/features/microblaze-stack-protect.xml
694@@ -7,6 +7,6 @@
695
696 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
697 <feature name="org.gnu.gdb.microblaze.stack-protect">
698- <reg name="rslr" bitsize="32"/>
699- <reg name="rshr" bitsize="32"/>
700+ <reg name="slr" bitsize="32"/>
701+ <reg name="shr" bitsize="32"/>
702 </feature>
703diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
704index 574dc02db67..8ab9565a047 100644
705--- a/gdb/features/microblaze-with-stack-protect.c
706+++ b/gdb/features/microblaze-with-stack-protect.c
707@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
708
709 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
710 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
711- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
712+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
713 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
714 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
715 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
716@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
717 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
718 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
719 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
720- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
721+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
722 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
723 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
724 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
725@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
726 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
727
728 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
729- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
730- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
731+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
732+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
733
734 tdesc_microblaze_with_stack_protect = result.release ();
735 }
736diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
737index 8f1fb0a142f..ed12e5bcfd2 100644
738--- a/gdb/features/microblaze.c
739+++ b/gdb/features/microblaze.c
740@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
741
742 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
743 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
744- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
745+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
746 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
747 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
748 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
749@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
750 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
751 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
752 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
753- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
754+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
755 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
756 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
757 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
758@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
759 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
760 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
761 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
762+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
763+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
764
765 tdesc_microblaze = result.release ();
766 }
767diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
768new file mode 100644
769index 00000000000..96e99e2fb24
770--- /dev/null
771+++ b/gdb/features/microblaze64-core.xml
772@@ -0,0 +1,69 @@
773+<?xml version="1.0"?>
774+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
775+
776+ Copying and distribution of this file, with or without modification,
777+ are permitted in any medium without royalty provided the copyright
778+ notice and this notice are preserved. -->
779+
780+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
781+<feature name="org.gnu.gdb.microblaze64.core">
782+ <reg name="r0" bitsize="64" regnum="0"/>
783+ <reg name="r1" bitsize="64"/>
784+ <reg name="r2" bitsize="64"/>
785+ <reg name="r3" bitsize="64"/>
786+ <reg name="r4" bitsize="64"/>
787+ <reg name="r5" bitsize="64"/>
788+ <reg name="r6" bitsize="64"/>
789+ <reg name="r7" bitsize="64"/>
790+ <reg name="r8" bitsize="64"/>
791+ <reg name="r9" bitsize="64"/>
792+ <reg name="r10" bitsize="64"/>
793+ <reg name="r11" bitsize="64"/>
794+ <reg name="r12" bitsize="64"/>
795+ <reg name="r13" bitsize="64"/>
796+ <reg name="r14" bitsize="64"/>
797+ <reg name="r15" bitsize="64"/>
798+ <reg name="r16" bitsize="64"/>
799+ <reg name="r17" bitsize="64"/>
800+ <reg name="r18" bitsize="64"/>
801+ <reg name="r19" bitsize="64"/>
802+ <reg name="r20" bitsize="64"/>
803+ <reg name="r21" bitsize="64"/>
804+ <reg name="r22" bitsize="64"/>
805+ <reg name="r23" bitsize="64"/>
806+ <reg name="r24" bitsize="64"/>
807+ <reg name="r25" bitsize="64"/>
808+ <reg name="r26" bitsize="64"/>
809+ <reg name="r27" bitsize="64"/>
810+ <reg name="r28" bitsize="64"/>
811+ <reg name="r29" bitsize="64"/>
812+ <reg name="r30" bitsize="64"/>
813+ <reg name="r31" bitsize="64"/>
814+ <reg name="rpc" bitsize="64"/>
815+ <reg name="rmsr" bitsize="32"/>
816+ <reg name="rear" bitsize="64"/>
817+ <reg name="resr" bitsize="32"/>
818+ <reg name="rfsr" bitsize="32"/>
819+ <reg name="rbtr" bitsize="64"/>
820+ <reg name="rpvr0" bitsize="32"/>
821+ <reg name="rpvr1" bitsize="32"/>
822+ <reg name="rpvr2" bitsize="32"/>
823+ <reg name="rpvr3" bitsize="32"/>
824+ <reg name="rpvr4" bitsize="32"/>
825+ <reg name="rpvr5" bitsize="32"/>
826+ <reg name="rpvr6" bitsize="32"/>
827+ <reg name="rpvr7" bitsize="32"/>
828+ <reg name="rpvr8" bitsize="64"/>
829+ <reg name="rpvr9" bitsize="64"/>
830+ <reg name="rpvr10" bitsize="32"/>
831+ <reg name="rpvr11" bitsize="32"/>
832+ <reg name="redr" bitsize="32"/>
833+ <reg name="rpid" bitsize="32"/>
834+ <reg name="rzpr" bitsize="32"/>
835+ <reg name="rtlbx" bitsize="32"/>
836+ <reg name="rtlbsx" bitsize="32"/>
837+ <reg name="rtlblo" bitsize="32"/>
838+ <reg name="rtlbhi" bitsize="32"/>
839+ <reg name="slr" bitsize="64"/>
840+ <reg name="shr" bitsize="64"/>
841+</feature>
842diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
843new file mode 100644
844index 00000000000..1bbf5fc3cea
845--- /dev/null
846+++ b/gdb/features/microblaze64-stack-protect.xml
847@@ -0,0 +1,12 @@
848+<?xml version="1.0"?>
849+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
850+
851+ Copying and distribution of this file, with or without modification,
852+ are permitted in any medium without royalty provided the copyright
853+ notice and this notice are preserved. -->
854+
855+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
856+<feature name="org.gnu.gdb.microblaze64.stack-protect">
857+ <reg name="slr" bitsize="64"/>
858+ <reg name="shr" bitsize="64"/>
859+</feature>
860diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
861new file mode 100644
862index 00000000000..a4de4666c76
863--- /dev/null
864+++ b/gdb/features/microblaze64-with-stack-protect.c
865@@ -0,0 +1,79 @@
866+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
867+ Original: microblaze-with-stack-protect.xml */
868+
869+#include "defs.h"
870+#include "osabi.h"
871+#include "target-descriptions.h"
872+
873+struct target_desc *tdesc_microblaze64_with_stack_protect;
874+static void
875+initialize_tdesc_microblaze64_with_stack_protect (void)
876+{
877+ target_desc_up result = allocate_target_description ();
878+ struct tdesc_feature *feature;
879+
880+ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core");
881+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
882+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
883+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
884+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
885+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
886+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
887+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
888+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
889+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
890+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
891+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
892+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
893+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
894+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
895+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
896+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
897+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
898+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
899+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
900+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
901+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
902+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
903+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
904+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
905+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
906+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
907+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
908+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
909+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
910+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
911+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
912+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
913+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
914+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
915+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
916+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
917+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
918+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
919+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
920+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
921+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
922+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
923+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
924+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
925+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
926+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
927+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
928+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
929+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
930+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
931+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
932+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
933+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
934+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
935+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
936+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
937+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
938+
939+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect");
940+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
941+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
942+
943+ tdesc_microblaze64_with_stack_protect = result.release();
944+}
945diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
946new file mode 100644
947index 00000000000..0e9f01611f3
948--- /dev/null
949+++ b/gdb/features/microblaze64-with-stack-protect.xml
950@@ -0,0 +1,12 @@
951+<?xml version="1.0"?>
952+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
953+
954+ Copying and distribution of this file, with or without modification,
955+ are permitted in any medium without royalty provided the copyright
956+ notice and this notice are preserved. -->
957+
958+<!DOCTYPE target SYSTEM "gdb-target.dtd">
959+<target>
960+ <xi:include href="microblaze64-core.xml"/>
961+ <xi:include href="microblaze64-stack-protect.xml"/>
962+</target>
963diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
964new file mode 100644
965index 00000000000..8ab7a90dd95
966--- /dev/null
967+++ b/gdb/features/microblaze64.c
968@@ -0,0 +1,77 @@
969+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
970+ Original: microblaze.xml */
971+
972+#include "defs.h"
973+#include "osabi.h"
974+#include "target-descriptions.h"
975+
976+struct target_desc *tdesc_microblaze64;
977+static void
978+initialize_tdesc_microblaze64 (void)
979+{
980+ target_desc_up result = allocate_target_description ();
981+ struct tdesc_feature *feature;
982+
983+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core");
984+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
985+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
986+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
987+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
988+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
989+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
990+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
991+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
992+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
993+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
994+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
995+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
996+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
997+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
998+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
999+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
1000+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
1001+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
1002+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
1003+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
1004+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
1005+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
1006+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
1007+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
1008+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
1009+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
1010+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
1011+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
1012+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
1013+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
1014+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
1015+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
1016+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
1017+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
1018+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
1019+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
1020+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
1021+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
1022+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
1023+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
1024+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
1025+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
1026+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
1027+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
1028+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
1029+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
1030+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
1031+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
1032+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
1033+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
1034+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
1035+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
1036+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
1037+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
1038+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
1039+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
1040+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
1041+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
1042+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
1043+
1044+ tdesc_microblaze64 = result.release();
1045+}
1046diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
1047new file mode 100644
1048index 00000000000..515d18e65cf
1049--- /dev/null
1050+++ b/gdb/features/microblaze64.xml
1051@@ -0,0 +1,11 @@
1052+<?xml version="1.0"?>
1053+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
1054+
1055+ Copying and distribution of this file, with or without modification,
1056+ are permitted in any medium without royalty provided the copyright
1057+ notice and this notice are preserved. -->
1058+
1059+<!DOCTYPE target SYSTEM "gdb-target.dtd">
1060+<target>
1061+ <xi:include href="microblaze64-core.xml"/>
1062+</target>
1063diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
1064index 5b57bb4d3ba..39592a43f7c 100644
1065--- a/gdb/microblaze-linux-tdep.c
1066+++ b/gdb/microblaze-linux-tdep.c
1067@@ -40,6 +40,7 @@
1068 #include "features/microblaze-linux.c"
1069
1070 static int microblaze_debug_flag = 0;
1071+int MICROBLAZE_REGISTER_SIZE=4;
1072
1073 static void
1074 microblaze_debug (const char *fmt, ...)
1075@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...)
1076 }
1077 }
1078
1079+#if 0
1080 static int
1081 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1082 struct bp_target_info *bp_tgt)
1083@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1084 return val;
1085 }
1086
1087+#endif
1088+
1089 static void
1090 microblaze_linux_sigtramp_cache (frame_info_ptr next_frame,
1091 struct trad_frame_cache *this_cache,
1092@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1093
1094 linux_init_abi (info, gdbarch, 0);
1095
1096- set_gdbarch_memory_remove_breakpoint (gdbarch,
1097- microblaze_linux_memory_remove_breakpoint);
1098+ // set_gdbarch_memory_remove_breakpoint (gdbarch,
1099+ // microblaze_linux_memory_remove_breakpoint);
1100
1101 /* Shared library handling. */
1102 set_solib_svr4_fetch_link_map_offsets (gdbarch,
1103@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1104
1105 /* BFD target for core files. */
1106 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
1107- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1108+ {
1109+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1110+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
1111+ MICROBLAZE_REGISTER_SIZE=8;
1112+ }
1113+ else
1114+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1115+ }
1116 else
1117- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1118+ {
1119+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1120+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
1121+ MICROBLAZE_REGISTER_SIZE=8;
1122+ }
1123+ else
1124+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1125+ }
1126
1127+ switch (info.bfd_arch_info->mach)
1128+ {
1129+ case bfd_mach_microblaze64:
1130+ set_gdbarch_ptr_bit (gdbarch, 64);
1131+ break;
1132+ }
1133
1134 /* Shared library handling. */
1135 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
1136@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep ();
1137 void
1138 _initialize_microblaze_linux_tdep ()
1139 {
1140- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
1141+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
1142+ microblaze_linux_init_abi);
1143+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
1144 microblaze_linux_init_abi);
1145 initialize_tdesc_microblaze_linux ();
1146 }
1147diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
1148index 066602b385a..9450882e850 100644
1149--- a/gdb/microblaze-tdep.c
1150+++ b/gdb/microblaze-tdep.c
1151@@ -40,7 +40,9 @@
1152 #include "remote.h"
1153
1154 #include "features/microblaze-with-stack-protect.c"
1155+#include "features/microblaze64-with-stack-protect.c"
1156 #include "features/microblaze.c"
1157+#include "features/microblaze64.c"
1158
1159 /* Instruction macros used for analyzing the prologue. */
1160 /* This set of instruction macros need to be changed whenever the
1161@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] =
1162 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
1163 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
1164 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
1165- "rslr", "rshr"
1166+ "slr", "shr"
1167 };
1168
1169 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
1170
1171 static unsigned int microblaze_debug_flag = 0;
1172+int reg_size = 4;
1173
1174 #define microblaze_debug(fmt, ...) \
1175 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
1176@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
1177 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
1178
1179 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
1180+static CORE_ADDR
1181+microblaze_store_arguments (struct regcache *regcache, int nargs,
1182+ struct value **args, CORE_ADDR sp,
1183+ int struct_return, CORE_ADDR struct_addr)
1184+{
1185+ error (_("store_arguments not implemented"));
1186+ return sp;
1187+}
1188+#if 0
1189 static int
1190 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1191 struct bp_target_info *bp_tgt)
1192@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1193 /* Make sure we see the memory breakpoints. */
1194 scoped_restore restore_memory
1195 = make_scoped_restore_show_memory_breakpoints (1);
1196-
1197 val = target_read_memory (addr, old_contents, bplen);
1198
1199 /* If our breakpoint is no longer at the address, this means that the
1200@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1201 return val;
1202 }
1203
1204+#endif
1205 /* Allocate and initialize a frame cache. */
1206
1207 static struct microblaze_frame_cache *
1208@@ -583,11 +595,11 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
1209 {
1210 case 1: /* return last byte in the register. */
1211 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1212- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
1213+ memcpy(valbuf, buf + reg_size - 1, 1);
1214 return;
1215 case 2: /* return last 2 bytes in register. */
1216 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1217- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
1218+ memcpy(valbuf, buf + reg_size - 2, 2);
1219 return;
1220 case 4: /* for sizes 4 or 8, copy the required length. */
1221 case 8:
1222@@ -753,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache)
1223 }
1224 #endif
1225
1226+static void
1227+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
1228+{
1229+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
1230+}
1231+
1232 static int dwarf2_to_reg_map[78] =
1233 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
1234 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
1235@@ -787,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
1236 static void
1237 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
1238 {
1239+
1240 register_remote_g_packet_guess (gdbarch,
1241 4 * MICROBLAZE_NUM_CORE_REGS,
1242- tdesc_microblaze);
1243+ tdesc_microblaze64);
1244
1245 register_remote_g_packet_guess (gdbarch,
1246 4 * MICROBLAZE_NUM_REGS,
1247- tdesc_microblaze_with_stack_protect);
1248+ tdesc_microblaze64_with_stack_protect);
1249 }
1250
1251 void
1252@@ -801,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset,
1253 struct regcache *regcache,
1254 int regnum, const void *gregs)
1255 {
1256- const unsigned int *regs = (const unsigned int *)gregs;
1257+ const gdb_byte *regs = (const gdb_byte *) gregs;
1258 if (regnum >= 0)
1259 regcache->raw_supply (regnum, regs + regnum);
1260
1261@@ -809,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset,
1262 int i;
1263
1264 for (i = 0; i < 50; i++) {
1265- regcache->raw_supply (i, regs + i);
1266+ regcache->raw_supply (regnum, regs + i);
1267 }
1268 }
1269 }
1270@@ -832,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
1271 }
1272
1273
1274+static void
1275+make_regs (struct gdbarch *arch)
1276+{
1277+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
1278+ int mach = gdbarch_bfd_arch_info (arch)->mach;
1279+
1280+ if (mach == bfd_mach_microblaze64)
1281+ {
1282+ set_gdbarch_ptr_bit (arch, 64);
1283+ }
1284+}
1285
1286 static struct gdbarch *
1287 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1288@@ -844,8 +874,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1289 if (arches != NULL)
1290 return arches->gdbarch;
1291 if (tdesc == NULL)
1292- tdesc = tdesc_microblaze;
1293-
1294+ {
1295+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1296+ {
1297+ tdesc = tdesc_microblaze64;
1298+ reg_size = 8;
1299+ }
1300+ else
1301+ tdesc = tdesc_microblaze;
1302+ }
1303 /* Check any target description for validity. */
1304 if (tdesc_has_registers (tdesc))
1305 {
1306@@ -853,31 +890,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1307 int valid_p;
1308 int i;
1309
1310- feature = tdesc_find_feature (tdesc,
1311- "org.gnu.gdb.microblaze.core");
1312+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1313+ feature = tdesc_find_feature (tdesc,
1314+ "org.gnu.gdb.microblaze64.core");
1315+ else
1316+ feature = tdesc_find_feature (tdesc,
1317+ "org.gnu.gdb.microblaze.core");
1318 if (feature == NULL)
1319 return NULL;
1320 tdesc_data = tdesc_data_alloc ();
1321
1322 valid_p = 1;
1323- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
1324- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
1325- microblaze_register_names[i]);
1326- feature = tdesc_find_feature (tdesc,
1327- "org.gnu.gdb.microblaze.stack-protect");
1328+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
1329+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
1330+ microblaze_register_names[i]);
1331+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1332+ feature = tdesc_find_feature (tdesc,
1333+ "org.gnu.gdb.microblaze64.stack-protect");
1334+ else
1335+ feature = tdesc_find_feature (tdesc,
1336+ "org.gnu.gdb.microblaze.stack-protect");
1337 if (feature != NULL)
1338- {
1339- valid_p = 1;
1340- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1341- MICROBLAZE_SLR_REGNUM,
1342- "rslr");
1343- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1344- MICROBLAZE_SHR_REGNUM,
1345- "rshr");
1346- }
1347+ {
1348+ valid_p = 1;
1349+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1350+ MICROBLAZE_SLR_REGNUM,
1351+ "slr");
1352+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1353+ MICROBLAZE_SHR_REGNUM,
1354+ "shr");
1355+ }
1356
1357 if (!valid_p)
1358- return NULL;
1359+ {
1360+ // tdesc_data_cleanup (tdesc_data.get ());
1361+ return NULL;
1362+ }
1363 }
1364
1365 /* Allocate space for the new architecture. */
1366@@ -897,7 +945,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1367 /* Register numbers of various important registers. */
1368 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
1369 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
1370+
1371+ /* Register set.
1372+ make_regs (gdbarch); */
1373+ switch (info.bfd_arch_info->mach)
1374+ {
1375+ case bfd_mach_microblaze64:
1376+ set_gdbarch_ptr_bit (gdbarch, 64);
1377+ break;
1378+ }
1379
1380+
1381 /* Map Dwarf2 registers to GDB registers. */
1382 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
1383
1384@@ -917,7 +975,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1385 microblaze_breakpoint::kind_from_pc);
1386 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1387 microblaze_breakpoint::bp_from_kind);
1388- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1389+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1390+
1391+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1392
1393 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1394
1395@@ -925,7 +985,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1396
1397 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
1398
1399- microblaze_register_g_packet_guesses (gdbarch);
1400+ //microblaze_register_g_packet_guesses (gdbarch);
1401
1402 frame_base_set_default (gdbarch, &microblaze_frame_base);
1403
1404@@ -940,12 +1000,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1405 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
1406 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
1407
1408- /* If we have register sets, enable the generic core file support. */
1409+ /* If we have register sets, enable the generic core file support.
1410 if (tdep->gregset) {
1411 set_gdbarch_iterate_over_regset_sections (gdbarch,
1412 microblaze_iterate_over_regset_sections);
1413- }
1414-
1415+ }*/
1416 return gdbarch;
1417 }
1418
1419@@ -957,6 +1016,8 @@ _initialize_microblaze_tdep ()
1420
1421 initialize_tdesc_microblaze_with_stack_protect ();
1422 initialize_tdesc_microblaze ();
1423+ initialize_tdesc_microblaze64_with_stack_protect ();
1424+ initialize_tdesc_microblaze64 ();
1425 /* Debug this files internals. */
1426 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
1427 &microblaze_debug_flag, _("\
1428diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1429index 21f206777f0..542cdd82070 100644
1430--- a/gdb/microblaze-tdep.h
1431+++ b/gdb/microblaze-tdep.h
1432@@ -28,7 +28,7 @@ struct microblaze_gregset
1433 microblaze_gregset() {}
1434 unsigned int gregs[32];
1435 unsigned int fpregs[32];
1436- unsigned int pregs[16];
1437+ unsigned int pregs[18];
1438 };
1439
1440 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
1441@@ -134,7 +134,7 @@ struct microblaze_frame_cache
1442 struct trad_frame_saved_reg *saved_regs;
1443 };
1444 /* All registers are 32 bits. */
1445-#define MICROBLAZE_REGISTER_SIZE 4
1446+//#define MICROBLAZE_REGISTER_SIZE 8
1447
1448 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1449 Only used for native debugging. */
1450diff --git a/include/elf/common.h b/include/elf/common.h
1451index 244b13361e5..6395f69426f 100644
1452--- a/include/elf/common.h
1453+++ b/include/elf/common.h
1454@@ -360,6 +360,7 @@
1455 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
1456 #define EM_TACHYUM 261 /* Tachyum */
1457 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
1458+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
1459
1460 /* If it is necessary to assign new unofficial EM_* values, please pick large
1461 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
1462diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
1463index fecdd7e4831..3306e3c3ad6 100644
1464--- a/include/elf/microblaze.h
1465+++ b/include/elf/microblaze.h
1466@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
1467 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
1468 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
1469 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
1470+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
1471+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
1472+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
1473+
1474 END_RELOC_NUMBERS (R_MICROBLAZE_max)
1475
1476 /* Global base address names. */
1477diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
1478index 12981abfea1..c910f2ff210 100644
1479--- a/opcodes/microblaze-dis.c
1480+++ b/opcodes/microblaze-dis.c
1481@@ -33,6 +33,7 @@
1482 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
1483 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
1484 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
1485+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
1486 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
1487
1488 #define NUM_STRBUFS 3
1489@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
1490 }
1491
1492 static char *
1493-get_field_imm5 (struct string_buf *buf, long instr)
1494+get_field_imml (struct string_buf *buf, long instr)
1495 {
1496 char *p = strbuf (buf);
1497
1498- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
1499+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
1500+ return p;
1501+}
1502+
1503+static char *
1504+get_field_imms (struct string_buf *buf, long instr)
1505+{
1506+ char *p = strbuf (buf);
1507+
1508+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
1509 return p;
1510 }
1511
1512@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
1513 return p;
1514 }
1515
1516+static char *
1517+get_field_immw (struct string_buf *buf, long instr)
1518+{
1519+ char *p = strbuf (buf);
1520+
1521+ if (instr & 0x00004000)
1522+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
1523+ else
1524+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
1525+ return p;
1526+}
1527+
1528 static char *
1529 get_field_rfsl (struct string_buf *buf, long instr)
1530 {
1531@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1532 }
1533 }
1534 break;
1535- case INST_TYPE_RD_R1_IMM5:
1536+ case INST_TYPE_RD_R1_IMML:
1537+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1538+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
1539+ /* TODO: Also print symbol */
1540+ break;
1541+ case INST_TYPE_RD_R1_IMMS:
1542 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1543- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
1544+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
1545 break;
1546 case INST_TYPE_RD_RFSL:
1547 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1548@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1549 }
1550 }
1551 break;
1552- case INST_TYPE_RD_R2:
1553- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1554- get_field_r2 (&buf, inst));
1555+ case INST_TYPE_IMML:
1556+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
1557+ /* TODO: Also print symbol */
1558+ break;
1559+ case INST_TYPE_RD_R2:
1560+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
1561 break;
1562 case INST_TYPE_R2:
1563 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
1564@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1565 /* For mbar 16 or sleep insn. */
1566 case INST_TYPE_NONE:
1567 break;
1568- /* For tuqula instruction */
1569+ /* For bit field insns. */
1570+ case INST_TYPE_RD_R1_IMMW_IMMS:
1571+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
1572+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
1573+ break;
1574+ /* For tuqula instruction */
1575 case INST_TYPE_RD:
1576 print_func (stream, "\t%s", get_field_rd (&buf, inst));
1577 break;
1578diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
1579index 7398e9e246a..dc78712d67b 100644
1580--- a/opcodes/microblaze-opc.h
1581+++ b/opcodes/microblaze-opc.h
1582@@ -40,7 +40,7 @@
1583 #define INST_TYPE_RD_SPECIAL 11
1584 #define INST_TYPE_R1 12
1585 /* New instn type for barrel shift imms. */
1586-#define INST_TYPE_RD_R1_IMM5 13
1587+#define INST_TYPE_RD_R1_IMMS 13
1588 #define INST_TYPE_RD_RFSL 14
1589 #define INST_TYPE_R1_RFSL 15
1590
1591@@ -59,6 +59,15 @@
1592 /* For mbar. */
1593 #define INST_TYPE_IMM5 20
1594
1595+/* For bsefi and bsifi */
1596+#define INST_TYPE_RD_R1_IMMW_IMMS 21
1597+
1598+/* For 64-bit instructions */
1599+#define INST_TYPE_IMML 22
1600+#define INST_TYPE_RD_R1_IMML 23
1601+#define INST_TYPE_R1_IMML 24
1602+#define INST_TYPE_RD_R1_IMMW_IMMS 21
1603+
1604 #define INST_TYPE_NONE 25
1605
1606
1607@@ -88,11 +97,14 @@
1608 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
1609 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
1610 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
1611-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
1612+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
1613+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
1614 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
1615+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
1616 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
1617 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
1618 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
1619+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
1620
1621 /* New Mask for msrset, msrclr insns. */
1622 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
1623@@ -102,7 +114,7 @@
1624 #define DELAY_SLOT 1
1625 #define NO_DELAY_SLOT 0
1626
1627-#define MAX_OPCODES 300
1628+#define MAX_OPCODES 412
1629
1630 const struct op_code_struct
1631 {
1632@@ -120,6 +132,7 @@ const struct op_code_struct
1633 /* More info about output format here. */
1634 } microblaze_opcodes[MAX_OPCODES] =
1635 {
1636+ /* 32-bit instructions */
1637 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
1638 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
1639 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
1640@@ -156,9 +169,11 @@ const struct op_code_struct
1641 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
1642 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
1643 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
1644- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
1645- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
1646- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
1647+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
1648+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
1649+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
1650+ {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
1651+ {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
1652 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
1653 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
1654 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
1655@@ -260,9 +275,7 @@ const struct op_code_struct
1656 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
1657 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
1658 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
1659- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1660 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
1661- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1662 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
1663 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
1664 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
1665@@ -418,6 +431,130 @@ const struct op_code_struct
1666 {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
1667 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
1668 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
1669+ /* 64-bit instructions */
1670+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
1671+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
1672+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
1673+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
1674+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
1675+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
1676+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
1677+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
1678+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
1679+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
1680+ {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1681+ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1682+ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1683+ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1684+ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1685+ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1686+ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1687+ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1688+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
1689+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
1690+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
1691+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
1692+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
1693+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
1694+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
1695+ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst },
1696+ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst },
1697+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
1698+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
1699+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
1700+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
1701+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
1702+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
1703+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
1704+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
1705+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
1706+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
1707+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
1708+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
1709+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
1710+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
1711+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
1712+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
1713+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
1714+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
1715+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
1716+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
1717+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
1718+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
1719+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
1720+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
1721+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
1722+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
1723+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
1724+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
1725+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
1726+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
1727+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
1728+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
1729+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
1730+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
1731+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
1732+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
1733+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
1734+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
1735+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
1736+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
1737+ {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1738+ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1739+ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1740+ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1741+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
1742+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
1743+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
1744+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
1745+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
1746+ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */
1747+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
1748+ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */
1749+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
1750+ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */
1751+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
1752+ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */
1753+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
1754+ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */
1755+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
1756+ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */
1757+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
1758+ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */
1759+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
1760+ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */
1761+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
1762+ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */
1763+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
1764+ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */
1765+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
1766+ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */
1767+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
1768+ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */
1769+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
1770+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
1771+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
1772+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
1773+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
1774+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
1775+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
1776+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
1777+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
1778+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
1779+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
1780+ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst },
1781+ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst },
1782+ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst },
1783+ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst },
1784+ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst },
1785+ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst },
1786+ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst },
1787+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
1788+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
1789+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
1790+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1791+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1792+
1793 {"", 0, 0, 0, 0, 0, 0, 0, 0},
1794 };
1795
1796@@ -438,5 +575,17 @@ char pvr_register_prefix[] = "rpvr";
1797 #define MIN_IMM5 ((int) 0x00000000)
1798 #define MAX_IMM5 ((int) 0x0000001f)
1799
1800+#define MIN_IMM6 ((int) 0x00000000)
1801+#define MAX_IMM6 ((int) 0x0000003f)
1802+
1803+#define MIN_IMM_WIDTH ((int) 0x00000001)
1804+#define MAX_IMM_WIDTH ((int) 0x00000020)
1805+
1806+#define MIN_IMM6_WIDTH ((int) 0x00000001)
1807+#define MAX_IMM6_WIDTH ((int) 0x00000040)
1808+
1809+#define MIN_IMML ((long) 0xffffff8000000000L)
1810+#define MAX_IMML ((long) 0x0000007fffffffffL)
1811+
1812 #endif /* MICROBLAZE_OPC */
1813
1814diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
1815index c91b002d951..3923f6258d8 100644
1816--- a/opcodes/microblaze-opcm.h
1817+++ b/opcodes/microblaze-opcm.h
1818@@ -25,11 +25,12 @@
1819
1820 enum microblaze_instr
1821 {
1822+ /* 32-bit instructions */
1823 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
1824 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
1825 mulh, mulhu, mulhsu, swapb, swaph,
1826 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
1827- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
1828+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
1829 /* 'or/and/xor' are C++ keywords. */
1830 microblaze_or, microblaze_and, microblaze_xor,
1831 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
1832@@ -39,8 +40,8 @@ enum microblaze_instr
1833 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
1834 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
1835 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
1836- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
1837- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1838+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
1839+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1840 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
1841 /* 'fsqrt' is a glibc:math.h symbol. */
1842 fint, microblaze_fsqrt,
1843@@ -59,6 +60,18 @@ enum microblaze_instr
1844 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
1845 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
1846 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
1847+
1848+ /* 64-bit instructions */
1849+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
1850+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
1851+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
1852+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
1853+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
1854+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
1855+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
1856+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
1857+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
1858+ dcmp_un, dbl, dlong, dsqrt,
1859 invalid_inst
1860 };
1861
1862@@ -130,18 +143,25 @@ enum microblaze_instr_type
1863 #define RB_LOW 11 /* Low bit for RB. */
1864 #define IMM_LOW 0 /* Low bit for immediate. */
1865 #define IMM_MBAR 21 /* low bit for mbar instruction. */
1866+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
1867
1868 #define RD_MASK 0x03E00000
1869 #define RA_MASK 0x001F0000
1870 #define RB_MASK 0x0000F800
1871 #define IMM_MASK 0x0000FFFF
1872+#define IMML_MASK 0x00FFFFFF
1873
1874-/* Imm mask for barrel shifts. */
1875+/* Imm masks for barrel shifts. */
1876 #define IMM5_MASK 0x0000001F
1877+#define IMM6_MASK 0x0000003F
1878
1879 /* Imm mask for mbar. */
1880 #define IMM5_MBAR_MASK 0x03E00000
1881
1882+/* Imm masks for extract/insert width. */
1883+#define IMM5_WIDTH_MASK 0x000007C0
1884+#define IMM6_WIDTH_MASK 0x00000FC0
1885+
1886 /* FSL imm mask for get, put instructions. */
1887 #define RFSL_MASK 0x000000F
1888
1889--
18902.34.1
1891
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
deleted file mode 100644
index ec11e7be..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
+++ /dev/null
@@ -1,300 +0,0 @@
1From d2f145ec8e4e149e055adc74e92016447af91806 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 7/8] [Patch,MicroBlaze] : Added m64 abi for 64 bit target
5 descriptions. set m64 abi for 64 bit elf.
6
7Conflicts:
8 gdb/microblaze-tdep.c
9 gdb/microblaze-tdep.h
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
14---
15 gdb/features/microblaze64.xml | 1 +
16 gdb/microblaze-tdep.c | 159 ++++++++++++++++++++++++++++++++--
17 gdb/microblaze-tdep.h | 13 ++-
18 3 files changed, 165 insertions(+), 8 deletions(-)
19
20diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
21index 515d18e65cf..9c1b7d22003 100644
22--- a/gdb/features/microblaze64.xml
23+++ b/gdb/features/microblaze64.xml
24@@ -7,5 +7,6 @@
25
26 <!DOCTYPE target SYSTEM "gdb-target.dtd">
27 <target>
28+ <architecture>microblaze64</architecture>
29 <xi:include href="microblaze64-core.xml"/>
30 </target>
31diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
32index c347bb9516b..d83072cdaef 100644
33--- a/gdb/microblaze-tdep.c
34+++ b/gdb/microblaze-tdep.c
35@@ -65,8 +65,95 @@
36 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
37 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
38
39+static const char *microblaze_abi_string;
40+
41+static const char *const microblaze_abi_strings[] = {
42+ "auto",
43+ "m64",
44+};
45+
46+enum microblaze_abi
47+microblaze_abi (struct gdbarch *gdbarch)
48+{
49+ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
50+ return tdep->microblaze_abi;
51+}
52 /* The registers of the Xilinx microblaze processor. */
53
54+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
55+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
56+
57+static void
58+microblaze_abi_update (const char *ignore_args,
59+ int from_tty, struct cmd_list_element *c)
60+{
61+ struct gdbarch_info info;
62+
63+ /* Force the architecture to update, and (if it's a microblaze architecture)
64+ * microblaze_gdbarch_init will take care of the rest. */
65+// gdbarch_info_init (&info);
66+ gdbarch_update_p (info);
67+}
68+
69+
70+static enum microblaze_abi
71+global_microblaze_abi (void)
72+{
73+ int i;
74+
75+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
76+ if (microblaze_abi_strings[i] == microblaze_abi_string)
77+ return (enum microblaze_abi) i;
78+
79+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
80+}
81+
82+static void
83+show_microblaze_abi (struct ui_file *file,
84+ int from_tty,
85+ struct cmd_list_element *ignored_cmd,
86+ const char *ignored_value)
87+{
88+ enum microblaze_abi global_abi = global_microblaze_abi ();
89+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
90+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
91+
92+#if 1
93+ if (global_abi == MICROBLAZE_ABI_AUTO)
94+ fprintf_filtered
95+ (file,
96+ "The microblaze ABI is set automatically (currently \"%s\").\n",
97+ actual_abi_str);
98+ else if (global_abi == actual_abi)
99+ fprintf_filtered
100+ (file,
101+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
102+ actual_abi_str);
103+ else
104+ {
105+#endif
106+ /* Probably shouldn't happen... */
107+ fprintf_filtered (file,
108+ "The (auto detected) microblaze ABI \"%s\" is in use "
109+ "even though the user setting was \"%s\".\n",
110+ actual_abi_str, microblaze_abi_strings[global_abi]);
111+ }
112+}
113+
114+static void
115+show_microblaze_command (const char *args, int from_tty)
116+{
117+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
118+}
119+
120+static void
121+set_microblaze_command (const char *args, int from_tty)
122+{
123+ printf_unfiltered
124+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
125+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
126+}
127+
128 static const char * const microblaze_register_names[] =
129 {
130 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
131@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] =
132 static unsigned int microblaze_debug_flag = 0;
133 int reg_size = 4;
134
135+unsigned int
136+microblaze_abi_regsize (struct gdbarch *gdbarch)
137+{
138+ switch (microblaze_abi (gdbarch))
139+ {
140+ case MICROBLAZE_ABI_M64:
141+ return 8;
142+ default:
143+ return 4;
144+ }
145+}
146+
147 #define microblaze_debug(fmt, ...) \
148 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
149- fmt, ## __VA_ARGS__)
150+ fmt, ## __VA_ARGS__)
151
152
153 /* Return the name of register REGNUM. */
154@@ -868,15 +967,30 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
155 {
156 struct gdbarch *gdbarch;
157 tdesc_arch_data_up tdesc_data;
158+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
159 const struct target_desc *tdesc = info.target_desc;
160
161+ /* What has the user specified from the command line? */
162+ wanted_abi = global_microblaze_abi ();
163+ if (gdbarch_debug)
164+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
165+ wanted_abi);
166+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
167+ microblaze_abi = wanted_abi;
168+
169 /* If there is already a candidate, use it. */
170 arches = gdbarch_list_lookup_by_info (arches, &info);
171- if (arches != NULL)
172+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
173 return arches->gdbarch;
174+
175+ if (microblaze_abi == MICROBLAZE_ABI_M64)
176+ {
177+ tdesc = tdesc_microblaze64;
178+ reg_size = 8;
179+ }
180 if (tdesc == NULL)
181 {
182- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
183+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
184 {
185 tdesc = tdesc_microblaze64;
186 reg_size = 8;
187@@ -891,7 +1005,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
188 int valid_p;
189 int i;
190
191- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
192+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
193 feature = tdesc_find_feature (tdesc,
194 "org.gnu.gdb.microblaze64.core");
195 else
196@@ -905,7 +1019,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
197 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
198 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
199 microblaze_register_names[i]);
200- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
201+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
202 feature = tdesc_find_feature (tdesc,
203 "org.gnu.gdb.microblaze64.stack-protect");
204 else
205@@ -955,7 +1069,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
206 set_gdbarch_ptr_bit (gdbarch, 64);
207 break;
208 }
209-
210+ if(microblaze_abi == MICROBLAZE_ABI_M64)
211+ set_gdbarch_ptr_bit (gdbarch, 64);
212
213 /* Map Dwarf2 registers to GDB registers. */
214 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
215@@ -1014,7 +1129,38 @@ void
216 _initialize_microblaze_tdep ()
217 {
218 register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
219+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
220+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
221+
222+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
223
224+ add_setshow_prefix_cmd ("microblaze", no_class,
225+ _("Various microblaze specific commands."),
226+ _("Various microblaze specific commands."),
227+ &setmicroblazecmdlist,&showmicroblazecmdlist,
228+ &setlist,&showlist);
229+#if 0
230+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
231+ _("Various microblaze specific commands."),
232+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
233+
234+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
235+ _("Various microblaze specific commands."),
236+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
237+#endif
238+
239+ /* Allow the user to override the ABI. */
240+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
241+ &microblaze_abi_string, _("\
242+Set the microblaze ABI used by this program."), _("\
243+Show the microblaze ABI used by this program."), _("\
244+This option can be set to one of:\n\
245+ auto - the default ABI associated with the current binary\n\
246+ m64"),
247+ microblaze_abi_update,
248+ show_microblaze_abi,
249+ &setmicroblazecmdlist, &showmicroblazecmdlist);
250+
251 initialize_tdesc_microblaze_with_stack_protect ();
252 initialize_tdesc_microblaze ();
253 initialize_tdesc_microblaze64_with_stack_protect ();
254@@ -1029,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."),
255 NULL,
256 &setdebuglist, &showdebuglist);
257
258-
259 }
260diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
261index f4d810303ca..babd6c36926 100644
262--- a/gdb/microblaze-tdep.h
263+++ b/gdb/microblaze-tdep.h
264@@ -19,9 +19,17 @@
265
266 #ifndef MICROBLAZE_TDEP_H
267 #define MICROBLAZE_TDEP_H 1
268-
269+#include "objfiles.h"
270 #include "gdbarch.h"
271
272+struct gdbarch;
273+enum microblaze_abi
274+ {
275+ MICROBLAZE_ABI_AUTO = 0,
276+ MICROBLAZE_ABI_M64,
277+ };
278+
279+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
280 /* Microblaze architecture-specific information. */
281 struct microblaze_gregset
282 {
283@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep
284 {
285 int dummy; // declare something.
286
287+ enum microblaze_abi microblaze_abi {};
288+ enum microblaze_abi found_abi {};
289 /* Register sets. */
290 struct regset *gregset;
291 size_t sizeof_gregset;
292 struct regset *fpregset;
293 size_t sizeof_fpregset;
294+ int register_size;
295 };
296
297 /* Register numbers. */
298--
2992.37.1 (Apple Git-137.1)
300
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
index 9d12cc53..27c04153 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
@@ -1,23 +1,20 @@
1From ef411b49f3b2c9e4048eb273f43ab4ee96f96b7e Mon Sep 17 00:00:00 2001 1From b6735e00ff7c60f8e66527402dd541b4217ce38f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 19 Apr 2021 14:33:27 +0530 3Date: Mon, 19 Apr 2021 14:33:27 +0530
4Subject: [PATCH 6/8] [Patch,MicroBlaze] : these changes will make 64 bit 4Subject: [PATCH 07/54] these changes will make 64 bit vectors as default
5 vectors as default target types when we built gdb with microblaze 64 bit type 5 target types when we built gdb with microblaze 64 bit type targets,for
6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64 6 instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7
8Upstream-Status: Pending
9
10Signed-off-by: Mark Hatle <mark.hatle@amd.com>
11 7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
12--- 9---
13 bfd/config.bfd | 8 ++++++++ 10 bfd/config.bfd | 8 ++++++++
14 1 file changed, 8 insertions(+) 11 1 file changed, 8 insertions(+)
15 12
16diff --git a/bfd/config.bfd b/bfd/config.bfd 13diff --git a/bfd/config.bfd b/bfd/config.bfd
17index 5e9ba3d9805..deb3d078439 100644 14index 3a7d427778c..9a4b26be8f8 100644
18--- a/bfd/config.bfd 15--- a/bfd/config.bfd
19+++ b/bfd/config.bfd 16+++ b/bfd/config.bfd
20@@ -856,7 +856,15 @@ case "${targ}" in 17@@ -880,7 +880,15 @@ case "${targ}" in
21 targ_defvec=metag_elf32_vec 18 targ_defvec=metag_elf32_vec
22 targ_underscore=yes 19 targ_underscore=yes
23 ;; 20 ;;
@@ -34,5 +31,5 @@ index 5e9ba3d9805..deb3d078439 100644
34 targ_defvec=microblaze_elf32_le_vec 31 targ_defvec=microblaze_elf32_le_vec
35 targ_selvecs=microblaze_elf32_vec 32 targ_selvecs=microblaze_elf32_vec
36-- 33--
372.37.1 (Apple Git-137.1) 342.34.1
38 35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
index 6eea28fe..54e53f6f 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
@@ -1,591 +1,21 @@
1From 6aadc445a00275c37112e431c6a29f5a331e6e16 Mon Sep 17 00:00:00 2001 1From 89f7a0c3e8b3bc37a37280bacec724f764503f38 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530 3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 5/8] [Patch, microblaze]: Adding 64 bit MB support Added new 4Subject: [PATCH 08/54] Added m64 abi for 64 bit target descriptions. set m64
5 architecture to Microblaze 64-bit support to GDB Signed-off-by :Nagaraju 5 abi for 64 bit elf.
6 Mekala <nmekala@xilix.com> Signed-off-by :Mahesh Bodapati
7 <mbodapat@xilinx.com>
8 6
9Conflicts: 7Conflicts:
10 gdb/Makefile.in
11
12Conflicts:
13 bfd/cpu-microblaze.c
14 gdb/microblaze-tdep.c 8 gdb/microblaze-tdep.c
15 ld/Makefile.am 9 gdb/microblaze-tdep.h
16 ld/Makefile.in
17 opcodes/microblaze-dis.c
18
19Conflicts:
20 bfd/configure
21 gas/config/tc-microblaze.c
22 ld/Makefile.in
23 opcodes/microblaze-opcm.h
24
25Conflicts:
26 gdb/microblaze-tdep.c
27
28Conflicts:
29 bfd/elf32-microblaze.c
30 gas/config/tc-microblaze.c
31 gdb/features/Makefile
32 gdb/features/microblaze-with-stack-protect.c
33 gdb/microblaze-tdep.c
34 gdb/regformats/microblaze-with-stack-protect.dat
35 gdbserver/linux-microblaze-low.c
36 include/elf/common.h
37Upstream-Status: Pending
38
39Signed-off-by: Mark Hatle <mark.hatle@amd.com>
40 10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
41--- 12---
42 bfd/Makefile.am | 2 + 13 bfd/elf64-microblaze.c | 3810 ++++++++++++++++++++++++++++++++++++++++
43 bfd/Makefile.in | 3 + 14 gdb/microblaze-tdep.c | 160 +-
44 bfd/archures.c | 2 + 15 gdb/microblaze-tdep.h | 13 +-
45 bfd/bfd-in2.h | 31 +- 16 3 files changed, 3975 insertions(+), 8 deletions(-)
46 bfd/config.bfd | 4 +
47 bfd/configure | 2 +
48 bfd/cpu-microblaze.c | 55 +-
49 bfd/elf32-microblaze.c | 162 +-
50 bfd/elf64-microblaze.c | 3810 +++++++++++++++++
51 bfd/libbfd.h | 3 +
52 bfd/reloc.c | 20 +
53 bfd/targets.c | 6 +
54 gdb/features/Makefile | 2 +
55 gdb/features/microblaze-core.xml | 6 +-
56 gdb/features/microblaze-stack-protect.xml | 4 +-
57 gdb/features/microblaze-with-stack-protect.c | 8 +-
58 gdb/features/microblaze.c | 6 +-
59 gdb/features/microblaze64-core.xml | 69 +
60 gdb/features/microblaze64-stack-protect.xml | 12 +
61 .../microblaze64-with-stack-protect.c | 79 +
62 .../microblaze64-with-stack-protect.xml | 12 +
63 gdb/features/microblaze64.c | 77 +
64 gdb/features/microblaze64.xml | 11 +
65 gdb/microblaze-linux-tdep.c | 36 +-
66 gdb/microblaze-tdep.c | 126 +-
67 gdb/microblaze-tdep.h | 4 +-
68 include/elf/common.h | 1 +
69 include/elf/microblaze.h | 4 +
70 opcodes/microblaze-dis.c | 51 +-
71 opcodes/microblaze-opc.h | 180 +-
72 opcodes/microblaze-opcm.h | 36 +-
73 31 files changed, 4729 insertions(+), 95 deletions(-)
74 create mode 100755 bfd/elf64-microblaze.c 17 create mode 100755 bfd/elf64-microblaze.c
75 create mode 100644 gdb/features/microblaze64-core.xml
76 create mode 100644 gdb/features/microblaze64-stack-protect.xml
77 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
78 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
79 create mode 100644 gdb/features/microblaze64.c
80 create mode 100644 gdb/features/microblaze64.xml
81 18
82diff --git a/bfd/Makefile.am b/bfd/Makefile.am
83index b9a3f8207ac..2ddd7891661 100644
84--- a/bfd/Makefile.am
85+++ b/bfd/Makefile.am
86@@ -571,6 +571,7 @@ BFD64_BACKENDS = \
87 elf64-riscv.lo \
88 elfxx-riscv.lo \
89 elf64-s390.lo \
90+ elf64-microblaze.lo \
91 elf64-sparc.lo \
92 elf64-tilegx.lo \
93 elf64-x86-64.lo \
94@@ -608,6 +609,7 @@ BFD64_BACKENDS_CFILES = \
95 elf64-nfp.c \
96 elf64-ppc.c \
97 elf64-s390.c \
98+ elf64-microblaze.c \
99 elf64-sparc.c \
100 elf64-tilegx.c \
101 elf64-x86-64.c \
102diff --git a/bfd/Makefile.in b/bfd/Makefile.in
103index 934dd4bc066..7efb10f111d 100644
104--- a/bfd/Makefile.in
105+++ b/bfd/Makefile.in
106@@ -1040,6 +1040,7 @@ BFD64_BACKENDS = \
107 elf64-riscv.lo \
108 elfxx-riscv.lo \
109 elf64-s390.lo \
110+ elf64-microblaze.lo \
111 elf64-sparc.lo \
112 elf64-tilegx.lo \
113 elf64-x86-64.lo \
114@@ -1077,6 +1078,7 @@ BFD64_BACKENDS_CFILES = \
115 elf64-nfp.c \
116 elf64-ppc.c \
117 elf64-s390.c \
118+ elf64-microblaze.c \
119 elf64-sparc.c \
120 elf64-tilegx.c \
121 elf64-x86-64.c \
122@@ -1664,6 +1666,7 @@ distclean-compile:
123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
125 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
126+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
127 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
128 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
129 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
130diff --git a/bfd/archures.c b/bfd/archures.c
131index fac9fe82a08..1790c741c58 100644
132--- a/bfd/archures.c
133+++ b/bfd/archures.c
134@@ -524,6 +524,8 @@ DESCRIPTION
135 . bfd_arch_lm32, {* Lattice Mico32. *}
136 .#define bfd_mach_lm32 1
137 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
138+.#define bfd_mach_microblaze 1
139+.#define bfd_mach_microblaze64 2
140 . bfd_arch_tilepro, {* Tilera TILEPro. *}
141 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
142 .#define bfd_mach_tilepro 1
143diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
144index c0b563aec02..ccaeecb9476 100644
145--- a/bfd/bfd-in2.h
146+++ b/bfd/bfd-in2.h
147@@ -1903,6 +1903,8 @@ enum bfd_architecture
148 bfd_arch_lm32, /* Lattice Mico32. */
149 #define bfd_mach_lm32 1
150 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
151+#define bfd_mach_microblaze 1
152+#define bfd_mach_microblaze64 2
153 bfd_arch_tilepro, /* Tilera TILEPro. */
154 bfd_arch_tilegx, /* Tilera TILE-Gx. */
155 #define bfd_mach_tilepro 1
156@@ -5443,16 +5445,41 @@ value relative to the read-write small data area anchor */
157 expressions of the form "Symbol Op Symbol" */
158 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
159
160-/* This is a 64 bit reloc that stores the 32 bit pc relative
161+/* This is a 32 bit reloc that stores the 32 bit pc relative
162 value in two words (with an imm instruction). No relocation is
163 done here - only used for relaxing */
164- BFD_RELOC_MICROBLAZE_64_NONE,
165+ BFD_RELOC_MICROBLAZE_32_NONE,
166+
167+/* This is a 64 bit reloc that stores the 32 bit pc relative
168+ * +value in two words (with an imml instruction). No relocation is
169+ * +done here - only used for relaxing */
170+ BFD_RELOC_MICROBLAZE_64_PCREL,
171+
172+/* This is a 64 bit reloc that stores the 32 bit relative
173+ * +value in two words (with an imml instruction). No relocation is
174+ * +done here - only used for relaxing */
175+ BFD_RELOC_MICROBLAZE_64,
176+
177+/* This is a 64 bit reloc that stores the 32 bit relative
178+ * +value in two words (with an imml instruction). No relocation is
179+ * +done here - only used for relaxing */
180+ BFD_RELOC_MICROBLAZE_EA64,
181+
182+/* This is a 64 bit reloc that stores the 32 bit pc relative
183+ * +value in two words (with an imm instruction). No relocation is
184+ * +done here - only used for relaxing */
185+ BFD_RELOC_MICROBLAZE_64_NONE,
186
187 /* This is a 64 bit reloc that stores the 32 bit pc relative
188 value in two words (with an imm instruction). The relocation is
189 PC-relative GOT offset */
190 BFD_RELOC_MICROBLAZE_64_GOTPC,
191
192+/* This is a 64 bit reloc that stores the 32 bit pc relative
193+value in two words (with an imml instruction). The relocation is
194+PC-relative GOT offset */
195+ BFD_RELOC_MICROBLAZE_64_GPC,
196+
197 /* This is a 64 bit reloc that stores the 32 bit pc relative
198 value in two words (with an imm instruction). The relocation is
199 GOT offset */
200diff --git a/bfd/config.bfd b/bfd/config.bfd
201index 872685cfb72..5e9ba3d9805 100644
202--- a/bfd/config.bfd
203+++ b/bfd/config.bfd
204@@ -860,11 +860,15 @@ case "${targ}" in
205 microblazeel*-*)
206 targ_defvec=microblaze_elf32_le_vec
207 targ_selvecs=microblaze_elf32_vec
208+ targ64_selvecs=microblaze_elf64_vec
209+ targ64_selvecs=microblaze_elf64_le_vec
210 ;;
211
212 microblaze*-*)
213 targ_defvec=microblaze_elf32_vec
214 targ_selvecs=microblaze_elf32_le_vec
215+ targ64_selvecs=microblaze_elf64_vec
216+ targ64_selvecs=microblaze_elf64_le_vec
217 ;;
218
219 #ifdef BFD64
220diff --git a/bfd/configure b/bfd/configure
221index 0ef4c206fb0..b7547c6777c 100755
222--- a/bfd/configure
223+++ b/bfd/configure
224@@ -13547,6 +13547,8 @@ do
225 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
226 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
227 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
228+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
229+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
230 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
231 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
232 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
233diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
234index 0c1d2b1aa69..106f78229b5 100644
235--- a/bfd/cpu-microblaze.c
236+++ b/bfd/cpu-microblaze.c
237@@ -23,13 +23,30 @@
238 #include "bfd.h"
239 #include "libbfd.h"
240
241-const bfd_arch_info_type bfd_microblaze_arch =
242+const bfd_arch_info_type bfd_microblaze_arch[] =
243+{
244+#if BFD_DEFAULT_TARGET_SIZE == 64
245+{
246+ 64, /* 32 bits in a word. */
247+ 64, /* 32 bits in an address. */
248+ 8, /* 8 bits in a byte. */
249+ bfd_arch_microblaze, /* Architecture. */
250+ bfd_mach_microblaze64, /* 64 bit Machine */
251+ "microblaze", /* Architecture name. */
252+ "MicroBlaze", /* Printable name. */
253+ 3, /* Section align power. */
254+ false, /* Is this the default architecture ? */
255+ bfd_default_compatible, /* Architecture comparison function. */
256+ bfd_default_scan, /* String to architecture conversion. */
257+ bfd_arch_default_fill, /* Default fill. */
258+ &bfd_microblaze_arch[1] /* Next in list. */
259+},
260 {
261 32, /* Bits in a word. */
262 32, /* Bits in an address. */
263 8, /* Bits in a byte. */
264 bfd_arch_microblaze, /* Architecture number. */
265- 0, /* Machine number - 0 for now. */
266+ bfd_mach_microblaze, /* Machine number - 0 for now. */
267 "microblaze", /* Architecture name. */
268 "MicroBlaze", /* Printable name. */
269 3, /* Section align power. */
270@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
271 bfd_arch_default_fill, /* Default fill. */
272 NULL, /* Next in list. */
273 0 /* Maximum offset of a reloc from the start of an insn. */
274+}
275+#else
276+{
277+ 32, /* 32 bits in a word. */
278+ 32, /* 32 bits in an address. */
279+ 8, /* 8 bits in a byte. */
280+ bfd_arch_microblaze, /* Architecture. */
281+ bfd_mach_microblaze, /* 32 bit Machine */
282+ "microblaze", /* Architecture name. */
283+ "MicroBlaze", /* Printable name. */
284+ 3, /* Section align power. */
285+ true, /* Is this the default architecture ? */
286+ bfd_default_compatible, /* Architecture comparison function. */
287+ bfd_default_scan, /* String to architecture conversion. */
288+ bfd_arch_default_fill, /* Default fill. */
289+ &bfd_microblaze_arch[1] /* Next in list. */
290+},
291+{
292+ 64, /* 32 bits in a word. */
293+ 64, /* 32 bits in an address. */
294+ 8, /* 8 bits in a byte. */
295+ bfd_arch_microblaze, /* Architecture. */
296+ bfd_mach_microblaze64, /* 64 bit Machine */
297+ "microblaze", /* Architecture name. */
298+ "MicroBlaze", /* Printable name. */
299+ 3, /* Section align power. */
300+ false, /* Is this the default architecture ? */
301+ bfd_default_compatible, /* Architecture comparison function. */
302+ bfd_default_scan, /* String to architecture conversion. */
303+ bfd_arch_default_fill, /* Default fill. */
304+ NULL, /* Next in list. */
305+ 0
306+}
307+#endif
308 };
309diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
310index d3b3c66cf00..053c1b432f9 100644
311--- a/bfd/elf32-microblaze.c
312+++ b/bfd/elf32-microblaze.c
313@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
314 0x0000ffff, /* Dest Mask. */
315 true), /* PC relative offset? */
316
317+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
318+ 0, /* Rightshift. */
319+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
320+ 16, /* Bitsize. */
321+ true, /* PC_relative. */
322+ 0, /* Bitpos. */
323+ complain_overflow_dont, /* Complain on overflow. */
324+ bfd_elf_generic_reloc,/* Special Function. */
325+ "R_MICROBLAZE_IMML_64", /* Name. */
326+ false, /* Partial Inplace. */
327+ 0, /* Source Mask. */
328+ 0x0000ffff, /* Dest Mask. */
329+ false), /* PC relative offset? */
330+
331 /* A 64 bit relocation. Table entry not really used. */
332 HOWTO (R_MICROBLAZE_64, /* Type. */
333 0, /* Rightshift. */
334@@ -174,7 +188,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
335 0x0000ffff, /* Dest Mask. */
336 false), /* PC relative offset? */
337
338- /* This reloc does nothing. Used for relaxation. */
339+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
340+ 0, /* Rightshift. */
341+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
342+ 32, /* Bitsize. */
343+ true, /* PC_relative. */
344+ 0, /* Bitpos. */
345+ complain_overflow_bitfield, /* Complain on overflow. */
346+ NULL, /* Special Function. */
347+ "R_MICROBLAZE_32_NONE",/* Name. */
348+ false, /* Partial Inplace. */
349+ 0, /* Source Mask. */
350+ 0, /* Dest Mask. */
351+ false), /* PC relative offset? */
352+
353+ /* This reloc does nothing. Used for relaxation. */
354 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
355 0, /* Rightshift. */
356 3, /* Size (0 = byte, 1 = short, 2 = long). */
357@@ -264,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
358 0x0000ffff, /* Dest Mask. */
359 true), /* PC relative offset? */
360
361+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
362+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
363+ 0, /* Rightshift. */
364+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
365+ 16, /* Bitsize. */
366+ true, /* PC_relative. */
367+ 0, /* Bitpos. */
368+ complain_overflow_dont, /* Complain on overflow. */
369+ bfd_elf_generic_reloc, /* Special Function. */
370+ "R_MICROBLAZE_GPC_64", /* Name. */
371+ false, /* Partial Inplace. */
372+ 0, /* Source Mask. */
373+ 0x0000ffff, /* Dest Mask. */
374+ true), /* PC relative offset? */
375+
376 /* A 64 bit GOT relocation. Table-entry not really used. */
377 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
378 0, /* Rightshift. */
379@@ -560,6 +603,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
380 case BFD_RELOC_NONE:
381 microblaze_reloc = R_MICROBLAZE_NONE;
382 break;
383+ case BFD_RELOC_MICROBLAZE_32_NONE:
384+ microblaze_reloc = R_MICROBLAZE_32_NONE;
385+ break;
386 case BFD_RELOC_MICROBLAZE_64_NONE:
387 microblaze_reloc = R_MICROBLAZE_64_NONE;
388 break;
389@@ -600,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
390 case BFD_RELOC_VTABLE_ENTRY:
391 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
392 break;
393+ case BFD_RELOC_MICROBLAZE_64:
394+ microblaze_reloc = R_MICROBLAZE_IMML_64;
395+ break;
396 case BFD_RELOC_MICROBLAZE_64_GOTPC:
397 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
398 break;
399+ case BFD_RELOC_MICROBLAZE_64_GPC:
400+ microblaze_reloc = R_MICROBLAZE_GPC_64;
401+ break;
402 case BFD_RELOC_MICROBLAZE_64_GOT:
403 microblaze_reloc = R_MICROBLAZE_GOT_64;
404 break;
405@@ -1507,9 +1559,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
406 relocation += addend;
407 relocation -= dtprel_base(info);
408 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
409- contents + offset + 2);
410+ contents + offset + endian);
411 bfd_put_16 (input_bfd, relocation & 0xffff,
412- contents + offset + 2 + INST_WORD_SIZE);
413+ contents + offset + endian + INST_WORD_SIZE);
414 break;
415 case (int) R_MICROBLAZE_TEXTREL_64:
416 case (int) R_MICROBLAZE_TEXTREL_32_LO:
417@@ -1523,7 +1575,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
418 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
419 {
420 relocation += addend;
421- if (r_type == R_MICROBLAZE_32)
422+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
423 bfd_put_32 (input_bfd, relocation, contents + offset);
424 else
425 {
426@@ -1925,8 +1977,7 @@ microblaze_elf_relax_section (bfd *abfd,
427 else
428 symval += irel->r_addend;
429
430- if ((symval & 0xffff8000) == 0
431- || (symval & 0xffff8000) == 0xffff8000)
432+ if ((symval & 0xffff8000) == 0)
433 {
434 /* We can delete this instruction. */
435 sec->relax[sec->relax_count].addr = irel->r_offset;
436@@ -1990,21 +2041,51 @@ microblaze_elf_relax_section (bfd *abfd,
437 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
438 }
439 break;
440+ case R_MICROBLAZE_IMML_64:
441+ {
442+ /* This was a PC-relative instruction that was
443+ completely resolved. */
444+ int sfix, efix;
445+ unsigned int val;
446+ bfd_vma target_address;
447+ target_address = irel->r_addend + irel->r_offset;
448+ sfix = calc_fixup (irel->r_offset, 0, sec);
449+ efix = calc_fixup (target_address, 0, sec);
450+
451+ /* Validate the in-band val. */
452+ val = bfd_get_32 (abfd, contents + irel->r_offset);
453+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
454+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
455+ }
456+ irel->r_addend -= (efix - sfix);
457+ /* Should use HOWTO. */
458+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
459+ irel->r_addend);
460+ }
461+ break;
462 case R_MICROBLAZE_NONE:
463+ case R_MICROBLAZE_32_NONE:
464 {
465 /* This was a PC-relative instruction that was
466 completely resolved. */
467 int sfix, efix;
468+ unsigned int val;
469 bfd_vma target_address;
470 target_address = irel->r_addend + irel->r_offset;
471 sfix = calc_fixup (irel->r_offset, 0, sec);
472 efix = calc_fixup (target_address, 0, sec);
473+
474+ /* Validate the in-band val. */
475+ val = bfd_get_32 (abfd, contents + irel->r_offset);
476+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
477+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
478+ }
479 irel->r_addend -= (efix - sfix);
480 /* Should use HOWTO. */
481 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
482 irel->r_addend);
483- }
484- break;
485+ }
486+ break;
487 case R_MICROBLAZE_64_NONE:
488 {
489 /* This was a PC-relative 64-bit instruction that was
490@@ -2015,8 +2096,8 @@ microblaze_elf_relax_section (bfd *abfd,
491 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
492 efix = calc_fixup (target_address, 0, sec);
493 irel->r_addend -= (efix - sfix);
494- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
495- + INST_WORD_SIZE, irel->r_addend);
496+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
497+ irel->r_addend);
498 }
499 break;
500 }
501@@ -2046,9 +2127,50 @@ microblaze_elf_relax_section (bfd *abfd,
502 irelscanend = irelocs + o->reloc_count;
503 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
504 {
505- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
506- {
507- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
508+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
509+ {
510+ unsigned int val;
511+
512+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
513+
514+ /* hax: We only do the following fixup for debug location lists. */
515+ if (strcmp(".debug_loc", o->name))
516+ continue;
517+
518+ /* This was a PC-relative instruction that was completely resolved. */
519+ if (ocontents == NULL)
520+ {
521+ if (elf_section_data (o)->this_hdr.contents != NULL)
522+ ocontents = elf_section_data (o)->this_hdr.contents;
523+ else
524+ {
525+ /* We always cache the section contents.
526+ Perhaps, if info->keep_memory is FALSE, we
527+ should free them, if we are permitted to. */
528+
529+ if (o->rawsize == 0)
530+ o->rawsize = o->size;
531+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
532+ if (ocontents == NULL)
533+ goto error_return;
534+ if (!bfd_get_section_contents (abfd, o, ocontents,
535+ (file_ptr) 0,
536+ o->rawsize))
537+ goto error_return;
538+ elf_section_data (o)->this_hdr.contents = ocontents;
539+ }
540+ }
541+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
542+ if (val != irelscan->r_addend) {
543+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
544+ }
545+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
546+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
547+ irelscan->r_addend);
548+ }
549+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
550+ {
551+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
552
553 /* Look at the reloc only if the value has been resolved. */
554 if (isym->st_shndx == shndx
555@@ -2105,7 +2227,7 @@ microblaze_elf_relax_section (bfd *abfd,
556 elf_section_data (o)->this_hdr.contents = ocontents;
557 }
558 }
559- irelscan->r_addend -= calc_fixup (irel->r_addend
560+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
561 + isym->st_value,
562 0,
563 sec);
564@@ -3445,6 +3567,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
565 return true;
566 }
567
568+
569+static bool
570+elf_microblaze_object_p (bfd *abfd)
571+{
572+ /* Set the right machine number for an s390 elf32 file. */
573+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
574+}
575+
576 /* Hook called by the linker routine which adds symbols from an object
577 file. We use it to put .comm items in .sbss, and not .bss. */
578
579@@ -3514,8 +3644,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
580 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
581 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
582 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
583-
584-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
585-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
586+#define elf_backend_object_p elf_microblaze_object_p
587
588 #include "elf32-target.h"
589diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 19diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
590new file mode 100755 20new file mode 100755
591index 00000000000..6cd9753a592 21index 00000000000..6cd9753a592
@@ -4402,1388 +3832,273 @@ index 00000000000..6cd9753a592
4402+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 3832+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
4403+ 3833+
4404+#include "elf64-target.h" 3834+#include "elf64-target.h"
4405diff --git a/bfd/libbfd.h b/bfd/libbfd.h 3835diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
4406index 6e62e556962..ef5568a78b0 100644 3836index 9450882e850..f265e8fc608 100644
4407--- a/bfd/libbfd.h 3837--- a/gdb/microblaze-tdep.c
4408+++ b/bfd/libbfd.h 3838+++ b/gdb/microblaze-tdep.c
4409@@ -2992,6 +2992,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 3839@@ -65,8 +65,95 @@
4410 "BFD_RELOC_MICROBLAZE_32_ROSDA", 3840 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
4411 "BFD_RELOC_MICROBLAZE_32_RWSDA", 3841 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
4412 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
4413+ "BFD_RELOC_MICROBLAZE_32_NONE",
4414 "BFD_RELOC_MICROBLAZE_64_NONE",
4415 "BFD_RELOC_MICROBLAZE_64_GOTPC",
4416 "BFD_RELOC_MICROBLAZE_64_GOT",
4417@@ -2999,6 +3000,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
4418 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
4419 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
4420 "BFD_RELOC_MICROBLAZE_COPY",
4421+ "BFD_RELOC_MICROBLAZE_64",
4422+ "BFD_RELOC_MICROBLAZE_64_PCREL",
4423 "BFD_RELOC_MICROBLAZE_64_TLS",
4424 "BFD_RELOC_MICROBLAZE_64_TLSGD",
4425 "BFD_RELOC_MICROBLAZE_64_TLSLD",
4426diff --git a/bfd/reloc.c b/bfd/reloc.c
4427index 164060361a9..e733e2397f4 100644
4428--- a/bfd/reloc.c
4429+++ b/bfd/reloc.c
4430@@ -6898,6 +6898,12 @@ ENUM
4431 ENUMDOC
4432 This is a 32 bit reloc for the microblaze to handle
4433 expressions of the form "Symbol Op Symbol"
4434+ENUM
4435+ BFD_RELOC_MICROBLAZE_32_NONE
4436+ENUMDOC
4437+ This is a 32 bit reloc that stores the 32 bit pc relative
4438+ value in two words (with an imm instruction). No relocation is
4439+ done here - only used for relaxing
4440 ENUM
4441 BFD_RELOC_MICROBLAZE_64_NONE
4442 ENUMDOC
4443@@ -6991,6 +6997,20 @@ ENUMDOC
4444 value in two words (with an imm instruction). The relocation is
4445 relative offset from start of TEXT.
4446
4447+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
4448+ to two words (uses imml instruction).
4449+ENUM
4450+BFD_RELOC_MICROBLAZE_64,
4451+ENUMDOC
4452+ This is a 64 bit reloc that stores the 64 bit pc relative
4453+ value in two words (with an imml instruction). No relocation is
4454+ done here - only used for relaxing
4455+ENUM
4456+BFD_RELOC_MICROBLAZE_64_PCREL,
4457+ENUMDOC
4458+ This is a 32 bit reloc that stores the 32 bit pc relative
4459+ value in two words (with an imml instruction). No relocation is
4460+ done here - only used for relaxing
4461 ENUM
4462 BFD_RELOC_AARCH64_RELOC_START
4463 ENUMDOC
4464diff --git a/bfd/targets.c b/bfd/targets.c
4465index 417743efc0e..333f05c55f4 100644
4466--- a/bfd/targets.c
4467+++ b/bfd/targets.c
4468@@ -795,6 +795,8 @@ extern const bfd_target mep_elf32_le_vec;
4469 extern const bfd_target metag_elf32_vec;
4470 extern const bfd_target microblaze_elf32_vec;
4471 extern const bfd_target microblaze_elf32_le_vec;
4472+extern const bfd_target microblaze_elf64_vec;
4473+extern const bfd_target microblaze_elf64_le_vec;
4474 extern const bfd_target mips_ecoff_be_vec;
4475 extern const bfd_target mips_ecoff_le_vec;
4476 extern const bfd_target mips_ecoff_bele_vec;
4477@@ -1165,6 +1167,10 @@ static const bfd_target * const _bfd_target_vector[] =
4478
4479 &metag_elf32_vec,
4480
4481+#ifdef BFD64
4482+ &microblaze_elf64_vec,
4483+ &microblaze_elf64_le_vec,
4484+#endif
4485 &microblaze_elf32_vec,
4486
4487 &mips_ecoff_be_vec,
4488diff --git a/gdb/features/Makefile b/gdb/features/Makefile
4489index fc3196864c9..1bb198abfd3 100644
4490--- a/gdb/features/Makefile
4491+++ b/gdb/features/Makefile
4492@@ -101,7 +101,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
4493 # to make on the command line.
4494 XMLTOC = \
4495 microblaze-with-stack-protect.xml \
4496+ microblaze64-with-stack-protect.xml \
4497 microblaze.xml \
4498+ microblaze64.xml \
4499 mips-dsp-linux.xml \
4500 mips-linux.xml \
4501 mips64-dsp-linux.xml \
4502diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
4503index 29fdd6c0a2f..a5c3cce069d 100644
4504--- a/gdb/features/microblaze-core.xml
4505+++ b/gdb/features/microblaze-core.xml
4506@@ -8,7 +8,7 @@
4507 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4508 <feature name="org.gnu.gdb.microblaze.core">
4509 <reg name="r0" bitsize="32" regnum="0"/>
4510- <reg name="r1" bitsize="32" type="data_ptr"/>
4511+ <reg name="r1" bitsize="32"/>
4512 <reg name="r2" bitsize="32"/>
4513 <reg name="r3" bitsize="32"/>
4514 <reg name="r4" bitsize="32"/>
4515@@ -39,7 +39,7 @@
4516 <reg name="r29" bitsize="32"/>
4517 <reg name="r30" bitsize="32"/>
4518 <reg name="r31" bitsize="32"/>
4519- <reg name="rpc" bitsize="32" type="code_ptr"/>
4520+ <reg name="rpc" bitsize="32"/>
4521 <reg name="rmsr" bitsize="32"/>
4522 <reg name="rear" bitsize="32"/>
4523 <reg name="resr" bitsize="32"/>
4524@@ -64,4 +64,6 @@
4525 <reg name="rtlbsx" bitsize="32"/>
4526 <reg name="rtlblo" bitsize="32"/>
4527 <reg name="rtlbhi" bitsize="32"/>
4528+ <reg name="slr" bitsize="32"/>
4529+ <reg name="shr" bitsize="32"/>
4530 </feature>
4531diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
4532index aac51ea471c..722a51f0df5 100644
4533--- a/gdb/features/microblaze-stack-protect.xml
4534+++ b/gdb/features/microblaze-stack-protect.xml
4535@@ -7,6 +7,6 @@
4536
4537 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4538 <feature name="org.gnu.gdb.microblaze.stack-protect">
4539- <reg name="rslr" bitsize="32"/>
4540- <reg name="rshr" bitsize="32"/>
4541+ <reg name="slr" bitsize="32"/>
4542+ <reg name="shr" bitsize="32"/>
4543 </feature>
4544diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
4545index aa180bf35d5..6a9e74c7a6f 100644
4546--- a/gdb/features/microblaze-with-stack-protect.c
4547+++ b/gdb/features/microblaze-with-stack-protect.c
4548@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4549
4550 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
4551 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4552- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4553+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4554 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4555 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4556 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4557@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4558 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4559 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4560 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4561- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4562+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4563 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4564 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4565 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4566@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4567 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4568
4569 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
4570- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
4571- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
4572+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
4573+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
4574
4575 tdesc_microblaze_with_stack_protect = result.release ();
4576 }
4577diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
4578index ef2c64c720e..201232dff83 100644
4579--- a/gdb/features/microblaze.c
4580+++ b/gdb/features/microblaze.c
4581@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
4582
4583 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
4584 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4585- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4586+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4587 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4588 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4589 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4590@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
4591 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4592 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4593 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4594- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4595+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4596 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4597 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4598 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4599@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
4600 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4601 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4602 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4603+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4604+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4605 3842
4606 tdesc_microblaze = result.release (); 3843+static const char *microblaze_abi_string;
4607 }
4608diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
4609new file mode 100644
4610index 00000000000..96e99e2fb24
4611--- /dev/null
4612+++ b/gdb/features/microblaze64-core.xml
4613@@ -0,0 +1,69 @@
4614+<?xml version="1.0"?>
4615+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4616+
4617+ Copying and distribution of this file, with or without modification,
4618+ are permitted in any medium without royalty provided the copyright
4619+ notice and this notice are preserved. -->
4620+
4621+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4622+<feature name="org.gnu.gdb.microblaze64.core">
4623+ <reg name="r0" bitsize="64" regnum="0"/>
4624+ <reg name="r1" bitsize="64"/>
4625+ <reg name="r2" bitsize="64"/>
4626+ <reg name="r3" bitsize="64"/>
4627+ <reg name="r4" bitsize="64"/>
4628+ <reg name="r5" bitsize="64"/>
4629+ <reg name="r6" bitsize="64"/>
4630+ <reg name="r7" bitsize="64"/>
4631+ <reg name="r8" bitsize="64"/>
4632+ <reg name="r9" bitsize="64"/>
4633+ <reg name="r10" bitsize="64"/>
4634+ <reg name="r11" bitsize="64"/>
4635+ <reg name="r12" bitsize="64"/>
4636+ <reg name="r13" bitsize="64"/>
4637+ <reg name="r14" bitsize="64"/>
4638+ <reg name="r15" bitsize="64"/>
4639+ <reg name="r16" bitsize="64"/>
4640+ <reg name="r17" bitsize="64"/>
4641+ <reg name="r18" bitsize="64"/>
4642+ <reg name="r19" bitsize="64"/>
4643+ <reg name="r20" bitsize="64"/>
4644+ <reg name="r21" bitsize="64"/>
4645+ <reg name="r22" bitsize="64"/>
4646+ <reg name="r23" bitsize="64"/>
4647+ <reg name="r24" bitsize="64"/>
4648+ <reg name="r25" bitsize="64"/>
4649+ <reg name="r26" bitsize="64"/>
4650+ <reg name="r27" bitsize="64"/>
4651+ <reg name="r28" bitsize="64"/>
4652+ <reg name="r29" bitsize="64"/>
4653+ <reg name="r30" bitsize="64"/>
4654+ <reg name="r31" bitsize="64"/>
4655+ <reg name="rpc" bitsize="64"/>
4656+ <reg name="rmsr" bitsize="32"/>
4657+ <reg name="rear" bitsize="64"/>
4658+ <reg name="resr" bitsize="32"/>
4659+ <reg name="rfsr" bitsize="32"/>
4660+ <reg name="rbtr" bitsize="64"/>
4661+ <reg name="rpvr0" bitsize="32"/>
4662+ <reg name="rpvr1" bitsize="32"/>
4663+ <reg name="rpvr2" bitsize="32"/>
4664+ <reg name="rpvr3" bitsize="32"/>
4665+ <reg name="rpvr4" bitsize="32"/>
4666+ <reg name="rpvr5" bitsize="32"/>
4667+ <reg name="rpvr6" bitsize="32"/>
4668+ <reg name="rpvr7" bitsize="32"/>
4669+ <reg name="rpvr8" bitsize="64"/>
4670+ <reg name="rpvr9" bitsize="64"/>
4671+ <reg name="rpvr10" bitsize="32"/>
4672+ <reg name="rpvr11" bitsize="32"/>
4673+ <reg name="redr" bitsize="32"/>
4674+ <reg name="rpid" bitsize="32"/>
4675+ <reg name="rzpr" bitsize="32"/>
4676+ <reg name="rtlbx" bitsize="32"/>
4677+ <reg name="rtlbsx" bitsize="32"/>
4678+ <reg name="rtlblo" bitsize="32"/>
4679+ <reg name="rtlbhi" bitsize="32"/>
4680+ <reg name="slr" bitsize="64"/>
4681+ <reg name="shr" bitsize="64"/>
4682+</feature>
4683diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
4684new file mode 100644
4685index 00000000000..1bbf5fc3cea
4686--- /dev/null
4687+++ b/gdb/features/microblaze64-stack-protect.xml
4688@@ -0,0 +1,12 @@
4689+<?xml version="1.0"?>
4690+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4691+
4692+ Copying and distribution of this file, with or without modification,
4693+ are permitted in any medium without royalty provided the copyright
4694+ notice and this notice are preserved. -->
4695+
4696+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4697+<feature name="org.gnu.gdb.microblaze64.stack-protect">
4698+ <reg name="slr" bitsize="64"/>
4699+ <reg name="shr" bitsize="64"/>
4700+</feature>
4701diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
4702new file mode 100644
4703index 00000000000..a4de4666c76
4704--- /dev/null
4705+++ b/gdb/features/microblaze64-with-stack-protect.c
4706@@ -0,0 +1,79 @@
4707+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4708+ Original: microblaze-with-stack-protect.xml */
4709+ 3844+
4710+#include "defs.h" 3845+static const char *const microblaze_abi_strings[] = {
4711+#include "osabi.h" 3846+ "auto",
4712+#include "target-descriptions.h" 3847+ "m64",
3848+};
3849+
3850+enum microblaze_abi
3851+microblaze_abi (struct gdbarch *gdbarch)
3852+{
3853+ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
3854+ return tdep->microblaze_abi;
3855+}
3856 /* The registers of the Xilinx microblaze processor. */
3857
3858+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
3859+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
4713+ 3860+
4714+struct target_desc *tdesc_microblaze64_with_stack_protect;
4715+static void 3861+static void
4716+initialize_tdesc_microblaze64_with_stack_protect (void) 3862+microblaze_abi_update (const char *ignore_args,
3863+ int from_tty, struct cmd_list_element *c)
4717+{ 3864+{
4718+ target_desc_up result = allocate_target_description (); 3865+ struct gdbarch_info info;
4719+ struct tdesc_feature *feature; 3866+
4720+ 3867+ /* Force the architecture to update, and (if it's a microblaze architecture)
4721+ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core"); 3868+ * microblaze_gdbarch_init will take care of the rest. */
4722+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); 3869+// gdbarch_info_init (&info);
4723+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); 3870+ gdbarch_update_p (info);
4724+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
4725+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4726+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4727+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4728+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4729+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4730+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4731+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4732+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4733+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4734+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4735+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4736+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4737+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4738+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4739+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4740+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4741+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4742+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4743+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4744+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4745+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4746+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4747+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4748+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4749+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4750+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4751+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4752+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4753+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4754+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4755+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4756+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
4757+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4758+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4759+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4760+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4761+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4762+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4763+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4764+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4765+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4766+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4767+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4768+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4769+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4770+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4771+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4772+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4773+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4774+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4775+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4776+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4777+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4778+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4779+
4780+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect");
4781+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4782+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4783+
4784+ tdesc_microblaze64_with_stack_protect = result.release();
4785+} 3871+}
4786diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
4787new file mode 100644
4788index 00000000000..0e9f01611f3
4789--- /dev/null
4790+++ b/gdb/features/microblaze64-with-stack-protect.xml
4791@@ -0,0 +1,12 @@
4792+<?xml version="1.0"?>
4793+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4794+
4795+ Copying and distribution of this file, with or without modification,
4796+ are permitted in any medium without royalty provided the copyright
4797+ notice and this notice are preserved. -->
4798+
4799+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4800+<target>
4801+ <xi:include href="microblaze64-core.xml"/>
4802+ <xi:include href="microblaze64-stack-protect.xml"/>
4803+</target>
4804diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
4805new file mode 100644
4806index 00000000000..8ab7a90dd95
4807--- /dev/null
4808+++ b/gdb/features/microblaze64.c
4809@@ -0,0 +1,77 @@
4810+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4811+ Original: microblaze.xml */
4812+ 3872+
4813+#include "defs.h"
4814+#include "osabi.h"
4815+#include "target-descriptions.h"
4816+ 3873+
4817+struct target_desc *tdesc_microblaze64; 3874+static enum microblaze_abi
4818+static void 3875+global_microblaze_abi (void)
4819+initialize_tdesc_microblaze64 (void)
4820+{ 3876+{
4821+ target_desc_up result = allocate_target_description (); 3877+ int i;
4822+ struct tdesc_feature *feature; 3878+
4823+ 3879+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
4824+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core"); 3880+ if (microblaze_abi_strings[i] == microblaze_abi_string)
4825+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); 3881+ return (enum microblaze_abi) i;
4826+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); 3882+
4827+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); 3883+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
4828+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4829+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4830+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4831+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4832+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4833+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4834+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4835+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4836+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4837+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4838+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4839+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4840+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4841+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4842+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4843+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4844+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4845+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4846+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4847+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4848+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4849+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4850+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4851+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4852+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4853+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4854+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4855+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4856+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4857+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4858+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4859+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
4860+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4861+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4862+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4863+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4864+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4865+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4866+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4867+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4868+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4869+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4870+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4871+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4872+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4873+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4874+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4875+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4876+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4877+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4878+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4879+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4880+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4881+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4882+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4883+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4884+
4885+ tdesc_microblaze64 = result.release();
4886+} 3884+}
4887diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
4888new file mode 100644
4889index 00000000000..515d18e65cf
4890--- /dev/null
4891+++ b/gdb/features/microblaze64.xml
4892@@ -0,0 +1,11 @@
4893+<?xml version="1.0"?>
4894+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4895+
4896+ Copying and distribution of this file, with or without modification,
4897+ are permitted in any medium without royalty provided the copyright
4898+ notice and this notice are preserved. -->
4899+
4900+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4901+<target>
4902+ <xi:include href="microblaze64-core.xml"/>
4903+</target>
4904diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
4905index fc52adffb72..f2db32f0087 100644
4906--- a/gdb/microblaze-linux-tdep.c
4907+++ b/gdb/microblaze-linux-tdep.c
4908@@ -40,6 +40,7 @@
4909 #include "features/microblaze-linux.c"
4910
4911 static int microblaze_debug_flag = 0;
4912+int MICROBLAZE_REGISTER_SIZE=4;
4913
4914 static void
4915 microblaze_debug (const char *fmt, ...)
4916@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...)
4917 }
4918 }
4919
4920+#if 0
4921 static int
4922 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4923 struct bp_target_info *bp_tgt)
4924@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4925 return val;
4926 }
4927
4928+#endif
4929+ 3885+
4930 static void 3886+static void
4931 microblaze_linux_sigtramp_cache (struct frame_info *next_frame, 3887+show_microblaze_abi (struct ui_file *file,
4932 struct trad_frame_cache *this_cache, 3888+ int from_tty,
4933@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info, 3889+ struct cmd_list_element *ignored_cmd,
4934 3890+ const char *ignored_value)
4935 linux_init_abi (info, gdbarch, 0); 3891+{
4936 3892+ enum microblaze_abi global_abi = global_microblaze_abi ();
4937- set_gdbarch_memory_remove_breakpoint (gdbarch, 3893+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
4938- microblaze_linux_memory_remove_breakpoint); 3894+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
4939+ // set_gdbarch_memory_remove_breakpoint (gdbarch, 3895+
4940+ // microblaze_linux_memory_remove_breakpoint); 3896+#if 1
4941 3897+ if (global_abi == MICROBLAZE_ABI_AUTO)
4942 /* Shared library handling. */ 3898+ fprintf_filtered
4943 set_solib_svr4_fetch_link_map_offsets (gdbarch, 3899+ (file,
4944@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info, 3900+ "The microblaze ABI is set automatically (currently \"%s\").\n",
4945 3901+ actual_abi_str);
4946 /* BFD target for core files. */ 3902+ else if (global_abi == actual_abi)
4947 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 3903+ fprintf_filtered
4948- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); 3904+ (file,
4949+ { 3905+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
4950+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { 3906+ actual_abi_str);
4951+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
4952+ MICROBLAZE_REGISTER_SIZE=8;
4953+ }
4954+ else 3907+ else
4955+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); 3908+ {
4956+ } 3909+#endif
4957 else 3910+ /* Probably shouldn't happen... */
4958- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); 3911+ fprintf_filtered (file,
4959+ { 3912+ "The (auto detected) microblaze ABI \"%s\" is in use "
4960+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { 3913+ "even though the user setting was \"%s\".\n",
4961+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel"); 3914+ actual_abi_str, microblaze_abi_strings[global_abi]);
4962+ MICROBLAZE_REGISTER_SIZE=8;
4963+ } 3915+ }
4964+ else 3916+}
4965+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); 3917+
4966+ } 3918+static void
4967 3919+show_microblaze_command (const char *args, int from_tty)
4968+ switch (info.bfd_arch_info->mach)
4969+ {
4970+ case bfd_mach_microblaze64:
4971+ set_gdbarch_ptr_bit (gdbarch, 64);
4972+ break;
4973+ }
4974
4975 /* Shared library handling. */
4976 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
4977@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep ();
4978 void
4979 _initialize_microblaze_linux_tdep ()
4980 {
4981- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
4982+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
4983+ microblaze_linux_init_abi);
4984+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
4985 microblaze_linux_init_abi);
4986 initialize_tdesc_microblaze_linux ();
4987 }
4988diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
4989index ccb6b730d64..c347bb9516b 100644
4990--- a/gdb/microblaze-tdep.c
4991+++ b/gdb/microblaze-tdep.c
4992@@ -40,7 +40,9 @@
4993 #include "remote.h"
4994
4995 #include "features/microblaze-with-stack-protect.c"
4996+#include "features/microblaze64-with-stack-protect.c"
4997 #include "features/microblaze.c"
4998+#include "features/microblaze64.c"
4999
5000 /* Instruction macros used for analyzing the prologue. */
5001 /* This set of instruction macros need to be changed whenever the
5002@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] =
5003 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
5004 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
5005 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
5006- "rslr", "rshr"
5007+ "slr", "shr"
5008 };
5009
5010 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
5011
5012 static unsigned int microblaze_debug_flag = 0;
5013+int reg_size = 4;
5014
5015 #define microblaze_debug(fmt, ...) \
5016 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
5017@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
5018 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
5019
5020 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
5021+static CORE_ADDR
5022+microblaze_store_arguments (struct regcache *regcache, int nargs,
5023+ struct value **args, CORE_ADDR sp,
5024+ int struct_return, CORE_ADDR struct_addr)
5025+{ 3920+{
5026+ error (_("store_arguments not implemented")); 3921+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
5027+ return sp;
5028+} 3922+}
5029+#if 0 3923+
5030 static int
5031 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5032 struct bp_target_info *bp_tgt)
5033@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5034 /* Make sure we see the memory breakpoints. */
5035 scoped_restore restore_memory
5036 = make_scoped_restore_show_memory_breakpoints (1);
5037-
5038 val = target_read_memory (addr, old_contents, bplen);
5039
5040 /* If our breakpoint is no longer at the address, this means that the
5041@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5042 return val;
5043 }
5044
5045+#endif
5046 /* Allocate and initialize a frame cache. */
5047
5048 static struct microblaze_frame_cache *
5049@@ -577,17 +589,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
5050 gdb_byte *valbuf)
5051 {
5052 gdb_byte buf[8];
5053-
5054 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
5055 switch (TYPE_LENGTH (type))
5056 {
5057 case 1: /* return last byte in the register. */
5058 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5059- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
5060+ memcpy(valbuf, buf + reg_size - 1, 1);
5061 return;
5062 case 2: /* return last 2 bytes in register. */
5063 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5064- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
5065+ memcpy(valbuf, buf + reg_size - 2, 2);
5066 return;
5067 case 4: /* for sizes 4 or 8, copy the required length. */
5068 case 8:
5069@@ -754,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache)
5070 }
5071 #endif
5072
5073+static void 3924+static void
5074+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) 3925+set_microblaze_command (const char *args, int from_tty)
5075+{ 3926+{
5076+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc); 3927+ printf_unfiltered
3928+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
3929+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
5077+} 3930+}
5078+ 3931+
5079 static int dwarf2_to_reg_map[78] = 3932 static const char * const microblaze_register_names[] =
5080 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
5081 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
5082@@ -788,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
5083 static void
5084 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
5085 { 3933 {
5086+ 3934 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
5087 register_remote_g_packet_guess (gdbarch, 3935@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] =
5088 4 * MICROBLAZE_NUM_CORE_REGS, 3936 static unsigned int microblaze_debug_flag = 0;
5089- tdesc_microblaze); 3937 int reg_size = 4;
5090+ tdesc_microblaze64);
5091
5092 register_remote_g_packet_guess (gdbarch,
5093 4 * MICROBLAZE_NUM_REGS,
5094- tdesc_microblaze_with_stack_protect);
5095+ tdesc_microblaze64_with_stack_protect);
5096 }
5097
5098 void
5099@@ -802,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset,
5100 struct regcache *regcache,
5101 int regnum, const void *gregs)
5102 {
5103- const unsigned int *regs = (const unsigned int *)gregs;
5104+ const gdb_byte *regs = (const gdb_byte *) gregs;
5105 if (regnum >= 0)
5106 regcache->raw_supply (regnum, regs + regnum);
5107
5108@@ -810,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset,
5109 int i;
5110
5111 for (i = 0; i < 50; i++) {
5112- regcache->raw_supply (i, regs + i);
5113+ regcache->raw_supply (regnum, regs + i);
5114 }
5115 }
5116 }
5117@@ -833,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
5118 }
5119
5120 3938
5121+static void 3939+unsigned int
5122+make_regs (struct gdbarch *arch) 3940+microblaze_abi_regsize (struct gdbarch *gdbarch)
5123+{ 3941+{
5124+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch); 3942+ switch (microblaze_abi (gdbarch))
5125+ int mach = gdbarch_bfd_arch_info (arch)->mach;
5126+
5127+ if (mach == bfd_mach_microblaze64)
5128+ { 3943+ {
5129+ set_gdbarch_ptr_bit (arch, 64); 3944+ case MICROBLAZE_ABI_M64:
3945+ return 8;
3946+ default:
3947+ return 4;
5130+ } 3948+ }
5131+} 3949+}
3950+
3951 #define microblaze_debug(fmt, ...) \
3952 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
3953- fmt, ## __VA_ARGS__)
3954+ fmt, ## __VA_ARGS__)
5132 3955
5133 static struct gdbarch * 3956
3957 /* Return the name of register REGNUM. */
3958@@ -867,15 +966,30 @@ static struct gdbarch *
5134 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3959 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5135@@ -846,8 +875,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3960 {
5136 if (arches != NULL) 3961 tdesc_arch_data_up tdesc_data;
3962+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
3963 const struct target_desc *tdesc = info.target_desc;
3964
3965+ /* What has the user specified from the command line? */
3966+ wanted_abi = global_microblaze_abi ();
3967+ if (gdbarch_debug)
3968+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
3969+ wanted_abi);
3970+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
3971+ microblaze_abi = wanted_abi;
3972+
3973 /* If there is already a candidate, use it. */
3974 arches = gdbarch_list_lookup_by_info (arches, &info);
3975- if (arches != NULL)
3976+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
5137 return arches->gdbarch; 3977 return arches->gdbarch;
5138 if (tdesc == NULL) 3978+
5139- tdesc = tdesc_microblaze; 3979+ if (microblaze_abi == MICROBLAZE_ABI_M64)
5140-
5141+ { 3980+ {
5142+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 3981+ tdesc = tdesc_microblaze64;
5143+ {
5144+ tdesc = tdesc_microblaze64;
5145+ reg_size = 8; 3982+ reg_size = 8;
5146+ }
5147+ else
5148+ tdesc = tdesc_microblaze;
5149+ } 3983+ }
5150 /* Check any target description for validity. */ 3984 if (tdesc == NULL)
5151 if (tdesc_has_registers (tdesc))
5152 { 3985 {
5153@@ -855,31 +891,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3986- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
3987+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
3988 {
3989 tdesc = tdesc_microblaze64;
3990 reg_size = 8;
3991@@ -890,7 +1004,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5154 int valid_p; 3992 int valid_p;
5155 int i; 3993 int i;
5156 3994
5157- feature = tdesc_find_feature (tdesc, 3995- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5158- "org.gnu.gdb.microblaze.core"); 3996+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
5159+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 3997 feature = tdesc_find_feature (tdesc,
5160+ feature = tdesc_find_feature (tdesc, 3998 "org.gnu.gdb.microblaze64.core");
5161+ "org.gnu.gdb.microblaze64.core"); 3999 else
5162+ else 4000@@ -904,7 +1018,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5163+ feature = tdesc_find_feature (tdesc, 4001 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
5164+ "org.gnu.gdb.microblaze.core"); 4002 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
5165 if (feature == NULL) 4003 microblaze_register_names[i]);
5166 return NULL; 4004- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5167 tdesc_data = tdesc_data_alloc (); 4005+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
5168 4006 feature = tdesc_find_feature (tdesc,
5169 valid_p = 1; 4007 "org.gnu.gdb.microblaze64.stack-protect");
5170- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++) 4008 else
5171- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i, 4009@@ -954,7 +1068,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5172- microblaze_register_names[i]); 4010 set_gdbarch_ptr_bit (gdbarch, 64);
5173- feature = tdesc_find_feature (tdesc, 4011 break;
5174- "org.gnu.gdb.microblaze.stack-protect");
5175+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
5176+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
5177+ microblaze_register_names[i]);
5178+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5179+ feature = tdesc_find_feature (tdesc,
5180+ "org.gnu.gdb.microblaze64.stack-protect");
5181+ else
5182+ feature = tdesc_find_feature (tdesc,
5183+ "org.gnu.gdb.microblaze.stack-protect");
5184 if (feature != NULL)
5185- {
5186- valid_p = 1;
5187- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
5188- MICROBLAZE_SLR_REGNUM,
5189- "rslr");
5190- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
5191- MICROBLAZE_SHR_REGNUM,
5192- "rshr");
5193- }
5194+ {
5195+ valid_p = 1;
5196+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
5197+ MICROBLAZE_SLR_REGNUM,
5198+ "slr");
5199+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
5200+ MICROBLAZE_SHR_REGNUM,
5201+ "shr");
5202+ }
5203
5204 if (!valid_p)
5205- return NULL;
5206+ {
5207+ // tdesc_data_cleanup (tdesc_data.get ());
5208+ return NULL;
5209+ }
5210 } 4012 }
5211 4013-
5212 /* Allocate space for the new architecture. */ 4014+ if(microblaze_abi == MICROBLAZE_ABI_M64)
5213@@ -899,7 +946,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4015+ set_gdbarch_ptr_bit (gdbarch, 64);
5214 /* Register numbers of various important registers. */ 4016
5215 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
5216 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
5217+
5218+ /* Register set.
5219+ make_regs (gdbarch); */
5220+ switch (info.bfd_arch_info->mach)
5221+ {
5222+ case bfd_mach_microblaze64:
5223+ set_gdbarch_ptr_bit (gdbarch, 64);
5224+ break;
5225+ }
5226
5227+
5228 /* Map Dwarf2 registers to GDB registers. */ 4017 /* Map Dwarf2 registers to GDB registers. */
5229 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 4018 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
4019@@ -1014,6 +1129,38 @@ _initialize_microblaze_tdep ()
4020 {
4021 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
5230 4022
5231@@ -919,7 +976,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4023+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
5232 microblaze_breakpoint::kind_from_pc); 4024+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
5233 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 4025+
5234 microblaze_breakpoint::bp_from_kind); 4026+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
5235- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 4027+
5236+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 4028+ add_setshow_prefix_cmd ("microblaze", no_class,
5237+ 4029+ _("Various microblaze specific commands."),
5238+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); 4030+ _("Various microblaze specific commands."),
5239 4031+ &setmicroblazecmdlist,&showmicroblazecmdlist,
5240 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); 4032+ &setlist,&showlist);
5241 4033+#if 0
5242@@ -927,7 +986,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4034+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
5243 4035+ _("Various microblaze specific commands."),
5244 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); 4036+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
5245 4037+
5246- microblaze_register_g_packet_guesses (gdbarch); 4038+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
5247+ //microblaze_register_g_packet_guesses (gdbarch); 4039+ _("Various microblaze specific commands."),
5248 4040+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
5249 frame_base_set_default (gdbarch, &microblaze_frame_base); 4041+#endif
5250 4042+
5251@@ -942,12 +1001,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4043+ /* Allow the user to override the ABI. */
5252 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); 4044+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
5253 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); 4045+ &microblaze_abi_string, _("\
4046+Set the microblaze ABI used by this program."), _("\
4047+Show the microblaze ABI used by this program."), _("\
4048+This option can be set to one of:\n\
4049+ auto - the default ABI associated with the current binary\n\
4050+ m64"),
4051+ microblaze_abi_update,
4052+ show_microblaze_abi,
4053+ &setmicroblazecmdlist, &showmicroblazecmdlist);
4054+
4055 initialize_tdesc_microblaze_with_stack_protect ();
4056 initialize_tdesc_microblaze ();
4057 initialize_tdesc_microblaze64_with_stack_protect ();
4058@@ -1028,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."),
4059 NULL,
4060 &setdebuglist, &showdebuglist);
5254 4061
5255- /* If we have register sets, enable the generic core file support. */
5256+ /* If we have register sets, enable the generic core file support.
5257 if (tdep->gregset) {
5258 set_gdbarch_iterate_over_regset_sections (gdbarch,
5259 microblaze_iterate_over_regset_sections);
5260- }
5261- 4062-
5262+ }*/
5263 return gdbarch;
5264 } 4063 }
5265
5266@@ -959,6 +1017,8 @@ _initialize_microblaze_tdep ()
5267
5268 initialize_tdesc_microblaze_with_stack_protect ();
5269 initialize_tdesc_microblaze ();
5270+ initialize_tdesc_microblaze64_with_stack_protect ();
5271+ initialize_tdesc_microblaze64 ();
5272 /* Debug this files internals. */
5273 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
5274 &microblaze_debug_flag, _("\
5275diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 4064diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
5276index 2415acfe7b6..f4d810303ca 100644 4065index 542cdd82070..17a4bb5190c 100644
5277--- a/gdb/microblaze-tdep.h 4066--- a/gdb/microblaze-tdep.h
5278+++ b/gdb/microblaze-tdep.h 4067+++ b/gdb/microblaze-tdep.h
5279@@ -28,7 +28,7 @@ struct microblaze_gregset 4068@@ -19,9 +19,17 @@
5280 microblaze_gregset() {}
5281 unsigned int gregs[32];
5282 unsigned int fpregs[32];
5283- unsigned int pregs[16];
5284+ unsigned int pregs[18];
5285 };
5286
5287 struct microblaze_gdbarch_tdep : gdbarch_tdep
5288@@ -134,7 +134,7 @@ struct microblaze_frame_cache
5289 struct trad_frame_saved_reg *saved_regs;
5290 };
5291 /* All registers are 32 bits. */
5292-#define MICROBLAZE_REGISTER_SIZE 4
5293+//#define MICROBLAZE_REGISTER_SIZE 8
5294
5295 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
5296 Only used for native debugging. */
5297diff --git a/include/elf/common.h b/include/elf/common.h
5298index 70d63e3299c..8aa330d6631 100644
5299--- a/include/elf/common.h
5300+++ b/include/elf/common.h
5301@@ -360,6 +360,7 @@
5302 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
5303 #define EM_TACHYUM 261 /* Tachyum */
5304 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
5305+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
5306
5307 /* If it is necessary to assign new unofficial EM_* values, please pick large
5308 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
5309diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
5310index 43ad3ad3904..79799b86a49 100644
5311--- a/include/elf/microblaze.h
5312+++ b/include/elf/microblaze.h
5313@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
5314 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
5315 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
5316 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
5317+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
5318+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
5319+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
5320+
5321 END_RELOC_NUMBERS (R_MICROBLAZE_max)
5322
5323 /* Global base address names. */
5324diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
5325index b057492ba93..283d87c04a2 100644
5326--- a/opcodes/microblaze-dis.c
5327+++ b/opcodes/microblaze-dis.c
5328@@ -33,6 +33,7 @@
5329 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
5330 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
5331 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
5332+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
5333 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
5334
5335 #define NUM_STRBUFS 3
5336@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
5337 }
5338 4069
5339 static char * 4070 #ifndef MICROBLAZE_TDEP_H
5340-get_field_imm5 (struct string_buf *buf, long instr) 4071 #define MICROBLAZE_TDEP_H 1
5341+get_field_imml (struct string_buf *buf, long instr) 4072-
5342 { 4073+#include "objfiles.h"
5343 char *p = strbuf (buf); 4074 #include "gdbarch.h"
5344
5345- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
5346+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
5347+ return p;
5348+}
5349+
5350+static char *
5351+get_field_imms (struct string_buf *buf, long instr)
5352+{
5353+ char *p = strbuf (buf);
5354+
5355+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
5356 return p;
5357 }
5358
5359@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
5360 return p;
5361 }
5362
5363+static char *
5364+get_field_immw (struct string_buf *buf, long instr)
5365+{
5366+ char *p = strbuf (buf);
5367+
5368+ if (instr & 0x00004000)
5369+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
5370+ else
5371+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
5372+ return p;
5373+}
5374+
5375 static char *
5376 get_field_rfsl (struct string_buf *buf, long instr)
5377 {
5378@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5379 }
5380 }
5381 break;
5382- case INST_TYPE_RD_R1_IMM5:
5383+ case INST_TYPE_RD_R1_IMML:
5384+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
5385+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
5386+ /* TODO: Also print symbol */
5387+ break;
5388+ case INST_TYPE_RD_R1_IMMS:
5389 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
5390- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
5391+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
5392 break;
5393 case INST_TYPE_RD_RFSL:
5394 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
5395@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5396 }
5397 }
5398 break;
5399- case INST_TYPE_RD_R2:
5400- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
5401- get_field_r2 (&buf, inst));
5402+ case INST_TYPE_IMML:
5403+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
5404+ /* TODO: Also print symbol */
5405+ break;
5406+ case INST_TYPE_RD_R2:
5407+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
5408 break;
5409 case INST_TYPE_R2:
5410 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
5411@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5412 /* For mbar 16 or sleep insn. */
5413 case INST_TYPE_NONE:
5414 break;
5415- /* For tuqula instruction */
5416+ /* For bit field insns. */
5417+ case INST_TYPE_RD_R1_IMMW_IMMS:
5418+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
5419+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
5420+ break;
5421+ /* For tuqula instruction */
5422 case INST_TYPE_RD:
5423 print_func (stream, "\t%s", get_field_rd (&buf, inst));
5424 break;
5425diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
5426index ffb0f08c692..5e45df995de 100644
5427--- a/opcodes/microblaze-opc.h
5428+++ b/opcodes/microblaze-opc.h
5429@@ -40,7 +40,7 @@
5430 #define INST_TYPE_RD_SPECIAL 11
5431 #define INST_TYPE_R1 12
5432 /* New instn type for barrel shift imms. */
5433-#define INST_TYPE_RD_R1_IMM5 13
5434+#define INST_TYPE_RD_R1_IMMS 13
5435 #define INST_TYPE_RD_RFSL 14
5436 #define INST_TYPE_R1_RFSL 15
5437
5438@@ -59,6 +59,15 @@
5439 /* For mbar. */
5440 #define INST_TYPE_IMM5 20
5441
5442+/* For bsefi and bsifi */
5443+#define INST_TYPE_RD_R1_IMMW_IMMS 21
5444+
5445+/* For 64-bit instructions */
5446+#define INST_TYPE_IMML 22
5447+#define INST_TYPE_RD_R1_IMML 23
5448+#define INST_TYPE_R1_IMML 24
5449+#define INST_TYPE_RD_R1_IMMW_IMMS 21
5450+
5451 #define INST_TYPE_NONE 25
5452
5453
5454@@ -88,10 +97,14 @@
5455 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
5456 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
5457 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
5458-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
5459+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
5460+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
5461 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
5462+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
5463 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
5464+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
5465 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
5466+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
5467
5468 /* New Mask for msrset, msrclr insns. */
5469 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
5470@@ -101,7 +114,7 @@
5471 #define DELAY_SLOT 1
5472 #define NO_DELAY_SLOT 0
5473
5474-#define MAX_OPCODES 289
5475+#define MAX_OPCODES 412
5476 4075
5477 const struct op_code_struct 4076+struct gdbarch;
4077+enum microblaze_abi
4078+ {
4079+ MICROBLAZE_ABI_AUTO = 0,
4080+ MICROBLAZE_ABI_M64,
4081+ };
4082+
4083+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
4084 /* Microblaze architecture-specific information. */
4085 struct microblaze_gregset
5478 { 4086 {
5479@@ -119,6 +132,7 @@ const struct op_code_struct 4087@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep_base
5480 /* More info about output format here. */
5481 } microblaze_opcodes[MAX_OPCODES] =
5482 { 4088 {
5483+ /* 32-bit instructions */ 4089 int dummy; // declare something.
5484 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
5485 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
5486 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
5487@@ -155,9 +169,11 @@ const struct op_code_struct
5488 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
5489 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
5490 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
5491- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
5492- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
5493- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
5494+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
5495+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
5496+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
5497+ {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
5498+ {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
5499 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
5500 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
5501 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
5502@@ -174,9 +190,14 @@ const struct op_code_struct
5503 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
5504 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
5505 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
5506+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
5507 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
5508+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
5509+ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst },
5510 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
5511+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst },
5512 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
5513+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst },
5514 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
5515 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
5516 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
5517@@ -226,18 +247,24 @@ const struct op_code_struct
5518 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
5519 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
5520 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
5521+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst },
5522 {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
5523 {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst },
5524+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst },
5525 {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
5526 {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst },
5527 {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
5528+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst },
5529 {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
5530 {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst },
5531+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst },
5532 {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
5533 {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst },
5534+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst },
5535 {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
5536 {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst },
5537 {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
5538+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst },
5539 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
5540 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
5541 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
5542@@ -248,9 +275,7 @@ const struct op_code_struct
5543 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
5544 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
5545 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
5546- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5547 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
5548- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
5549 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
5550 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
5551 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
5552@@ -402,8 +427,135 @@ const struct op_code_struct
5553 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
5554 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
5555 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
5556+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */
5557+ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
5558 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
5559 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
5560+
5561+ /* 64-bit instructions */
5562+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
5563+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
5564+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
5565+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
5566+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
5567+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
5568+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
5569+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
5570+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
5571+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
5572+ {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5573+ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5574+ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5575+ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5576+ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5577+ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5578+ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5579+ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5580+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
5581+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
5582+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
5583+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
5584+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
5585+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
5586+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
5587+ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst },
5588+ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst },
5589+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
5590+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
5591+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
5592+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
5593+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
5594+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
5595+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
5596+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
5597+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
5598+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
5599+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
5600+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
5601+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
5602+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
5603+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
5604+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
5605+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
5606+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
5607+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
5608+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
5609+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
5610+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
5611+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
5612+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
5613+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
5614+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
5615+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
5616+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
5617+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
5618+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
5619+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
5620+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
5621+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
5622+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
5623+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
5624+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
5625+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
5626+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
5627+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
5628+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
5629+ {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5630+ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5631+ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5632+ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5633+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
5634+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
5635+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
5636+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
5637+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
5638+ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */
5639+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
5640+ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */
5641+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
5642+ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */
5643+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
5644+ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */
5645+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
5646+ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */
5647+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
5648+ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */
5649+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
5650+ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */
5651+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
5652+ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */
5653+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
5654+ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */
5655+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
5656+ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */
5657+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
5658+ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */
5659+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
5660+ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */
5661+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
5662+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
5663+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
5664+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
5665+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
5666+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
5667+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
5668+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
5669+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
5670+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
5671+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
5672+ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst },
5673+ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst },
5674+ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst },
5675+ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst },
5676+ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst },
5677+ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst },
5678+ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst },
5679+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
5680+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
5681+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
5682+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5683+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
5684+
5685 {"", 0, 0, 0, 0, 0, 0, 0, 0},
5686 };
5687
5688@@ -424,5 +576,17 @@ char pvr_register_prefix[] = "rpvr";
5689 #define MIN_IMM5 ((int) 0x00000000)
5690 #define MAX_IMM5 ((int) 0x0000001f)
5691 4090
5692+#define MIN_IMM6 ((int) 0x00000000) 4091+ enum microblaze_abi microblaze_abi {};
5693+#define MAX_IMM6 ((int) 0x0000003f) 4092+ enum microblaze_abi found_abi {};
5694+ 4093 /* Register sets. */
5695+#define MIN_IMM_WIDTH ((int) 0x00000001) 4094 struct regset *gregset;
5696+#define MAX_IMM_WIDTH ((int) 0x00000020) 4095 size_t sizeof_gregset;
5697+ 4096 struct regset *fpregset;
5698+#define MIN_IMM6_WIDTH ((int) 0x00000001) 4097 size_t sizeof_fpregset;
5699+#define MAX_IMM6_WIDTH ((int) 0x00000040) 4098+ int register_size;
5700+
5701+#define MIN_IMML ((long) 0xffffff8000000000L)
5702+#define MAX_IMML ((long) 0x0000007fffffffffL)
5703+
5704 #endif /* MICROBLAZE_OPC */
5705
5706diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
5707index 8e293465fec..254d9fe911e 100644
5708--- a/opcodes/microblaze-opcm.h
5709+++ b/opcodes/microblaze-opcm.h
5710@@ -25,22 +25,23 @@
5711
5712 enum microblaze_instr
5713 {
5714+ /* 32-bit instructions */
5715 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
5716 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
5717 mulh, mulhu, mulhsu,swapb,swaph,
5718 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
5719- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
5720+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
5721 /* 'or/and/xor' are C++ keywords. */
5722 microblaze_or, microblaze_and, microblaze_xor,
5723 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
5724- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
5725- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
5726- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5727+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse,
5728+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd,
5729+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5730 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
5731 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
5732- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
5733- shr, sw, swr, swx, lbui, lhui, lwi,
5734- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5735+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
5736+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
5737+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5738 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
5739 /* 'fsqrt' is a glibc:math.h symbol. */
5740 fint, microblaze_fsqrt,
5741@@ -59,6 +60,18 @@ enum microblaze_instr
5742 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
5743 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
5744 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
5745+
5746+ /* 64-bit instructions */
5747+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
5748+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
5749+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
5750+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
5751+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
5752+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
5753+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
5754+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
5755+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
5756+ dcmp_un, dbl, dlong, dsqrt,
5757 invalid_inst
5758 }; 4099 };
5759 4100
5760@@ -130,18 +143,25 @@ enum microblaze_instr_type 4101 /* Register numbers. */
5761 #define RB_LOW 11 /* Low bit for RB. */
5762 #define IMM_LOW 0 /* Low bit for immediate. */
5763 #define IMM_MBAR 21 /* low bit for mbar instruction. */
5764+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
5765
5766 #define RD_MASK 0x03E00000
5767 #define RA_MASK 0x001F0000
5768 #define RB_MASK 0x0000F800
5769 #define IMM_MASK 0x0000FFFF
5770+#define IMML_MASK 0x00FFFFFF
5771
5772-/* Imm mask for barrel shifts. */
5773+/* Imm masks for barrel shifts. */
5774 #define IMM5_MASK 0x0000001F
5775+#define IMM6_MASK 0x0000003F
5776
5777 /* Imm mask for mbar. */
5778 #define IMM5_MBAR_MASK 0x03E00000
5779
5780+/* Imm masks for extract/insert width. */
5781+#define IMM5_WIDTH_MASK 0x000007C0
5782+#define IMM6_WIDTH_MASK 0x00000FC0
5783+
5784 /* FSL imm mask for get, put instructions. */
5785 #define RFSL_MASK 0x000000F
5786
5787-- 4102--
57882.37.1 (Apple Git-137.1) 41032.34.1
5789 4104
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
index 941a3b9c..6769e1ee 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
@@ -1,32 +1,41 @@
1From 0532b1db08b9d8efc670f7288fe2d8168b8ed0d1 Mon Sep 17 00:00:00 2001 1From c37f307714121981fa91766c539913f7912643b7 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 21 Jul 2022 11:45:01 +0530 3Date: Thu, 21 Jul 2022 11:45:01 +0530
4Subject: [PATCH 8/8] =?UTF-8?q?[Patch,MicroBlaze]:=20Depth:=20=20Total=20n?= 4Subject: [PATCH 09/54] =?UTF-8?q?Depth:=20Total=20number=20of=20inline=20f?=
5 =?UTF-8?q?umber=20of=20inline=20functions=20[refer=20inline-frame.c]=20st?= 5 =?UTF-8?q?unctions=20[refer=20inline-frame.c]=20state->skipped=5Fframes?=
6 =?UTF-8?q?ate->skipped=5Fframes=20:=20Number=20of=20inline=20functions=20?= 6 =?UTF-8?q?=20:=20Number=20of=20inline=20functions=20skipped.=20the=20curr?=
7 =?UTF-8?q?skipped.=20the=20current=20unwind=5Fpc=20is=20causing=20an=20is?= 7 =?UTF-8?q?ent=20unwind=5Fpc=20is=20causing=20an=20issue=20when=20we=20try?=
8 =?UTF-8?q?sue=20when=20we=20try=20to=20step=20into=20inline=20functions[D?= 8 =?UTF-8?q?=20to=20step=20into=20inline=20functions[Depth=20is=20becoming?=
9 =?UTF-8?q?epth=20is=20becoming=200].=20It=E2=80=99s=20incrementing=20pc?= 9 =?UTF-8?q?=200].=20It=E2=80=99s=20incrementing=20pc=20by=208=20even=20wit?=
10 =?UTF-8?q?=20by=208=20even=20with=20si=20instruction.?= 10 =?UTF-8?q?h=20si=20instruction.?=
11MIME-Version: 1.0 11MIME-Version: 1.0
12Content-Type: text/plain; charset=UTF-8 12Content-Type: text/plain; charset=UTF-8
13Content-Transfer-Encoding: 8bit 13Content-Transfer-Encoding: 8bit
14 14
15Upstream-Status: Pending 15Signed-off-by: Aayush Misra <aayushm@amd.com>
16
17Signed-off-by: Mark Hatle <mark.hatle@amd.com>
18
19--- 16---
20 gdb/microblaze-tdep.c | 14 +++----------- 17 gdb/features/microblaze64.xml | 1 +
21 1 file changed, 3 insertions(+), 11 deletions(-) 18 gdb/microblaze-tdep.c | 14 +++-----------
19 2 files changed, 4 insertions(+), 11 deletions(-)
22 20
21diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
22index 515d18e65cf..9c1b7d22003 100644
23--- a/gdb/features/microblaze64.xml
24+++ b/gdb/features/microblaze64.xml
25@@ -7,5 +7,6 @@
26
27 <!DOCTYPE target SYSTEM "gdb-target.dtd">
28 <target>
29+ <architecture>microblaze64</architecture>
30 <xi:include href="microblaze64-core.xml"/>
31 </target>
23diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 32diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
24index d83072cdaef..38ba38e8c7d 100644 33index f265e8fc608..3e541789fac 100644
25--- a/gdb/microblaze-tdep.c 34--- a/gdb/microblaze-tdep.c
26+++ b/gdb/microblaze-tdep.c 35+++ b/gdb/microblaze-tdep.c
27@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, 36@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
28 static CORE_ADDR 37 static CORE_ADDR
29 microblaze_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) 38 microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
30 { 39 {
31- gdb_byte buf[4]; 40- gdb_byte buf[4];
32 CORE_ADDR pc; 41 CORE_ADDR pc;
@@ -61,5 +70,5 @@ index d83072cdaef..38ba38e8c7d 100644
61 70
62 static CORE_ADDR 71 static CORE_ADDR
63-- 72--
642.37.1 (Apple Git-137.1) 732.34.1
65 74
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch
deleted file mode 100644
index 6a930420..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 53b76bb548720367032a51a6d604c975b10bb30e Mon Sep 17 00:00:00 2001
2From: Aayush Misra <aayushm@amd.com>
3Date: Fri, 29 Mar 2024 14:59:16 +0530
4Subject: [PATCH] gdb/gdserver: Fix ABI settings for gdbserver
5
6Upstream-Status: Pending
7
8---
9 gdb/microblaze-tdep.c | 7 ++++---
10 1 file changed, 4 insertions(+), 3 deletions(-)
11
12diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
13index 38ba38e8c7d..35cec286d8f 100644
14--- a/gdb/microblaze-tdep.c
15+++ b/gdb/microblaze-tdep.c
16@@ -1120,12 +1120,13 @@ void _initialize_microblaze_tdep ();
17 void
18 _initialize_microblaze_tdep ()
19 {
20+ //Setting abi to auto manually, should be able to modify in 'arch'_gdbarch_init function
21+ microblaze_abi_string = microblaze_abi_strings[0];
22+
23 register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
24-// static struct cmd_list_element *setmicroblazecmdlist = NULL;
25-// static struct cmd_list_element *showmicroblazecmdlist = NULL;
26
27- /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
28
29+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
30 add_setshow_prefix_cmd ("microblaze", no_class,
31 _("Various microblaze specific commands."),
32 _("Various microblaze specific commands."),
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
new file mode 100644
index 00000000..e5c88f01
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
@@ -0,0 +1,133 @@
1From 6b6632b730808a012738f9eddf621abd6463e317 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:53:04 +0530
4Subject: [PATCH 10/54] Fix gdb-14 build errors for microblaze-xilinx-elf
5 2023.2 merge
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/elf64-microblaze.c | 12 ++++++++++++
10 gdb/frame.c | 2 +-
11 gdb/microblaze-tdep.c | 17 +++++++++++------
12 3 files changed, 24 insertions(+), 7 deletions(-)
13
14diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
15index 6cd9753a592..119d266f95a 100755
16--- a/bfd/elf64-microblaze.c
17+++ b/bfd/elf64-microblaze.c
18@@ -750,6 +750,18 @@ microblaze_elf_info_to_howto (bfd * abfd,
19 return true;
20 }
21
22+/* Relax table contains information about instructions which can
23+ be removed by relaxation -- replacing a long address with a
24+ short address. */
25+struct relax_table
26+{
27+ /* Address where bytes may be deleted. */
28+ bfd_vma addr;
29+
30+ /* Number of bytes to be deleted. */
31+ size_t size;
32+};
33+
34 struct _microblaze_elf_section_data
35 {
36 struct bfd_elf_section_data elf;
37diff --git a/gdb/frame.c b/gdb/frame.c
38index c4d967e01d5..8be230e0617 100644
39--- a/gdb/frame.c
40+++ b/gdb/frame.c
41@@ -1315,7 +1315,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
42 int i;
43
44 const gdb_byte *buf = NULL;
45- if (value_entirely_available(value)) {
46+ if (value->entirely_available()) {
47 gdb::array_view<const gdb_byte> buf = value->contents ();
48 }
49
50diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
51index 3e541789fac..f7d9d6419ce 100644
52--- a/gdb/microblaze-tdep.c
53+++ b/gdb/microblaze-tdep.c
54@@ -75,7 +75,7 @@ static const char *const microblaze_abi_strings[] = {
55 enum microblaze_abi
56 microblaze_abi (struct gdbarch *gdbarch)
57 {
58- microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
59+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
60 return tdep->microblaze_abi;
61 }
62 /* The registers of the Xilinx microblaze processor. */
63@@ -120,12 +120,12 @@ show_microblaze_abi (struct ui_file *file,
64
65 #if 1
66 if (global_abi == MICROBLAZE_ABI_AUTO)
67- fprintf_filtered
68+ gdb_printf
69 (file,
70 "The microblaze ABI is set automatically (currently \"%s\").\n",
71 actual_abi_str);
72 else if (global_abi == actual_abi)
73- fprintf_filtered
74+ gdb_printf
75 (file,
76 "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
77 actual_abi_str);
78@@ -133,7 +133,7 @@ show_microblaze_abi (struct ui_file *file,
79 {
80 #endif
81 /* Probably shouldn't happen... */
82- fprintf_filtered (file,
83+ gdb_printf (file,
84 "The (auto detected) microblaze ABI \"%s\" is in use "
85 "even though the user setting was \"%s\".\n",
86 actual_abi_str, microblaze_abi_strings[global_abi]);
87@@ -934,7 +934,7 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
88 void *cb_data,
89 const struct regcache *regcache)
90 {
91- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
92+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
93
94 cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
95
96@@ -942,6 +942,8 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
97 }
98
99
100+#if 0
101+// compilation errors - function is not actually used ?
102 static void
103 make_regs (struct gdbarch *arch)
104 {
105@@ -953,6 +955,7 @@ make_regs (struct gdbarch *arch)
106 set_gdbarch_ptr_bit (arch, 64);
107 }
108 }
109+#endif
110
111 static struct gdbarch *
112 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
113@@ -964,7 +967,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
114 /* What has the user specified from the command line? */
115 wanted_abi = global_microblaze_abi ();
116 if (gdbarch_debug)
117- fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
118+ gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
119 wanted_abi);
120 if (wanted_abi != MICROBLAZE_ABI_AUTO)
121 microblaze_abi = wanted_abi;
122@@ -1038,6 +1041,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
123 gdbarch *gdbarch
124 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
125
126+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
127+
128 tdep->gregset = NULL;
129 tdep->sizeof_gregset = 0;
130 tdep->fpregset = NULL;
131--
1322.34.1
133
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
new file mode 100644
index 00000000..d7e51502
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
@@ -0,0 +1,28 @@
1From 389711a13933a60323d368d5e5f1f54bd171b16b Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:55:16 +0530
4Subject: [PATCH 11/54] fix gdb microblaze-xilinx-elf crash issue on invocation
5 Regression from merging microblaze 64-bit support
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gdb/microblaze-tdep.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
13index f7d9d6419ce..d4b9ef837e5 100644
14--- a/gdb/microblaze-tdep.c
15+++ b/gdb/microblaze-tdep.c
16@@ -1124,6 +1124,9 @@ void _initialize_microblaze_tdep ();
17 void
18 _initialize_microblaze_tdep ()
19 {
20+ //Setting abi to auto manually, should be able to modify in 'arch'_gdbarch_init function
21+ microblaze_abi_string = microblaze_abi_strings[0];
22+
23 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
24
25 // static struct cmd_list_element *setmicroblazecmdlist = NULL;
26--
272.34.1
28
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
new file mode 100644
index 00000000..8e966788
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -0,0 +1,35 @@
1From ee4f6d0c1ea82b531d7481692e499fc0b35c88a8 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 13/54] Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7
8Conflicts:
9 bfd/elf-eh-frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/elf-eh-frame.c | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
16index bf7a9902355..21029b59632 100644
17--- a/bfd/elf-eh-frame.c
18+++ b/bfd/elf-eh-frame.c
19@@ -1045,10 +1045,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
20 goto success;
21
22 free_no_table:
23+/* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
24+if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
25 _bfd_error_handler
26 /* xgettext:c-format */
27 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
28 abfd, sec);
29+}
30 hdr_info->u.dwarf.table = false;
31 free (sec_info);
32 success:
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
new file mode 100644
index 00000000..41118c1a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -0,0 +1,43 @@
1From 6531ec7f986fff48b9efc883526018f494cf88fb Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 15/54] upstream change to garbage collection sweep causes mb
5 regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21
22Conflicts:
23 bfd/elflink.c
24Signed-off-by: Aayush Misra <aayushm@amd.com>
25---
26 bfd/elflink.c | 1 -
27 1 file changed, 1 deletion(-)
28
29diff --git a/bfd/elflink.c b/bfd/elflink.c
30index ca162145f7e..0524019641e 100644
31--- a/bfd/elflink.c
32+++ b/bfd/elflink.c
33@@ -6608,7 +6608,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
34
35 inf = (struct elf_gc_sweep_symbol_info *) data;
36 (*inf->hide_symbol) (inf->info, h, true);
37- h->def_regular = 0;
38 h->ref_regular = 0;
39 h->ref_regular_nonweak = 0;
40 }
41--
422.34.1
43
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch
new file mode 100644
index 00000000..30a7322d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch
@@ -0,0 +1,88 @@
1From 50a52ab3ad64b8525a970744dbb1c5f67dc24886 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 16/54] Add new bit-field instructions
5
6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a
8register and place it right-adjusted in the destination register.
9The other bits in the destination register shall be set to zero
10BSIFI- The instruction shall insert a right-adjusted bit field
11from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged
13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
18
19Conflicts:
20 gas/config/tc-microblaze.c
21 opcodes/microblaze-opc.h
22
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
26 opcodes/microblaze-dis.c | 18 +++++++++-
27 opcodes/microblaze-opc.h | 6 ++++
28 3 files changed, 93 insertions(+), 2 deletions(-)
29
30Index: gdb-14.2/opcodes/microblaze-dis.c
31===================================================================
32--- gdb-14.2.orig/opcodes/microblaze-dis.c
33+++ gdb-14.2/opcodes/microblaze-dis.c
34@@ -113,7 +113,19 @@ get_field_immw (struct string_buf *buf,
35 }
36
37 static char *
38-get_field_rfsl (struct string_buf *buf, long instr)
39+get_field_imm5width (struct string_buf *buf, long instr)
40+{
41+ char *p = strbuf (buf);
42+
43+ if (instr & 0x00004000)
44+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
45+ else
46+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
47+ return p;
48+}
49+
50+static char *
51+get_field_rfsl (struct string_buf *buf,long instr)
52 {
53 char *p = strbuf (buf);
54
55@@ -462,6 +474,10 @@ print_insn_microblaze (bfd_vma memaddr,
56 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
57 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
58 break;
59+ /* For bit field insns. */
60+ case INST_TYPE_RD_R1_IMM5_IMM5:
61+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
62+ break;
63 /* For tuqula instruction */
64 case INST_TYPE_RD:
65 print_func (stream, "\t%s", get_field_rd (&buf, inst));
66Index: gdb-14.2/opcodes/microblaze-opc.h
67===================================================================
68--- gdb-14.2.orig/opcodes/microblaze-opc.h
69+++ gdb-14.2/opcodes/microblaze-opc.h
70@@ -68,6 +68,9 @@
71 #define INST_TYPE_R1_IMML 24
72 #define INST_TYPE_RD_R1_IMMW_IMMS 21
73
74+/* For bsefi and bsifi */
75+#define INST_TYPE_RD_R1_IMM5_IMM5 21
76+
77 #define INST_TYPE_NONE 25
78
79
80@@ -587,5 +590,8 @@ char pvr_register_prefix[] = "rpvr";
81 #define MIN_IMML ((long) 0xffffff8000000000L)
82 #define MAX_IMML ((long) 0x0000007fffffffffL)
83
84+#define MIN_IMM_WIDTH ((int) 0x00000001)
85+#define MAX_IMM_WIDTH ((int) 0x00000020)
86+
87 #endif /* MICROBLAZE_OPC */
88
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..dc78da6b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,150 @@
1From 45f177e5de751f11c2d084c4d836d7f8ef754cb4 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 19/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/bfd-in2.h | 10 ++++++++++
17 bfd/libbfd.h | 2 ++
18 bfd/reloc.c | 12 ++++++++++++
19 gas/config/tc-microblaze.h | 4 +++-
20 ld/Makefile.am | 2 ++
21 ld/configure.tgt | 3 +++
22 opcodes/microblaze-dis.c | 8 ++++++--
23 opcodes/microblaze-opc.h | 11 +++++++----
24 8 files changed, 45 insertions(+), 7 deletions(-)
25
26Index: gdb-14.2/bfd/bfd-in2.h
27===================================================================
28--- gdb-14.2.orig/bfd/bfd-in2.h
29+++ gdb-14.2/bfd/bfd-in2.h
30@@ -6489,12 +6489,22 @@ done here - only used for relaxing */
31 BFD_RELOC_MICROBLAZE_64_NONE,
32
33 /* This is a 64 bit reloc that stores the 32 bit pc relative
34+ * +value in two words (with an imml instruction). No relocation is
35+ * +done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_64,
37+
38+/* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). The relocation is
40 PC-relative GOT offset */
41 BFD_RELOC_MICROBLAZE_64_GOTPC,
42
43 /* This is a 64 bit reloc that stores the 32 bit pc relative
44 value in two words (with an imml instruction). The relocation is
45+PC-relative GOT offset */
46+ BFD_RELOC_MICROBLAZE_64_GPC,
47+
48+/* This is a 64 bit reloc that stores the 32 bit pc relative
49+value in two words (with an imml instruction). The relocation is
50 PC-relative GOT offset */
51 BFD_RELOC_MICROBLAZE_64_GPC,
52
53Index: gdb-14.2/bfd/libbfd.h
54===================================================================
55--- gdb-14.2.orig/bfd/libbfd.h
56+++ gdb-14.2/bfd/libbfd.h
57@@ -3012,7 +3012,9 @@ static const char *const bfd_reloc_code_
58 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
59 "BFD_RELOC_MICROBLAZE_32_NONE",
60 "BFD_RELOC_MICROBLAZE_64_NONE",
61+ "BFD_RELOC_MICROBLAZE_64",
62 "BFD_RELOC_MICROBLAZE_64_GOTPC",
63+ "BFD_RELOC_MICROBLAZE_64_GPC",
64 "BFD_RELOC_MICROBLAZE_64_GOT",
65 "BFD_RELOC_MICROBLAZE_64_PLT",
66 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
67Index: gdb-14.2/bfd/reloc.c
68===================================================================
69--- gdb-14.2.orig/bfd/reloc.c
70+++ gdb-14.2/bfd/reloc.c
71@@ -6703,6 +6703,12 @@ ENUMDOC
72 ENUM
73 BFD_RELOC_MICROBLAZE_64_NONE
74 ENUMDOC
75+ This is a 32 bit reloc that stores the 32 bit pc relative
76+ value in two words (with an imml instruction). No relocation is
77+ done here - only used for relaxing
78+ENUM
79+ BFD_RELOC_MICROBLAZE_64
80+ENUMDOC
81 This is a 64 bit reloc that stores the 32 bit pc relative
82 value in two words (with an imm instruction). No relocation is
83 done here - only used for relaxing
84@@ -6710,6 +6716,12 @@ ENUM
85 BFD_RELOC_MICROBLAZE_64_GOTPC
86 ENUMDOC
87 This is a 64 bit reloc that stores the 32 bit pc relative
88+ value in two words (with an imml instruction). No relocation is
89+ done here - only used for relaxing
90+ENUM
91+ BFD_RELOC_MICROBLAZE_64_GPC
92+ENUMDOC
93+ This is a 64 bit reloc that stores the 32 bit pc relative
94 value in two words (with an imm instruction). The relocation is
95 PC-relative GOT offset
96 ENUM
97Index: gdb-14.2/opcodes/microblaze-dis.c
98===================================================================
99--- gdb-14.2.orig/opcodes/microblaze-dis.c
100+++ gdb-14.2/opcodes/microblaze-dis.c
101@@ -457,6 +457,10 @@ print_insn_microblaze (bfd_vma memaddr,
102 case INST_TYPE_R1_R2_SPECIAL:
103 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
104 get_field_r2 (&buf, inst));
105+ break;
106+ case INST_TYPE_IMML:
107+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
108+ /* TODO: Also print symbol */
109 break;
110 case INST_TYPE_RD_IMM15:
111 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
112@@ -475,8 +479,8 @@ print_insn_microblaze (bfd_vma memaddr,
113 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
114 break;
115 /* For bit field insns. */
116- case INST_TYPE_RD_R1_IMM5_IMM5:
117- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
118+ case INST_TYPE_RD_R1_IMMW_IMMS:
119+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
120 break;
121 /* For tuqula instruction */
122 case INST_TYPE_RD:
123Index: gdb-14.2/opcodes/microblaze-opc.h
124===================================================================
125--- gdb-14.2.orig/opcodes/microblaze-opc.h
126+++ gdb-14.2/opcodes/microblaze-opc.h
127@@ -69,7 +69,13 @@
128 #define INST_TYPE_RD_R1_IMMW_IMMS 21
129
130 /* For bsefi and bsifi */
131-#define INST_TYPE_RD_R1_IMM5_IMM5 21
132+#define INST_TYPE_RD_R1_IMMW_IMMS 21
133+
134+/* For 64-bit instructions */
135+#define INST_TYPE_IMML 22
136+#define INST_TYPE_RD_R1_IMML 23
137+#define INST_TYPE_R1_IMML 24
138+#define INST_TYPE_RD_R1_IMMW_IMMS 21
139
140 #define INST_TYPE_NONE 25
141
142@@ -590,8 +596,5 @@ char pvr_register_prefix[] = "rpvr";
143 #define MIN_IMML ((long) 0xffffff8000000000L)
144 #define MAX_IMML ((long) 0x0000007fffffffffL)
145
146-#define MIN_IMM_WIDTH ((int) 0x00000001)
147-#define MAX_IMM_WIDTH ((int) 0x00000020)
148-
149 #endif /* MICROBLAZE_OPC */
150
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..a1efcf41
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,82 @@
1From 8ec9b2fe49c8e1e367213fa0b8d6b6f0fedc3456 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 20/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 23 +++++++++++++++++++++++
17 ld/emulparams/elf64microblazeel.sh | 23 +++++++++++++++++++++++
18 2 files changed, 46 insertions(+)
19 create mode 100644 ld/emulparams/elf64microblaze.sh
20 create mode 100644 ld/emulparams/elf64microblazeel.sh
21
22diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
23new file mode 100644
24index 00000000000..9c7b0eb7080
25--- /dev/null
26+++ b/ld/emulparams/elf64microblaze.sh
27@@ -0,0 +1,23 @@
28+SCRIPT_NAME=elfmicroblaze
29+OUTPUT_FORMAT="elf64-microblazeel"
30+#BIG_OUTPUT_FORMAT="elf64-microblaze"
31+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
32+#TEXT_START_ADDR=0
33+NONPAGED_TEXT_START_ADDR=0x28
34+ALIGNMENT=4
35+MAXPAGESIZE=4
36+ARCH=microblaze
37+EMBEDDED=yes
38+
39+NOP=0x80000000
40+
41+# Hmmm, there's got to be a better way. This sets the stack to the
42+# top of the simulator memory (2^19 bytes).
43+#PAGE_SIZE=0x1000
44+#DATA_ADDR=0x10000
45+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
46+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
47+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
48+
49+TEMPLATE_NAME=elf32
50+#GENERATE_SHLIB_SCRIPT=yes
51diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
52new file mode 100644
53index 00000000000..9c7b0eb7080
54--- /dev/null
55+++ b/ld/emulparams/elf64microblazeel.sh
56@@ -0,0 +1,23 @@
57+SCRIPT_NAME=elfmicroblaze
58+OUTPUT_FORMAT="elf64-microblazeel"
59+#BIG_OUTPUT_FORMAT="elf64-microblaze"
60+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
61+#TEXT_START_ADDR=0
62+NONPAGED_TEXT_START_ADDR=0x28
63+ALIGNMENT=4
64+MAXPAGESIZE=4
65+ARCH=microblaze
66+EMBEDDED=yes
67+
68+NOP=0x80000000
69+
70+# Hmmm, there's got to be a better way. This sets the stack to the
71+# top of the simulator memory (2^19 bytes).
72+#PAGE_SIZE=0x1000
73+#DATA_ADDR=0x10000
74+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
75+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
76+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
77+
78+TEMPLATE_NAME=elf32
79+#GENERATE_SHLIB_SCRIPT=yes
80--
812.34.1
82
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..caf24b8d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch
@@ -0,0 +1,69 @@
1From 818a103460da557761aacc0d21b9b087721d2d3e Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 21/54] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/reloc.c | 26 ++++++++++++++------------
16 gas/config/tc-microblaze.c | 11 +++++++++++
17 2 files changed, 25 insertions(+), 12 deletions(-)
18
19Index: gdb-14.2/bfd/reloc.c
20===================================================================
21--- gdb-14.2.orig/bfd/reloc.c
22+++ gdb-14.2/bfd/reloc.c
23@@ -6703,12 +6703,6 @@ ENUMDOC
24 ENUM
25 BFD_RELOC_MICROBLAZE_64_NONE
26 ENUMDOC
27- This is a 32 bit reloc that stores the 32 bit pc relative
28- value in two words (with an imml instruction). No relocation is
29- done here - only used for relaxing
30-ENUM
31- BFD_RELOC_MICROBLAZE_64
32-ENUMDOC
33 This is a 64 bit reloc that stores the 32 bit pc relative
34 value in two words (with an imm instruction). No relocation is
35 done here - only used for relaxing
36@@ -6716,12 +6710,6 @@ ENUM
37 BFD_RELOC_MICROBLAZE_64_GOTPC
38 ENUMDOC
39 This is a 64 bit reloc that stores the 32 bit pc relative
40- value in two words (with an imml instruction). No relocation is
41- done here - only used for relaxing
42-ENUM
43- BFD_RELOC_MICROBLAZE_64_GPC
44-ENUMDOC
45- This is a 64 bit reloc that stores the 32 bit pc relative
46 value in two words (with an imm instruction). The relocation is
47 PC-relative GOT offset
48 ENUM
49@@ -7976,6 +7964,20 @@ ENUMX
50 ENUMDOC
51 Linux eBPF relocations.
52
53+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
54+ to two words (uses imml instruction).
55+ENUM
56+BFD_RELOC_MICROBLAZE_64,
57+ENUMDOC
58+ This is a 64 bit reloc that stores the 64 bit pc relative
59+ value in two words (with an imml instruction). No relocation is
60+ done here - only used for relaxing
61+ENUM
62+BFD_RELOC_MICROBLAZE_64_PCREL,
63+ENUMDOC
64+ This is a 32 bit reloc that stores the 32 bit pc relative
65+ value in two words (with an imml instruction). No relocation is
66+ done here - only used for relaxing
67 ENUM
68 BFD_RELOC_EPIPHANY_SIMM8
69 ENUMDOC
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..2023287a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,113 @@
1From 587d5179ce81a4f67ebec321063f6c3c9b1673cb Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 22/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/elf64-microblaze.c | 8 +
17 bfd/reloc.c | 42 ++-
18 gas/config/tc-microblaze.c | 558 ++++++++++++++++++++++++++++++++-----
19 3 files changed, 507 insertions(+), 101 deletions(-)
20
21Index: gdb-14.2/bfd/elf64-microblaze.c
22===================================================================
23--- gdb-14.2.orig/bfd/elf64-microblaze.c
24+++ gdb-14.2/bfd/elf64-microblaze.c
25@@ -1666,6 +1666,14 @@ microblaze_elf_relocate_section (bfd *ou
26 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
27 outrel.r_addend = relocation + addend;
28 }
29+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
30+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
31+ {
32+ insn &= ~0x00ffffff;
33+ insn |= (relocation >> 16) & 0xffffff;
34+ bfd_put_32 (input_bfd, insn,
35+ contents + offset + endian);
36+ }
37 else
38 {
39 BFD_FAIL ();
40Index: gdb-14.2/bfd/reloc.c
41===================================================================
42--- gdb-14.2.orig/bfd/reloc.c
43+++ gdb-14.2/bfd/reloc.c
44@@ -6703,13 +6703,31 @@ ENUMDOC
45 ENUM
46 BFD_RELOC_MICROBLAZE_64_NONE
47 ENUMDOC
48+ This is a 32 bit reloc that stores the 32 bit pc relative
49+ value in two words (with an imml instruction). No relocation is
50+ done here - only used for relaxing
51+ENUM
52+ BFD_RELOC_MICROBLAZE_64
53+ENUMDOC
54 This is a 64 bit reloc that stores the 32 bit pc relative
55 value in two words (with an imm instruction). No relocation is
56 done here - only used for relaxing
57 ENUM
58+BFD_RELOC_MICROBLAZE_64_PCREL,
59+ENUMDOC
60+ This is a 32 bit reloc that stores the 32 bit pc relative
61+ value in two words (with an imml instruction). No relocation is
62+ done here - only used for relaxing
63+ENUM
64 BFD_RELOC_MICROBLAZE_64_GOTPC
65 ENUMDOC
66 This is a 64 bit reloc that stores the 32 bit pc relative
67+ value in two words (with an imml instruction). No relocation is
68+ done here - only used for relaxing
69+ENUM
70+ BFD_RELOC_MICROBLAZE_64_GPC
71+ENUMDOC
72+ This is a 64 bit reloc that stores the 32 bit pc relative
73 value in two words (with an imm instruction). The relocation is
74 PC-relative GOT offset
75 ENUM
76@@ -7942,18 +7960,6 @@ ENUMDOC
77 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
78 to two words (uses imml instruction).
79 ENUM
80-BFD_RELOC_MICROBLAZE_64,
81-ENUMDOC
82- This is a 64 bit reloc that stores the 64 bit pc relative
83- value in two words (with an imml instruction). No relocation is
84- done here - only used for relaxing
85-ENUM
86-BFD_RELOC_MICROBLAZE_64_PCREL,
87-ENUMDOC
88- This is a 32 bit reloc that stores the 32 bit pc relative
89- value in two words (with an imml instruction). No relocation is
90- done here - only used for relaxing
91-ENUM
92 BFD_RELOC_BPF_64
93 ENUMX
94 BFD_RELOC_BPF_DISP32
95@@ -7967,18 +7973,6 @@ ENUMDOC
96 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
97 to two words (uses imml instruction).
98 ENUM
99-BFD_RELOC_MICROBLAZE_64,
100-ENUMDOC
101- This is a 64 bit reloc that stores the 64 bit pc relative
102- value in two words (with an imml instruction). No relocation is
103- done here - only used for relaxing
104-ENUM
105-BFD_RELOC_MICROBLAZE_64_PCREL,
106-ENUMDOC
107- This is a 32 bit reloc that stores the 32 bit pc relative
108- value in two words (with an imml instruction). No relocation is
109- done here - only used for relaxing
110-ENUM
111 BFD_RELOC_EPIPHANY_SIMM8
112 ENUMDOC
113 Adapteva EPIPHANY - 8 bit signed pc-relative displacement
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..54b0cc45
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch
@@ -0,0 +1,84 @@
1From 4992c1383473b2a37551b7391f1eb836d2a447d3 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 23/54] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/libbfd.h | 2 --
16 bfd/reloc.c | 26 ++++++++-------
17 gas/config/tc-microblaze.c | 68 ++++++++++++--------------------------
18 3 files changed, 36 insertions(+), 60 deletions(-)
19
20Index: gdb-14.2/bfd/libbfd.h
21===================================================================
22--- gdb-14.2.orig/bfd/libbfd.h
23+++ gdb-14.2/bfd/libbfd.h
24@@ -3012,9 +3012,7 @@ static const char *const bfd_reloc_code_
25 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
26 "BFD_RELOC_MICROBLAZE_32_NONE",
27 "BFD_RELOC_MICROBLAZE_64_NONE",
28- "BFD_RELOC_MICROBLAZE_64",
29 "BFD_RELOC_MICROBLAZE_64_GOTPC",
30- "BFD_RELOC_MICROBLAZE_64_GPC",
31 "BFD_RELOC_MICROBLAZE_64_GOT",
32 "BFD_RELOC_MICROBLAZE_64_PLT",
33 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
34Index: gdb-14.2/bfd/reloc.c
35===================================================================
36--- gdb-14.2.orig/bfd/reloc.c
37+++ gdb-14.2/bfd/reloc.c
38@@ -6669,6 +6669,20 @@ ENUM
39 ENUMDOC
40 Address of a GOT entry.
41
42+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
43+ to two words (uses imml instruction).
44+ENUM
45+BFD_RELOC_MICROBLAZE_64,
46+ENUMDOC
47+ This is a 64 bit reloc that stores the 64 bit pc relative
48+ value in two words (with an imml instruction). No relocation is
49+ done here - only used for relaxing
50+ENUM
51+BFD_RELOC_MICROBLAZE_64_PCREL,
52+ENUMDOC
53+ This is a 32 bit reloc that stores the 32 bit pc relative
54+ value in two words (with an imml instruction). No relocation is
55+ done here - only used for relaxing
56 ENUM
57 BFD_RELOC_MICROBLAZE_32_LO
58 ENUMDOC
59@@ -6707,12 +6721,6 @@ ENUMDOC
60 value in two words (with an imml instruction). No relocation is
61 done here - only used for relaxing
62 ENUM
63- BFD_RELOC_MICROBLAZE_64
64-ENUMDOC
65- This is a 64 bit reloc that stores the 32 bit pc relative
66- value in two words (with an imm instruction). No relocation is
67- done here - only used for relaxing
68-ENUM
69 BFD_RELOC_MICROBLAZE_64_PCREL,
70 ENUMDOC
71 This is a 32 bit reloc that stores the 32 bit pc relative
72@@ -6725,12 +6733,6 @@ ENUMDOC
73 value in two words (with an imml instruction). No relocation is
74 done here - only used for relaxing
75 ENUM
76- BFD_RELOC_MICROBLAZE_64_GPC
77-ENUMDOC
78- This is a 64 bit reloc that stores the 32 bit pc relative
79- value in two words (with an imm instruction). The relocation is
80- PC-relative GOT offset
81-ENUM
82 BFD_RELOC_MICROBLAZE_64_GOT
83 ENUMDOC
84 This is a 64 bit reloc that stores the 32 bit pc relative
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch
new file mode 100644
index 00000000..e495e207
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch
@@ -0,0 +1,35 @@
1From 33e22262c6c43af6e7e075df0665838b5b3859a6 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 25/54] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
6
7Conflicts:
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
10
11Conflicts:
12 bfd/elf64-microblaze.c
13
14Conflicts:
15 bfd/elf64-microblaze.c
16
17Signed-off-by: Aayush Misra <aayushm@amd.com>
18---
19 bfd/elf64-microblaze.c | 2 +-
20 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
21 2 files changed, 67 insertions(+), 9 deletions(-)
22
23Index: gdb-14.2/bfd/elf64-microblaze.c
24===================================================================
25--- gdb-14.2.orig/bfd/elf64-microblaze.c
26+++ gdb-14.2/bfd/elf64-microblaze.c
27@@ -2131,7 +2131,7 @@ microblaze_elf_relax_section (bfd *abfd,
28 efix = calc_fixup (target_address, 0, sec);
29
30 /* Validate the in-band val. */
31- val = bfd_get_32 (abfd, contents + irel->r_offset);
32+ val = bfd_get_64 (abfd, contents + irel->r_offset);
33 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
34 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
35 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
new file mode 100644
index 00000000..f6598cee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -0,0 +1,26 @@
1From 646b229752b9816b25d2b9ffe79b895b69742745 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 28/54] fixing the long & long long mingw toolchain issue
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gas/config/tc-microblaze.c | 10 +++++-----
9 opcodes/microblaze-opc.h | 4 ++--
10 2 files changed, 7 insertions(+), 7 deletions(-)
11
12Index: gdb-14.2/opcodes/microblaze-opc.h
13===================================================================
14--- gdb-14.2.orig/opcodes/microblaze-opc.h
15+++ gdb-14.2/opcodes/microblaze-opc.h
16@@ -593,8 +593,8 @@ char pvr_register_prefix[] = "rpvr";
17 #define MIN_IMM6_WIDTH ((int) 0x00000001)
18 #define MAX_IMM6_WIDTH ((int) 0x00000040)
19
20-#define MIN_IMML ((long) 0xffffff8000000000L)
21-#define MAX_IMML ((long) 0x0000007fffffffffL)
22+#define MIN_IMML ((long long) 0xffffff8000000000L)
23+#define MAX_IMML ((long long) 0x0000007fffffffffL)
24
25 #endif /* MICROBLAZE_OPC */
26
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch
new file mode 100644
index 00000000..8e9585a0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -0,0 +1,176 @@
1From 1a9a688939dfbf7cca9685b326c0387672c567b4 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 29/54] Added support to new arithmetic single register
5 instructions
6
7Conflicts:
8 opcodes/microblaze-dis.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12 opcodes/microblaze-dis.c
13
14Conflicts:
15 gas/config/tc-microblaze.c
16signed-off-by:Nagaraju <nmekala@xilinx.com>
17 Mahesh <mbodapat@xilinx.com>
18
19Signed-off-by: Aayush Misra <aayushm@amd.com>
20---
21 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
22 opcodes/microblaze-dis.c | 11 +++
23 opcodes/microblaze-opc.h | 43 ++++++++++-
24 opcodes/microblaze-opcm.h | 5 +-
25 4 files changed, 200 insertions(+), 6 deletions(-)
26
27Index: gdb-14.2/opcodes/microblaze-dis.c
28===================================================================
29--- gdb-14.2.orig/opcodes/microblaze-dis.c
30+++ gdb-14.2/opcodes/microblaze-dis.c
31@@ -143,6 +143,14 @@ get_field_imm15 (struct string_buf *buf,
32 return p;
33 }
34
35+get_field_imm16 (struct string_buf *buf, long instr)
36+{
37+ char *p = strbuf (buf);
38+
39+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
40+ return p;
41+}
42+
43 static char *
44 get_field_special (struct string_buf *buf, long instr,
45 const struct op_code_struct *op)
46@@ -473,6 +481,9 @@ print_insn_microblaze (bfd_vma memaddr,
47 /* For mbar 16 or sleep insn. */
48 case INST_TYPE_NONE:
49 break;
50+ case INST_TYPE_RD_IMML:
51+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
52+ break;
53 /* For bit field insns. */
54 case INST_TYPE_RD_R1_IMMW_IMMS:
55 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
56Index: gdb-14.2/opcodes/microblaze-opc.h
57===================================================================
58--- gdb-14.2.orig/opcodes/microblaze-opc.h
59+++ gdb-14.2/opcodes/microblaze-opc.h
60@@ -78,6 +78,7 @@
61 #define INST_TYPE_RD_R1_IMMW_IMMS 21
62
63 #define INST_TYPE_NONE 25
64+#define INST_TYPE_RD_IMML 26
65
66
67
68@@ -93,6 +94,7 @@
69 #define IMMVAL_MASK_MFS 0x0000
70
71 #define OPCODE_MASK_H 0xFC000000 /* High 6 bits only. */
72+#define OPCODE_MASK_LIMM 0xFC1F0000 /* High 6 bits and 12-16 bits */
73 #define OPCODE_MASK_H1 0xFFE00000 /* High 11 bits. */
74 #define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16. */
75 #define OPCODE_MASK_H12 0xFFFF0000 /* High 16. */
76@@ -115,6 +117,33 @@
77 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
78 #define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
79
80+/*Defines to identify 64-bit single reg instructions */
81+#define ADDLI_ONE_REG_MASK 0x68000000
82+#define ADDLIC_ONE_REG_MASK 0x68020000
83+#define ADDLIK_ONE_REG_MASK 0x68040000
84+#define ADDLIKC_ONE_REG_MASK 0x68060000
85+#define RSUBLI_ONE_REG_MASK 0x68010000
86+#define RSUBLIC_ONE_REG_MASK 0x68030000
87+#define RSUBLIK_ONE_REG_MASK 0x68050000
88+#define RSUBLIKC_ONE_REG_MASK 0x68070000
89+#define ORLI_ONE_REG_MASK 0x68100000
90+#define ANDLI_ONE_REG_MASK 0x68110000
91+#define XORLI_ONE_REG_MASK 0x68120000
92+#define ANDLNI_ONE_REG_MASK 0x68130000
93+#define ADDLI_MASK 0x20000000
94+#define ADDLIC_MASK 0x28000000
95+#define ADDLIK_MASK 0x30000000
96+#define ADDLIKC_MASK 0x38000000
97+#define RSUBLI_MASK 0x24000000
98+#define RSUBLIC_MASK 0x2C000000
99+#define RSUBLIK_MASK 0x34000000
100+#define RSUBLIKC_MASK 0x3C000000
101+#define ANDLI_MASK 0xA4000000
102+#define ANDLNI_MASK 0xAC000000
103+#define ORLI_MASK 0xA0000000
104+#define XORLI_MASK 0xA8000000
105+
106+
107 /* New Mask for msrset, msrclr insns. */
108 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
109 /* Mask for mbar insn. */
110@@ -123,7 +152,7 @@
111 #define DELAY_SLOT 1
112 #define NO_DELAY_SLOT 0
113
114-#define MAX_OPCODES 412
115+#define MAX_OPCODES 424
116
117 const struct op_code_struct
118 {
119@@ -452,13 +481,21 @@ const struct op_code_struct
120 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
121 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
122 {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
123+ {"addli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68000000, OPCODE_MASK_LIMM, addli, arithmetic_inst },
124 {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
125+ {"rsubli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68010000, OPCODE_MASK_LIMM, rsubli, arithmetic_inst },
126 {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
127+ {"addlic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68020000, OPCODE_MASK_LIMM, addlic, arithmetic_inst },
128 {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
129+ {"rsublic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68030000, OPCODE_MASK_LIMM, rsublic, arithmetic_inst },
130 {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
131+ {"addlik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68040000, OPCODE_MASK_LIMM, addlik, arithmetic_inst },
132 {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
133+ {"rsublik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68050000, OPCODE_MASK_LIMM, rsublik, arithmetic_inst },
134 {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
135+ {"addlikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68060000, OPCODE_MASK_LIMM, addlikc, arithmetic_inst },
136 {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
137+ {"rsublikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68070000, OPCODE_MASK_LIMM, rsublikc, arithmetic_inst },
138 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
139 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
140 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
141@@ -509,9 +546,13 @@ const struct op_code_struct
142 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
143 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
144 {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
145+ {"orli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68100000, OPCODE_MASK_LIMM, orli, arithmetic_inst },
146 {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
147+ {"andli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68110000, OPCODE_MASK_LIMM, andli, arithmetic_inst },
148 {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
149+ {"xorli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68120000, OPCODE_MASK_LIMM, xorli, arithmetic_inst },
150 {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
151+ {"andnli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68130000, OPCODE_MASK_LIMM, andnli, arithmetic_inst },
152 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
153 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
154 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
155Index: gdb-14.2/opcodes/microblaze-opcm.h
156===================================================================
157--- gdb-14.2.orig/opcodes/microblaze-opcm.h
158+++ gdb-14.2/opcodes/microblaze-opcm.h
159@@ -62,7 +62,9 @@ enum microblaze_instr
160 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
161
162 /* 64-bit instructions */
163- addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
164+ addl, addli, addlic, addlik, addlikc, rsubl, rsubli, rsublic, rsublik, rsublikc,
165+ addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
166+ andli, andnli, orli, xorli,
167 bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
168 andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
169 brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
170@@ -167,5 +169,6 @@ enum microblaze_instr_type
171
172 /* Imm mask for msrset, msrclr instructions. */
173 #define IMM15_MASK 0x00007FFF
174+#define IMM16_MASK 0x0000FFFF
175
176 #endif /* MICROBLAZE-OPCM */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch
new file mode 100644
index 00000000..72b9cc9f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch
@@ -0,0 +1,29 @@
1From 6967f52fe0ebebb4bdf437cb1e683d9e87a013ff Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 30/54] double imml generation for 64 bit values.
5
6Conflicts:
7 gas/config/tc-microblaze.c
8
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++-------
12 opcodes/microblaze-opc.h | 4 +-
13 2 files changed, 262 insertions(+), 63 deletions(-)
14
15Index: gdb-14.2/opcodes/microblaze-opc.h
16===================================================================
17--- gdb-14.2.orig/opcodes/microblaze-opc.h
18+++ gdb-14.2/opcodes/microblaze-opc.h
19@@ -634,8 +634,8 @@ char pvr_register_prefix[] = "rpvr";
20 #define MIN_IMM6_WIDTH ((int) 0x00000001)
21 #define MAX_IMM6_WIDTH ((int) 0x00000040)
22
23-#define MIN_IMML ((long long) 0xffffff8000000000L)
24-#define MAX_IMML ((long long) 0x0000007fffffffffL)
25+#define MIN_IMML ((long long) -9223372036854775808)
26+#define MAX_IMML ((long long) 9223372036854775807)
27
28 #endif /* MICROBLAZE_OPC */
29
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
new file mode 100644
index 00000000..700ec4c3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
@@ -0,0 +1,44 @@
1From 9ff4551a70734606139f3ecd146cf0a1c45e0fb0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 22:01:23 +0530
4Subject: [PATCH 35/54] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 2 +-
17 ld/emulparams/elf64microblazeel.sh | 2 +-
18 2 files changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
21index 9c7b0eb7080..7b4c7c411bd 100644
22--- a/ld/emulparams/elf64microblaze.sh
23+++ b/ld/emulparams/elf64microblaze.sh
24@@ -19,5 +19,5 @@ NOP=0x80000000
25 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
26 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
27
28-TEMPLATE_NAME=elf32
29+TEMPLATE_NAME=elf
30 #GENERATE_SHLIB_SCRIPT=yes
31diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
32index 9c7b0eb7080..7b4c7c411bd 100644
33--- a/ld/emulparams/elf64microblazeel.sh
34+++ b/ld/emulparams/elf64microblazeel.sh
35@@ -19,5 +19,5 @@ NOP=0x80000000
36 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
37 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
38
39-TEMPLATE_NAME=elf32
40+TEMPLATE_NAME=elf
41 #GENERATE_SHLIB_SCRIPT=yes
42--
432.34.1
44
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
new file mode 100644
index 00000000..88c0dc4e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
@@ -0,0 +1,79 @@
1From a233cd9a21bc94c47c1d33cc10a9e24a5d5b8126 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:04:07 +0530
4Subject: [PATCH 36/54] Invalid data offsets (pointer) after relaxation.
5 Proposed patch from community member (dednev@rambler.ru) against 2021.1
6 [CR-1115232]
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/elf32-microblaze.c | 18 ++++++++++++++++++
11 1 file changed, 18 insertions(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 6ba28e757be..7a4d35493e9 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2174,6 +2174,9 @@ microblaze_elf_relax_section (bfd *abfd,
18 {
19 unsigned int val;
20
21+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
22+ continue;
23+
24 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25
26 /* hax: We only do the following fixup for debug location lists. */
27@@ -2213,6 +2216,9 @@ microblaze_elf_relax_section (bfd *abfd,
28 }
29 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
30 {
31+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
32+ continue;
33+
34 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
35
36 /* Look at the reloc only if the value has been resolved. */
37@@ -2245,6 +2251,9 @@ microblaze_elf_relax_section (bfd *abfd,
38 }
39 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
40 {
41+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
42+ continue;
43+
44 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
45
46 /* Look at the reloc only if the value has been resolved. */
47@@ -2282,6 +2291,9 @@ microblaze_elf_relax_section (bfd *abfd,
48 || (ELF32_R_TYPE (irelscan->r_info)
49 == (int) R_MICROBLAZE_TEXTREL_32_LO))
50 {
51+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
52+ continue;
53+
54 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
55
56 /* Look at the reloc only if the value has been resolved. */
57@@ -2328,6 +2340,9 @@ microblaze_elf_relax_section (bfd *abfd,
58 || (ELF32_R_TYPE (irelscan->r_info)
59 == (int) R_MICROBLAZE_TEXTREL_64))
60 {
61+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
62+ continue;
63+
64 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
65
66 /* Look at the reloc only if the value has been resolved. */
67@@ -2362,6 +2377,9 @@ microblaze_elf_relax_section (bfd *abfd,
68 }
69 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
70 {
71+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
72+ continue;
73+
74 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
75
76 /* Look at the reloc only if the value has been resolved. */
77--
782.34.1
79
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
new file mode 100644
index 00000000..3cae48dc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
@@ -0,0 +1,107 @@
1From 2d0e4a0b3a9ce2ffebc5892cf34219ac01a2475e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:59:19 +0530
4Subject: [PATCH 37/54] Double free with ld --no-keep-memory. Proposed patches
5 from the community member (dednev@rambler.ru) for 2021.1. [CR-1115233]
6
7Conflicts:
8 bfd/elf32-microblaze.c
9 bfd/elf64-microblaze.c
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/elf32-microblaze.c | 40 ++++++++++++++++++++++------------------
14 1 file changed, 22 insertions(+), 18 deletions(-)
15
16diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
17index 7a4d35493e9..554a80ae0e4 100644
18--- a/bfd/elf32-microblaze.c
19+++ b/bfd/elf32-microblaze.c
20@@ -1881,10 +1881,8 @@ microblaze_elf_relax_section (bfd *abfd,
21 {
22 Elf_Internal_Shdr *symtab_hdr;
23 Elf_Internal_Rela *internal_relocs;
24- Elf_Internal_Rela *free_relocs = NULL;
25 Elf_Internal_Rela *irel, *irelend;
26 bfd_byte *contents = NULL;
27- bfd_byte *free_contents = NULL;
28 int rel_count;
29 unsigned int shndx;
30 size_t i, sym_index;
31@@ -1928,8 +1926,6 @@ microblaze_elf_relax_section (bfd *abfd,
32 internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
33 if (internal_relocs == NULL)
34 goto error_return;
35- if (! link_info->keep_memory)
36- free_relocs = internal_relocs;
37
38 sdata->relax_count = 0;
39 sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
40@@ -1957,7 +1953,6 @@ microblaze_elf_relax_section (bfd *abfd,
41 contents = (bfd_byte *) bfd_malloc (sec->size);
42 if (contents == NULL)
43 goto error_return;
44- free_contents = contents;
45
46 if (!bfd_get_section_contents (abfd, sec, contents,
47 (file_ptr) 0, sec->size))
48@@ -2473,25 +2468,26 @@ microblaze_elf_relax_section (bfd *abfd,
49 }
50
51 elf_section_data (sec)->relocs = internal_relocs;
52- free_relocs = NULL;
53
54 elf_section_data (sec)->this_hdr.contents = contents;
55- free_contents = NULL;
56
57 symtab_hdr->contents = (bfd_byte *) isymbuf;
58 }
59
60- free (free_relocs);
61- free_relocs = NULL;
62+ if (internal_relocs != NULL
63+ && elf_section_data (sec)->relocs != internal_relocs)
64+ free (internal_relocs);
65
66- if (free_contents != NULL)
67- {
68- if (!link_info->keep_memory)
69- free (free_contents);
70+ if (contents != NULL
71+ && elf_section_data (sec)->this_hdr.contents != contents)
72+ {
73+ if (! link_info->keep_memory)
74+ free (contents);
75 else
76- /* Cache the section contents for elf_link_input_bfd. */
77- elf_section_data (sec)->this_hdr.contents = contents;
78- free_contents = NULL;
79+ {
80+ /* Cache the section contents for elf_link_input_bfd. */
81+ elf_section_data (sec)->this_hdr.contents = contents;
82+ }
83 }
84
85 if (sdata->relax_count == 0)
86@@ -2505,8 +2501,16 @@ microblaze_elf_relax_section (bfd *abfd,
87 return true;
88
89 error_return:
90- free (free_relocs);
91- free (free_contents);
92+
93+ if (isymbuf != NULL
94+ && symtab_hdr->contents != (unsigned char *) isymbuf)
95+ free (isymbuf);
96+ if (internal_relocs != NULL
97+ && elf_section_data (sec)->relocs != internal_relocs)
98+ free (internal_relocs);
99+ if (contents != NULL
100+ && elf_section_data (sec)->this_hdr.contents != contents)
101+ free (contents);
102 free (sdata->relax);
103 sdata->relax = NULL;
104 sdata->relax_count = 0;
105--
1062.34.1
107
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch
new file mode 100644
index 00000000..a27a9807
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch
@@ -0,0 +1,83 @@
1From 06e678ebb6c136c85f73ba8a4a064f9050ae47ce Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 28 Nov 2021 17:17:15 +0530
4Subject: [PATCH 38/54] MB binutils Upstream port issues.
5
6It's resolving the seg faults with ADDLIK
7Conflicts:
8 bfd/elf64-microblaze.c
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gas/config/tc-microblaze.c | 2 +-
13 opcodes/microblaze-dis.c | 12 ++++++------
14 opcodes/microblaze-opc.h | 2 +-
15 3 files changed, 8 insertions(+), 8 deletions(-)
16
17Index: gdb-14.2/opcodes/microblaze-dis.c
18===================================================================
19--- gdb-14.2.orig/opcodes/microblaze-dis.c
20+++ gdb-14.2/opcodes/microblaze-dis.c
21@@ -153,7 +153,7 @@ get_field_imm16 (struct string_buf *buf,
22
23 static char *
24 get_field_special (struct string_buf *buf, long instr,
25- const struct op_code_struct *op)
26+ struct op_code_struct *op)
27 {
28 char *p = strbuf (buf);
29 char *spr;
30@@ -226,11 +226,11 @@ get_field_special (struct string_buf *bu
31 static unsigned long
32 read_insn_microblaze (bfd_vma memaddr,
33 struct disassemble_info *info,
34- const struct op_code_struct **opr)
35+ struct op_code_struct **opr)
36 {
37 unsigned char ibytes[4];
38 int status;
39- const struct op_code_struct *op;
40+ struct op_code_struct *op;
41 unsigned long inst;
42
43 status = info->read_memory_func (memaddr, ibytes, 4, info);
44@@ -266,7 +266,7 @@ print_insn_microblaze (bfd_vma memaddr,
45 fprintf_ftype print_func = info->fprintf_func;
46 void *stream = info->stream;
47 unsigned long inst, prev_inst;
48- const struct op_code_struct *op, *pop;
49+ struct op_code_struct *op, *pop;
50 int immval = 0;
51 bool immfound = false;
52 static bfd_vma prev_insn_addr = -1; /* Init the prev insn addr. */
53@@ -518,7 +518,7 @@ get_insn_microblaze (long inst,
54 enum microblaze_instr_type *insn_type,
55 short *delay_slots)
56 {
57- const struct op_code_struct *op;
58+ struct op_code_struct *op;
59 *isunsignedimm = false;
60
61 /* Just a linear search of the table. */
62@@ -560,7 +560,7 @@ microblaze_get_target_address (long inst
63 bool *targetvalid,
64 bool *unconditionalbranch)
65 {
66- const struct op_code_struct *op;
67+ struct op_code_struct *op;
68 long targetaddr = 0;
69
70 *unconditionalbranch = false;
71Index: gdb-14.2/opcodes/microblaze-opc.h
72===================================================================
73--- gdb-14.2.orig/opcodes/microblaze-opc.h
74+++ gdb-14.2/opcodes/microblaze-opc.h
75@@ -154,7 +154,7 @@
76
77 #define MAX_OPCODES 424
78
79-const struct op_code_struct
80+struct op_code_struct
81 {
82 const char * name;
83 short inst_type; /* Registers and immediate values involved. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch
new file mode 100644
index 00000000..3372de27
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -0,0 +1,89 @@
1From e907440fcfce0828efa7b059ef0c6d61c7736d02 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 39/54] Initial port of core reading support Added support for
5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 information for rebuilding ".reg" sections of core dumps at run time.
7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 gdb/microblaze-linux-tdep.c | 11 +++++++++++
14 gdb/microblaze-tdep.c | 37 +++++++++++++++++++++++++++++++++++++
15 2 files changed, 48 insertions(+)
16
17diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
18index 39592a43f7c..20daef2ccd4 100644
19--- a/gdb/microblaze-linux-tdep.c
20+++ b/gdb/microblaze-linux-tdep.c
21@@ -193,6 +193,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
22 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
23 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
24
25+ /* BFD target for core files. */
26+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
27+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
28+ else
29+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
30+
31+
32+ /* Shared library handling. */
33+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
34+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
35+
36 /* Enable TLS support. */
37 set_gdbarch_fetch_tls_load_module_address (gdbarch,
38 svr4_fetch_objfile_link_map);
39diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
40index d4b9ef837e5..363fee34040 100644
41--- a/gdb/microblaze-tdep.c
42+++ b/gdb/microblaze-tdep.c
43@@ -957,6 +957,43 @@ make_regs (struct gdbarch *arch)
44 }
45 #endif
46
47+void
48+microblaze_supply_gregset (const struct regset *regset,
49+ struct regcache *regcache,
50+ int regnum, const void *gregs)
51+{
52+ const unsigned int *regs = (const unsigned int *)gregs;
53+ if (regnum >= 0)
54+ regcache->raw_supply (regnum, regs + regnum);
55+
56+ if (regnum == -1) {
57+ int i;
58+
59+ for (i = 0; i < 50; i++) {
60+ regcache->raw_supply (i, regs + i);
61+ }
62+ }
63+}
64+
65+
66+/* Return the appropriate register set for the core section identified
67+ by SECT_NAME and SECT_SIZE. */
68+
69+static void
70+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
71+ iterate_over_regset_sections_cb *cb,
72+ void *cb_data,
73+ const struct regcache *regcache)
74+{
75+ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
76+
77+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
78+
79+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
80+}
81+
82+
83+
84 static struct gdbarch *
85 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
86 {
87--
882.34.1
89
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
new file mode 100644
index 00000000..3ea09e7e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
@@ -0,0 +1,185 @@
1From 73b456c4d8f64ec01b170a49330e6de66716eb1a Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 10:41:33 +0530
4Subject: [PATCH 40/54] Fix build issues after Xilinx 2023.2 binutils merge
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 10 ------
10 gdb/microblaze-tdep.c | 71 ++++++++++++++--------------------------
11 opcodes/microblaze-dis.c | 10 ------
12 3 files changed, 25 insertions(+), 66 deletions(-)
13
14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
15index 9dcf233f19f..4b022dbfba1 100644
16--- a/bfd/bfd-in2.h
17+++ b/bfd/bfd-in2.h
18@@ -6473,11 +6473,6 @@ done here - only used for relaxing */
19 * +done here - only used for relaxing */
20 BFD_RELOC_MICROBLAZE_64_PCREL,
21
22-/* This is a 64 bit reloc that stores the 32 bit relative
23- * +value in two words (with an imml instruction). No relocation is
24- * +done here - only used for relaxing */
25- BFD_RELOC_MICROBLAZE_64,
26-
27 /* This is a 64 bit reloc that stores the 32 bit relative
28 * +value in two words (with an imml instruction). No relocation is
29 * +done here - only used for relaxing */
30@@ -6503,11 +6498,6 @@ value in two words (with an imml instruction). The relocation is
31 PC-relative GOT offset */
32 BFD_RELOC_MICROBLAZE_64_GPC,
33
34-/* This is a 64 bit reloc that stores the 32 bit pc relative
35-value in two words (with an imml instruction). The relocation is
36-PC-relative GOT offset */
37- BFD_RELOC_MICROBLAZE_64_GPC,
38-
39 /* This is a 64 bit reloc that stores the 32 bit pc relative
40 value in two words (with an imm instruction). The relocation is
41 GOT offset */
42diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
43index 363fee34040..818306f2197 100644
44--- a/gdb/microblaze-tdep.c
45+++ b/gdb/microblaze-tdep.c
46@@ -70,6 +70,7 @@ static const char *microblaze_abi_string;
47 static const char *const microblaze_abi_strings[] = {
48 "auto",
49 "m64",
50+ NULL
51 };
52
53 enum microblaze_abi
54@@ -105,7 +106,7 @@ global_microblaze_abi (void)
55 if (microblaze_abi_strings[i] == microblaze_abi_string)
56 return (enum microblaze_abi) i;
57
58-// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
59+ internal_error (__FILE__, __LINE__, _("unknown ABI string"));
60 }
61
62 static void
63@@ -894,16 +895,31 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
64 }
65
66 static void
67-microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
68+microblaze_register_g_packet_guesses (struct gdbarch *gdbarch, enum microblaze_abi abi)
69 {
70
71- register_remote_g_packet_guess (gdbarch,
72- 4 * MICROBLAZE_NUM_CORE_REGS,
73- tdesc_microblaze64);
74+ if (abi == MICROBLAZE_ABI_M64)
75+ {
76+
77+ register_remote_g_packet_guess (gdbarch,
78+ 8 * MICROBLAZE_NUM_CORE_REGS,
79+ tdesc_microblaze64);
80+
81+ register_remote_g_packet_guess (gdbarch,
82+ 8 * MICROBLAZE_NUM_REGS,
83+ tdesc_microblaze64_with_stack_protect);
84+ }
85+ else
86+ {
87+
88+ register_remote_g_packet_guess (gdbarch,
89+ 4 * MICROBLAZE_NUM_CORE_REGS,
90+ tdesc_microblaze);
91
92- register_remote_g_packet_guess (gdbarch,
93- 4 * MICROBLAZE_NUM_REGS,
94- tdesc_microblaze64_with_stack_protect);
95+ register_remote_g_packet_guess (gdbarch,
96+ 4 * MICROBLAZE_NUM_REGS,
97+ tdesc_microblaze_with_stack_protect);
98+ }
99 }
100
101 void
102@@ -957,43 +973,6 @@ make_regs (struct gdbarch *arch)
103 }
104 #endif
105
106-void
107-microblaze_supply_gregset (const struct regset *regset,
108- struct regcache *regcache,
109- int regnum, const void *gregs)
110-{
111- const unsigned int *regs = (const unsigned int *)gregs;
112- if (regnum >= 0)
113- regcache->raw_supply (regnum, regs + regnum);
114-
115- if (regnum == -1) {
116- int i;
117-
118- for (i = 0; i < 50; i++) {
119- regcache->raw_supply (i, regs + i);
120- }
121- }
122-}
123-
124-
125-/* Return the appropriate register set for the core section identified
126- by SECT_NAME and SECT_SIZE. */
127-
128-static void
129-microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
130- iterate_over_regset_sections_cb *cb,
131- void *cb_data,
132- const struct regcache *regcache)
133-{
134- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
135-
136- cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
137-
138- cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
139-}
140-
141-
142-
143 static struct gdbarch *
144 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
145 {
146@@ -1134,7 +1113,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
147
148 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
149
150- //microblaze_register_g_packet_guesses (gdbarch);
151+ // microblaze_register_g_packet_guesses (gdbarch, microblaze_abi);
152
153 frame_base_set_default (gdbarch, &microblaze_frame_base);
154
155diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
156index 540ddecafd4..00712d5eaf1 100644
157--- a/opcodes/microblaze-dis.c
158+++ b/opcodes/microblaze-dis.c
159@@ -466,10 +466,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
160 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
161 get_field_r2 (&buf, inst));
162 break;
163- case INST_TYPE_IMML:
164- print_func (stream, "\t%s", get_field_imml (&buf, inst));
165- /* TODO: Also print symbol */
166- break;
167 case INST_TYPE_RD_IMM15:
168 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
169 get_field_imm15 (&buf, inst));
170@@ -484,12 +480,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
171 case INST_TYPE_RD_IMML:
172 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
173 break;
174- /* For bit field insns. */
175- case INST_TYPE_RD_R1_IMMW_IMMS:
176- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
177- get_field_immw (&buf, inst), get_field_imms (&buf, inst));
178- break;
179- /* For bit field insns. */
180 case INST_TYPE_RD_R1_IMMW_IMMS:
181 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
182 break;
183--
1842.34.1
185
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch
new file mode 100644
index 00000000..6f5a5f1e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch
@@ -0,0 +1,26 @@
1From a96aee31c41e4d851531100a0716401c3464f6ef Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 15:44:56 +0530
4Subject: [PATCH 41/54] disable truncated register warning (gdb/remote.c)
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gdb/remote.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/gdb/remote.c b/gdb/remote.c
12index ae08c980efc..8055c8f62e6 100644
13--- a/gdb/remote.c
14+++ b/gdb/remote.c
15@@ -8678,7 +8678,7 @@ remote_target::process_g_packet (struct regcache *regcache)
16 if (rsa->regs[i].pnum == -1)
17 continue;
18
19- if (offset >= sizeof_g_packet)
20+ if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
21 rsa->regs[i].in_g_packet = 0;
22 else if (offset + reg_size > sizeof_g_packet)
23 error (_("Truncated register %d in remote 'g' packet"), i);
24--
252.34.1
26
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
new file mode 100644
index 00000000..0b5f27b4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
@@ -0,0 +1,42 @@
1From f9ffc37f48bd9213e89c8821cd07fc679e113007 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:20:48 +0530
4Subject: [PATCH 42/54] Fix unresolved conflicts from binutils_2_42_merge
5
6opcodes/microblaze-dis.c
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 opcodes/microblaze-dis.c | 15 ++++++++++-----
12 1 file changed, 10 insertions(+), 5 deletions(-)
13
14diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
15index 00712d5eaf1..31dbad46b75 100644
16--- a/opcodes/microblaze-dis.c
17+++ b/opcodes/microblaze-dis.c
18@@ -478,11 +478,16 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
19 case INST_TYPE_NONE:
20 break;
21 case INST_TYPE_RD_IMML:
22- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
23- break;
24- case INST_TYPE_RD_R1_IMMW_IMMS:
25- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
26- break;
27+ print_func (stream, "\t%s, %s",
28+ get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
29+ break;
30+ case INST_TYPE_RD_R1_IMMW_IMMS:
31+ print_func (stream, "\t%s, %s, %s, %s",
32+ get_field_rd (&buf, inst),
33+ get_field_r1(&buf, inst),
34+ get_field_immw (&buf, inst),
35+ get_field_imms (&buf, inst));
36+ break;
37 /* For tuqula instruction */
38 case INST_TYPE_RD:
39 print_func (stream, "\t%s", get_field_rd (&buf, inst));
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
new file mode 100644
index 00000000..5e1fb44f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
@@ -0,0 +1,177 @@
1From 03df31becbc7dc6d35189fec3b4b2c7dfd3a8103 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:59:40 +0530
4Subject: [PATCH 43/54] microblaze_gdbarch_init: set microblaze_abi based on
5 wanted_abi and found_abi
6
7Earlier found_abi was declared but not set, instead gdbarch_info info
8was checked every time. Also, microblaze_abi remained undefined for 32-bit
9machines. As a result, gdb would show 64-bit registers when connecting
10to 32-bit targets with all register values garbled (r5 ended up in r2).
11This defect is fixed. found_abi is set from gdbarch_info, microblaze_abi
12is set based on wanted_abi and found_abi. Now upon connecting to a 32-bit
13remote target (mb-qemu) registers have the correct 32-bit size.
14
15Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
16Signed-off-by: Aayush Misra <aayushm@amd.com>
17---
18 gdb/microblaze-tdep.c | 73 +++++++++++++++++++------------------------
19 1 file changed, 33 insertions(+), 40 deletions(-)
20
21diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
22index 818306f2197..47863819724 100644
23--- a/gdb/microblaze-tdep.c
24+++ b/gdb/microblaze-tdep.c
25@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
26 const char *ignored_value)
27 {
28 enum microblaze_abi global_abi = global_microblaze_abi ();
29- enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
30+ enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
31 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
32
33 #if 1
34@@ -203,6 +203,13 @@ microblaze_register_name (struct gdbarch *gdbarch, int regnum)
35 static struct type *
36 microblaze_register_type (struct gdbarch *gdbarch, int regnum)
37 {
38+
39+ int mb_reg_size = microblaze_abi_regsize(gdbarch);
40+
41+ if (gdbarch_debug)
42+ gdb_printf (gdb_stdlog, "microblaze_register_type: reg_size = %d\n",
43+ mb_reg_size);
44+
45 if (regnum == MICROBLAZE_SP_REGNUM)
46 return builtin_type (gdbarch)->builtin_data_ptr;
47
48@@ -980,34 +987,38 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
49 enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
50 const struct target_desc *tdesc = info.target_desc;
51
52+ /* If there is already a candidate, use it. */
53+ arches = gdbarch_list_lookup_by_info (arches, &info);
54+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
55+ return arches->gdbarch;
56+
57 /* What has the user specified from the command line? */
58 wanted_abi = global_microblaze_abi ();
59 if (gdbarch_debug)
60 gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
61 wanted_abi);
62+
63+ found_abi = MICROBLAZE_ABI_AUTO;
64+
65+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
66+ found_abi = MICROBLAZE_ABI_M64;
67+
68 if (wanted_abi != MICROBLAZE_ABI_AUTO)
69 microblaze_abi = wanted_abi;
70-
71- /* If there is already a candidate, use it. */
72- arches = gdbarch_list_lookup_by_info (arches, &info);
73- if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
74- return arches->gdbarch;
75+ else
76+ microblaze_abi = found_abi;
77
78 if (microblaze_abi == MICROBLAZE_ABI_M64)
79 {
80- tdesc = tdesc_microblaze64;
81- reg_size = 8;
82+ tdesc = tdesc_microblaze64;
83+ reg_size = 8;
84 }
85- if (tdesc == NULL)
86+ else
87 {
88- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
89- {
90- tdesc = tdesc_microblaze64;
91- reg_size = 8;
92- }
93- else
94- tdesc = tdesc_microblaze;
95+ tdesc = tdesc_microblaze;
96+ reg_size = 4;
97 }
98+
99 /* Check any target description for validity. */
100 if (tdesc_has_registers (tdesc))
101 {
102@@ -1015,7 +1026,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
103 int valid_p;
104 int i;
105
106- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
107+ if (microblaze_abi == MICROBLAZE_ABI_M64)
108 feature = tdesc_find_feature (tdesc,
109 "org.gnu.gdb.microblaze64.core");
110 else
111@@ -1029,7 +1040,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
112 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
113 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
114 microblaze_register_names[i]);
115- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
116+ if (microblaze_abi == MICROBLAZE_ABI_M64)
117 feature = tdesc_find_feature (tdesc,
118 "org.gnu.gdb.microblaze64.stack-protect");
119 else
120@@ -1075,15 +1086,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
121
122 /* Register set.
123 make_regs (gdbarch); */
124- switch (info.bfd_arch_info->mach)
125- {
126- case bfd_mach_microblaze64:
127- set_gdbarch_ptr_bit (gdbarch, 64);
128- break;
129- }
130- if(microblaze_abi == MICROBLAZE_ABI_M64)
131+ if (microblaze_abi == MICROBLAZE_ABI_M64)
132 set_gdbarch_ptr_bit (gdbarch, 64);
133-
134+ else
135+ set_gdbarch_ptr_bit (gdbarch, 32);
136+
137 /* Map Dwarf2 registers to GDB registers. */
138 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
139
140@@ -1105,8 +1112,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
141 microblaze_breakpoint::bp_from_kind);
142 // set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
143
144-// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
145-
146 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
147
148 set_gdbarch_frame_args_skip (gdbarch, 8);
149@@ -1145,9 +1150,6 @@ _initialize_microblaze_tdep ()
150
151 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
152
153-// static struct cmd_list_element *setmicroblazecmdlist = NULL;
154-// static struct cmd_list_element *showmicroblazecmdlist = NULL;
155-
156 /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
157
158 add_setshow_prefix_cmd ("microblaze", no_class,
159@@ -1155,15 +1157,6 @@ _initialize_microblaze_tdep ()
160 _("Various microblaze specific commands."),
161 &setmicroblazecmdlist,&showmicroblazecmdlist,
162 &setlist,&showlist);
163-#if 0
164- add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
165- _("Various microblaze specific commands."),
166- &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
167-
168- add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
169- _("Various microblaze specific commands."),
170- &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
171-#endif
172
173 /* Allow the user to override the ABI. */
174 add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
175--
1762.34.1
177
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
new file mode 100644
index 00000000..f949a982
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
@@ -0,0 +1,32 @@
1From 254bd83017b21301c73e7501c71b2cf128ac18d9 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 11:36:32 +0530
4Subject: [PATCH 44/54] Start bfd_mach_microblaze values from 0 (0,1) instead
5 of (1,2)
6
7Before 64-bit support there was only bfd_mach_microblaze (implicitly set to 0),
8setting microblaze_mach_microblaze64 to 1
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/archures.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/bfd/archures.c b/bfd/archures.c
16index 2994a09bc37..e552349319f 100644
17--- a/bfd/archures.c
18+++ b/bfd/archures.c
19@@ -515,8 +515,8 @@ DESCRIPTION
20 . bfd_arch_lm32, {* Lattice Mico32. *}
21 .#define bfd_mach_lm32 1
22 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
23-.#define bfd_mach_microblaze 1
24-.#define bfd_mach_microblaze64 2
25+.#define bfd_mach_microblaze 0
26+.#define bfd_mach_microblaze64 1
27 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
28 .#define bfd_mach_kv3_unknown 0
29 .#define bfd_mach_kv3_1 1
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
new file mode 100644
index 00000000..6e4137ef
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
@@ -0,0 +1,61 @@
1From b2377a83918c814fd3b6ee2cd46a5f413f97a08e Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:37:11 +0530
4Subject: [PATCH 45/54] Fix build issues - bfd/reloc.c add missing relocs used
5 elsewhere
6
7 BFD_RELOC_MICROBLAZE_EA64
8 BFD_RELOC_MICROBLAZE_64_GPC
9
10Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/reloc.c | 16 +++++++++++-----
14 1 file changed, 11 insertions(+), 5 deletions(-)
15
16diff --git a/bfd/reloc.c b/bfd/reloc.c
17index fc28e27662f..5afe1518cd0 100644
18--- a/bfd/reloc.c
19+++ b/bfd/reloc.c
20@@ -6672,13 +6672,19 @@ ENUMDOC
21 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
22 to two words (uses imml instruction).
23 ENUM
24-BFD_RELOC_MICROBLAZE_64,
25+BFD_RELOC_MICROBLAZE_64
26 ENUMDOC
27 This is a 64 bit reloc that stores the 64 bit pc relative
28 value in two words (with an imml instruction). No relocation is
29 done here - only used for relaxing
30 ENUM
31-BFD_RELOC_MICROBLAZE_64_PCREL,
32+BFD_RELOC_MICROBLAZE_EA64
33+ENUMDOC
34+ This is a 64 bit reloc that stores the 64 bit pc relative
35+ value in two words (with an imml instruction). No relocation is
36+ done here - only used for relaxing
37+ENUM
38+BFD_RELOC_MICROBLAZE_64_PCREL
39 ENUMDOC
40 This is a 32 bit reloc that stores the 32 bit pc relative
41 value in two words (with an imml instruction). No relocation is
42@@ -6721,13 +6727,13 @@ ENUMDOC
43 value in two words (with an imml instruction). No relocation is
44 done here - only used for relaxing
45 ENUM
46-BFD_RELOC_MICROBLAZE_64_PCREL,
47+BFD_RELOC_MICROBLAZE_64_GOTPC
48 ENUMDOC
49- This is a 32 bit reloc that stores the 32 bit pc relative
50+ This is a 64 bit reloc that stores the 32 bit pc relative
51 value in two words (with an imml instruction). No relocation is
52 done here - only used for relaxing
53 ENUM
54- BFD_RELOC_MICROBLAZE_64_GOTPC
55+ BFD_RELOC_MICROBLAZE_64_GPC
56 ENUMDOC
57 This is a 64 bit reloc that stores the 32 bit pc relative
58 value in two words (with an imml instruction). No relocation is
59--
602.34.1
61
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
new file mode 100644
index 00000000..e9383c6f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
@@ -0,0 +1,125 @@
1From 4d201d0a948ab6160f449d41a50a6794dd3efde7 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:47:56 +0530
4Subject: [PATCH 46/54] Regenerate - bfd/bfd-in2.h bfd/libbfd.h
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 65 +++++++++++++++++++++++++++++----------------------
10 1 file changed, 37 insertions(+), 28 deletions(-)
11
12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
13index 4b022dbfba1..171de10910c 100644
14--- a/bfd/bfd-in2.h
15+++ b/bfd/bfd-in2.h
16@@ -1771,8 +1771,8 @@ enum bfd_architecture
17 bfd_arch_lm32, /* Lattice Mico32. */
18 #define bfd_mach_lm32 1
19 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
20-#define bfd_mach_microblaze 1
21-#define bfd_mach_microblaze64 2
22+#define bfd_mach_microblaze 0
23+#define bfd_mach_microblaze64 1
24 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
25 #define bfd_mach_kv3_unknown 0
26 #define bfd_mach_kv3_1 1
27@@ -6440,9 +6440,27 @@ the linker could optimize the movq to a leaq if possible. */
28 /* Relative offset within page of GOT slot. */
29 BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12,
30
31-/* Address of a GOT entry. */
32+/* Address of a GOT entry.
33+
34+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
35+to two words (uses imml instruction). */
36 BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT,
37
38+/* This is a 64 bit reloc that stores the 64 bit pc relative
39+value in two words (with an imml instruction). No relocation is
40+done here - only used for relaxing */
41+ BFD_RELOC_MICROBLAZE_64,
42+
43+/* This is a 64 bit reloc that stores the 64 bit pc relative
44+value in two words (with an imml instruction). No relocation is
45+done here - only used for relaxing */
46+ BFD_RELOC_MICROBLAZE_EA64,
47+
48+/* This is a 32 bit reloc that stores the 32 bit pc relative
49+value in two words (with an imml instruction). No relocation is
50+done here - only used for relaxing */
51+ BFD_RELOC_MICROBLAZE_64_PCREL,
52+
53 /* This is a 32 bit reloc for the microblaze that stores the
54 low 16 bits of a value */
55 BFD_RELOC_MICROBLAZE_32_LO,
56@@ -6468,34 +6486,19 @@ value in two words (with an imm instruction). No relocation is
57 done here - only used for relaxing */
58 BFD_RELOC_MICROBLAZE_32_NONE,
59
60-/* This is a 64 bit reloc that stores the 32 bit pc relative
61- * +value in two words (with an imml instruction). No relocation is
62- * +done here - only used for relaxing */
63- BFD_RELOC_MICROBLAZE_64_PCREL,
64-
65-/* This is a 64 bit reloc that stores the 32 bit relative
66- * +value in two words (with an imml instruction). No relocation is
67- * +done here - only used for relaxing */
68- BFD_RELOC_MICROBLAZE_EA64,
69-
70-/* This is a 64 bit reloc that stores the 32 bit pc relative
71- * +value in two words (with an imm instruction). No relocation is
72- * +done here - only used for relaxing */
73- BFD_RELOC_MICROBLAZE_64_NONE,
74-
75-/* This is a 64 bit reloc that stores the 32 bit pc relative
76- * +value in two words (with an imml instruction). No relocation is
77- * +done here - only used for relaxing */
78- BFD_RELOC_MICROBLAZE_64,
79+/* This is a 32 bit reloc that stores the 32 bit pc relative
80+value in two words (with an imml instruction). No relocation is
81+done here - only used for relaxing */
82+ BFD_RELOC_MICROBLAZE_64_NONE,
83
84 /* This is a 64 bit reloc that stores the 32 bit pc relative
85-value in two words (with an imm instruction). The relocation is
86-PC-relative GOT offset */
87+value in two words (with an imml instruction). No relocation is
88+done here - only used for relaxing */
89 BFD_RELOC_MICROBLAZE_64_GOTPC,
90
91 /* This is a 64 bit reloc that stores the 32 bit pc relative
92-value in two words (with an imml instruction). The relocation is
93-PC-relative GOT offset */
94+value in two words (with an imml instruction). No relocation is
95+done here - only used for relaxing */
96 BFD_RELOC_MICROBLAZE_64_GPC,
97
98 /* This is a 64 bit reloc that stores the 32 bit pc relative
99@@ -7199,7 +7202,10 @@ assembler and not (currently) written to any object files. */
100 BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
101 BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
102
103-/* Tilera TILE-Gx Relocations. */
104+/* Tilera TILE-Gx Relocations.
105+
106+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
107+to two words (uses imml instruction). */
108 BFD_RELOC_TILEGX_HW0,
109 BFD_RELOC_TILEGX_HW1,
110 BFD_RELOC_TILEGX_HW2,
111@@ -7310,7 +7316,10 @@ assembler and not (currently) written to any object files. */
112 BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD,
113 BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD,
114
115-/* Linux eBPF relocations. */
116+/* Linux eBPF relocations.
117+
118+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
119+to two words (uses imml instruction). */
120 BFD_RELOC_BPF_64,
121 BFD_RELOC_BPF_DISP32,
122 BFD_RELOC_BPF_DISPCALL32,
123--
1242.34.1
125
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
new file mode 100644
index 00000000..d31eb8ee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
@@ -0,0 +1,32 @@
1From 2a1036ac7639aa3b67b1f1ad7e1a6e7c4c22704b Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 16:32:22 +0530
4Subject: [PATCH 47/54] gdb/remote.c - revert earlier change to
5 process_g_packet
6
7When connecting to remote target, gdb (microblaze-xilinx-elf) was
8generating Truncated register 29 error when parsing the g packet,
9workaround added being reverted.
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/remote.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/gdb/remote.c b/gdb/remote.c
18index 8055c8f62e6..ae08c980efc 100644
19--- a/gdb/remote.c
20+++ b/gdb/remote.c
21@@ -8678,7 +8678,7 @@ remote_target::process_g_packet (struct regcache *regcache)
22 if (rsa->regs[i].pnum == -1)
23 continue;
24
25- if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
26+ if (offset >= sizeof_g_packet)
27 rsa->regs[i].in_g_packet = 0;
28 else if (offset + reg_size > sizeof_g_packet)
29 error (_("Truncated register %d in remote 'g' packet"), i);
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
new file mode 100644
index 00000000..f9cbb4a6
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
@@ -0,0 +1,46 @@
1From 6a5887919f00da84c973ec61c59efcd7d0fb120e Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Mon, 1 Apr 2024 16:21:28 +0530
4Subject: [PATCH 48/54] Fix build issues after Xilinx 2023.2 binutils patch
5 merge
6
7binutils/readelf.c - duplicate case statement
8gas/config/tc-microblaze.c - Missing , between array elements
9gas/config/tc-microblaze.c - A whole hunk ended up in wrong function/switch
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/libbfd.h | 6 +-
14 binutils/readelf.c | 5 -
15 gas/config/tc-microblaze.c | 375 +++++++++++++++++++------------------
16 3 files changed, 192 insertions(+), 194 deletions(-)
17
18Index: gdb-14.2/bfd/libbfd.h
19===================================================================
20--- gdb-14.2.orig/bfd/libbfd.h
21+++ gdb-14.2/bfd/libbfd.h
22@@ -3005,6 +3005,9 @@ static const char *const bfd_reloc_code_
23 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGE21",
24 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12",
25 "BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT",
26+ "BFD_RELOC_MICROBLAZE_64",
27+ "BFD_RELOC_MICROBLAZE_EA64",
28+ "BFD_RELOC_MICROBLAZE_64_PCREL",
29 "BFD_RELOC_MICROBLAZE_32_LO",
30 "BFD_RELOC_MICROBLAZE_32_LO_PCREL",
31 "BFD_RELOC_MICROBLAZE_32_ROSDA",
32@@ -3013,13 +3016,12 @@ static const char *const bfd_reloc_code_
33 "BFD_RELOC_MICROBLAZE_32_NONE",
34 "BFD_RELOC_MICROBLAZE_64_NONE",
35 "BFD_RELOC_MICROBLAZE_64_GOTPC",
36+ "BFD_RELOC_MICROBLAZE_64_GPC",
37 "BFD_RELOC_MICROBLAZE_64_GOT",
38 "BFD_RELOC_MICROBLAZE_64_PLT",
39 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
40 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
41 "BFD_RELOC_MICROBLAZE_COPY",
42- "BFD_RELOC_MICROBLAZE_64",
43- "BFD_RELOC_MICROBLAZE_64_PCREL",
44 "BFD_RELOC_MICROBLAZE_64_TLS",
45 "BFD_RELOC_MICROBLAZE_64_TLSGD",
46 "BFD_RELOC_MICROBLAZE_64_TLSLD",
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch
new file mode 100644
index 00000000..76fcef7d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch
@@ -0,0 +1,27 @@
1From bf491bdb2e4d30c14968be096969da700dedfc64 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Wed, 17 Apr 2024 16:14:14 +0530
4Subject: [PATCH 49/54] Add back R_MICROBLAZE_NONE for linker relaxation
5 processing
6
7Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/elf32-microblaze.c | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 554a80ae0e4..ec6613b6572 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2102,6 +2102,7 @@ microblaze_elf_relax_section (bfd *abfd,
18 irel->r_addend);
19 }
20 break;
21+ case R_MICROBLAZE_NONE:
22 case R_MICROBLAZE_32_NONE:
23 {
24 /* This was a PC-relative instruction that was
25--
262.34.1
27
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch
new file mode 100644
index 00000000..c9da78c3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch
@@ -0,0 +1,92 @@
1From d8b25fd6d8cac000bb8f5ad65ada949447322fca Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Wed, 1 May 2024 11:12:32 +0530
4Subject: [PATCH 50/54] When unwinding pc value, adjust return pc value
5
6A call (branch and link) instruction can include a delay slot, the
7value of pc stored in the link register for Microblaze architecture
8is the pc value corresponding to last executed instruction (call)
9in the caller. The return instruction (branch reg) includes an
10offset of 8 so that when function returns execution continues from
11the address at : link register + 8, as the instruction in delay slot
12(link register + 4) is already executed at the time of call.
13
14Handle this by adjusting pc value during unwind-pc.
15
16Basically restoring code to do this that seems to have been removed
17as part of a gdb patch (gdb patch #8, Xilinx Yocto 2023.2)
18
19That patch caused hundreds of regressions in gdb testuite, including
20gdb.base/advance.exp, which is now fixed.
21
22Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdb/microblaze-tdep.c | 24 ++++++++++++++++++------
26 1 file changed, 18 insertions(+), 6 deletions(-)
27
28diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
29index 47863819724..f87e406ada0 100644
30--- a/gdb/microblaze-tdep.c
31+++ b/gdb/microblaze-tdep.c
32@@ -523,6 +523,12 @@ microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
33 {
34 CORE_ADDR pc;
35 pc=frame_unwind_register_unsigned (next_frame, MICROBLAZE_PC_REGNUM);
36+ /* For sentinel frame, return address is actual PC. For other frames,
37+ return address is pc+8. This is a workaround because gcc does not
38+ generate correct return address in CIE. */
39+ if (frame_relative_level (next_frame) >= 0)
40+ pc = pc + 8;
41+ microblaze_debug ("unwind pc = 0x%x\n", (int) pc);
42 return pc;
43 }
44
45@@ -615,6 +621,7 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
46 struct microblaze_frame_cache *cache =
47 microblaze_frame_cache (this_frame, this_cache);
48
49+#if 1
50 if ((regnum == MICROBLAZE_SP_REGNUM &&
51 cache->register_offsets[MICROBLAZE_SP_REGNUM])
52 || (regnum == MICROBLAZE_FP_REGNUM &&
53@@ -625,15 +632,22 @@ if ((regnum == MICROBLAZE_SP_REGNUM &&
54
55 if (regnum == MICROBLAZE_PC_REGNUM)
56 {
57- regnum = 15;
58+ regnum = MICROBLAZE_PREV_PC_REGNUM;
59+
60+ microblaze_debug ("prev pc is r15 @ frame offset 0x%x\n",
61+ (int) cache->register_offsets[regnum] );
62+
63 return frame_unwind_got_memory (this_frame, regnum,
64 cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
65-
66 }
67+
68 if (regnum == MICROBLAZE_SP_REGNUM)
69 regnum = 1;
70-#if 0
71
72+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
73+ regnum);
74+
75+#else
76 if (cache->frameless_p)
77 {
78 if (regnum == MICROBLAZE_PC_REGNUM)
79@@ -646,9 +660,7 @@ if (regnum == MICROBLAZE_SP_REGNUM)
80 else
81 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
82 regnum);
83-#endif
84- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
85- regnum);
86+#endif
87 }
88
89 static const struct frame_unwind microblaze_frame_unwind =
90--
912.34.1
92
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch
new file mode 100644
index 00000000..887ee56e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch
@@ -0,0 +1,116 @@
1From 66c0cc9a030667111d4b632314502e868e5e8e37 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:30:22 +0530
4Subject: [PATCH 51/54] info reg pc does not print symbolic value
5
6Problem - Test gdb.base/pc-fp.exp fails
7Fix - Change feature/microblaze-core.xml add type=code_ptr for pc
8
9Files changed
10 features/microblaze-core.xml
11 features/microblaze.c (generated)
12 features/microblaze-with-stack-protect.c (generated)
13
14Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
15Signed-off-by: Aayush Misra <aayushm@amd.com>
16---
17 gdb/features/microblaze-core.xml | 4 ++--
18 gdb/features/microblaze-with-stack-protect.c | 10 ++++++----
19 gdb/features/microblaze.c | 8 ++++----
20 3 files changed, 12 insertions(+), 10 deletions(-)
21
22diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
23index ac052365773..205cdf94a27 100644
24--- a/gdb/features/microblaze-core.xml
25+++ b/gdb/features/microblaze-core.xml
26@@ -8,7 +8,7 @@
27 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
28 <feature name="org.gnu.gdb.microblaze.core">
29 <reg name="r0" bitsize="32" regnum="0"/>
30- <reg name="r1" bitsize="32"/>
31+ <reg name="r1" bitsize="32" type="data_ptr"/>
32 <reg name="r2" bitsize="32"/>
33 <reg name="r3" bitsize="32"/>
34 <reg name="r4" bitsize="32"/>
35@@ -39,7 +39,7 @@
36 <reg name="r29" bitsize="32"/>
37 <reg name="r30" bitsize="32"/>
38 <reg name="r31" bitsize="32"/>
39- <reg name="rpc" bitsize="32"/>
40+ <reg name="rpc" bitsize="32" type="code_ptr"/>
41 <reg name="rmsr" bitsize="32"/>
42 <reg name="rear" bitsize="32"/>
43 <reg name="resr" bitsize="32"/>
44diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
45index 8ab9565a047..95e3eed1a4e 100644
46--- a/gdb/features/microblaze-with-stack-protect.c
47+++ b/gdb/features/microblaze-with-stack-protect.c
48@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
49
50 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
51 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
52- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
53+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
54 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
55 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
56 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
57@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
58 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
59 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
60 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
61- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
62+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
63 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
64 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
65 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
66@@ -70,10 +70,12 @@ initialize_tdesc_microblaze_with_stack_protect (void)
67 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
68 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
69 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
70-
71- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
72 tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
73 tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
74
75+ feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
76+ tdesc_create_reg (feature, "slr", 59, 1, NULL, 32, "int");
77+ tdesc_create_reg (feature, "shr", 60, 1, NULL, 32, "int");
78+
79 tdesc_microblaze_with_stack_protect = result.release ();
80 }
81diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
82index ed12e5bcfd2..ff4865b2acc 100644
83--- a/gdb/features/microblaze.c
84+++ b/gdb/features/microblaze.c
85@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
86
87 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
88 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
89- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
90+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
91 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
92 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
93 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
94@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
95 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
96 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
97 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
98- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
99+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
100 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
101 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
102 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
103@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
104 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
105 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
106 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
107- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
108- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
109+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
110+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
111
112 tdesc_microblaze = result.release ();
113 }
114--
1152.34.1
116
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch
new file mode 100644
index 00000000..89318eec
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch
@@ -0,0 +1,51 @@
1From 0982e0c2733aa773d88876e68320b072e5b2a9ad Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:34:04 +0530
4Subject: [PATCH 52/54] Wrong target description accepted by microblaze
5 architecture
6
7Fix - Modify microblaze_gdbarch_init, set tdesc only when it is NULL
8
9Files changed - gdb/microblaze-tdep.c
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/microblaze-tdep.c | 21 ++++++++++++---------
15 1 file changed, 12 insertions(+), 9 deletions(-)
16
17diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
18index f87e406ada0..4d8c76bcf4c 100644
19--- a/gdb/microblaze-tdep.c
20+++ b/gdb/microblaze-tdep.c
21@@ -1020,15 +1020,18 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
22 else
23 microblaze_abi = found_abi;
24
25- if (microblaze_abi == MICROBLAZE_ABI_M64)
26- {
27- tdesc = tdesc_microblaze64;
28- reg_size = 8;
29- }
30- else
31- {
32- tdesc = tdesc_microblaze;
33- reg_size = 4;
34+ if (tdesc == NULL)
35+ {
36+ if (microblaze_abi == MICROBLAZE_ABI_M64)
37+ {
38+ tdesc = tdesc_microblaze64;
39+ reg_size = 8;
40+ }
41+ else
42+ {
43+ tdesc = tdesc_microblaze;
44+ reg_size = 4;
45+ }
46 }
47
48 /* Check any target description for validity. */
49--
502.34.1
51
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
new file mode 100644
index 00000000..2cb3ff06
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
@@ -0,0 +1,42 @@
1From 31b8744afcb31825083a23bbc08b6e00772ebd07 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 23 May 2024 16:02:59 +0530
4Subject: [PATCH 53/54] Merge gdb/microblaze-linux-tdep.c to gdb-14 and fix
5 compilation issues.
6
7Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 gdb/microblaze-linux-tdep.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
14index 20daef2ccd4..16d3a0b5196 100644
15--- a/gdb/microblaze-linux-tdep.c
16+++ b/gdb/microblaze-linux-tdep.c
17@@ -48,10 +48,12 @@ microblaze_debug (const char *fmt, ...)
18 if (microblaze_debug_flag)
19 {
20 va_list args;
21+ string_file file (gdb_stdout->can_emit_style_escape ());
22
23 va_start (args, fmt);
24 printf_unfiltered ("MICROBLAZE LINUX: ");
25- vprintf_unfiltered (fmt, args);
26+ file.vprintf (fmt, args);
27+ gdb_stdout->puts_unfiltered (file.string ().c_str ());
28 va_end (args);
29 }
30 }
31@@ -145,7 +147,7 @@ static void
32 microblaze_linux_init_abi (struct gdbarch_info info,
33 struct gdbarch *gdbarch)
34 {
35- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
36+ struct microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
37
38 tdep->sizeof_gregset = 200;
39
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
new file mode 100644
index 00000000..eb6bde20
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
@@ -0,0 +1,29 @@
1From 8a7a8b724a87c532096004f43b987c352474a905 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Fri, 19 Jul 2024 12:39:24 +0530
4Subject: [PATCH 54/54] Roll back an improvement which inlines target_gdbarch
5 () inherited from binutils 2.42 merge that causes compilation issues on gdb
6 14.2
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gdb/microblaze-tdep.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
15index 4d8c76bcf4c..cb6697654b0 100644
16--- a/gdb/microblaze-tdep.c
17+++ b/gdb/microblaze-tdep.c
18@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
19 const char *ignored_value)
20 {
21 enum microblaze_abi global_abi = global_microblaze_abi ();
22- enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
23+ enum microblaze_abi actual_abi = microblaze_abi ( target_gdbarch () );
24 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
25
26 #if 1
27--
282.34.1
29