* [PATCH 0/1] riscv: Ensure LE instruction fetching
@ 2023-06-20 11:43 Branislav Brzak
2023-06-20 11:44 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Branislav Brzak @ 2023-06-20 11:43 UTC (permalink / raw)
To: binutils; +Cc: Dragoslav Sicarov, Djordje Todorovic
[-- Attachment #1.1: Type: text/plain, Size: 411 bytes --]
Currently riscv gdb code looks at arch byte order
when fetching instructions. This works when the
target is LE, but on BE arch it will byte swap the
instruction, while the riscv spec defines all
instructions are LE encoded regardless of
system memory endianess.
Branislav Brzak (1):
gdb/riscv: Ensure LE instruction fetching
gdb/riscv-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-riscv-tdep.c-riscv_insn-fetch_instruction-Always-fet.patch --]
[-- Type: text/x-patch; name="0001-riscv-tdep.c-riscv_insn-fetch_instruction-Always-fet.patch", Size: 794 bytes --]
From 391716c3138697a0b8a1836c1ffdb44b1b6b9da4 Mon Sep 17 00:00:00 2001
From: Branislav Brzak <branislav.brzak@syrmia.com>
Date: Tue, 20 Jun 2023 13:20:40 +0200
Subject: [PATCH] * riscv-tdep.c (riscv_insn::fetch_instruction): Always fetch
instructions as LE
---
gdb/riscv-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 500279e1ae9..b4f98089937 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1812,7 +1812,7 @@ ULONGEST
riscv_insn::fetch_instruction (struct gdbarch *gdbarch,
CORE_ADDR addr, int *len)
{
- enum bfd_endian byte_order = gdbarch_byte_order_for_code (gdbarch);
+ enum bfd_endian byte_order = BFD_ENDIAN_LITTLE;
gdb_byte buf[RISCV_MAX_INSN_LEN];
int instlen, status;
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] riscv: Ensure LE instruction fetching
2023-06-20 11:43 [PATCH 0/1] riscv: Ensure LE instruction fetching Branislav Brzak
@ 2023-06-20 11:44 ` Jan Beulich
2023-06-20 11:46 ` Branislav Brzak
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-06-20 11:44 UTC (permalink / raw)
To: Branislav Brzak; +Cc: Dragoslav Sicarov, Djordje Todorovic, binutils
On 20.06.2023 13:43, Branislav Brzak wrote:
> Currently riscv gdb code looks at arch byte order
> when fetching instructions. This works when the
> target is LE, but on BE arch it will byte swap the
> instruction, while the riscv spec defines all
> instructions are LE encoded regardless of
> system memory endianess.
>
> Branislav Brzak (1):
> gdb/riscv: Ensure LE instruction fetching
>
> gdb/riscv-tdep.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Looks like you meant to send this to gdb-patches@sourceware.org?
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] riscv: Ensure LE instruction fetching
2023-06-20 11:44 ` Jan Beulich
@ 2023-06-20 11:46 ` Branislav Brzak
0 siblings, 0 replies; 3+ messages in thread
From: Branislav Brzak @ 2023-06-20 11:46 UTC (permalink / raw)
To: Jan Beulich; +Cc: Dragoslav Sicarov, Djordje Todorovic, binutils
[-- Attachment #1: Type: text/plain, Size: 989 bytes --]
I have, I apologize for this.
Regards,
Branislav
________________________________
From: Jan Beulich <jbeulich@suse.com>
Sent: Tuesday, June 20, 2023 1:44 PM
To: Branislav Brzak <Branislav.Brzak@Syrmia.com>
Cc: Dragoslav Sicarov <Dragoslav.Sicarov@Syrmia.com>; Djordje Todorovic <Djordje.Todorovic@syrmia.com>; binutils@sourceware.org <binutils@sourceware.org>
Subject: Re: [PATCH 0/1] riscv: Ensure LE instruction fetching
On 20.06.2023 13:43, Branislav Brzak wrote:
> Currently riscv gdb code looks at arch byte order
> when fetching instructions. This works when the
> target is LE, but on BE arch it will byte swap the
> instruction, while the riscv spec defines all
> instructions are LE encoded regardless of
> system memory endianess.
>
> Branislav Brzak (1):
> gdb/riscv: Ensure LE instruction fetching
>
> gdb/riscv-tdep.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Looks like you meant to send this to gdb-patches@sourceware.org?
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-20 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 11:43 [PATCH 0/1] riscv: Ensure LE instruction fetching Branislav Brzak
2023-06-20 11:44 ` Jan Beulich
2023-06-20 11:46 ` Branislav Brzak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).