From: "Olivier Hériveaux" <olivier.heriveaux@ledger.fr>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, alistair@alistair23.me,
peter.maydell@linaro.org,
"Olivier Hériveaux" <olivier.heriveaux@ledger.fr>
Subject: [PATCH] Fix STM32F2XX USART data register readout
Date: Sun, 28 Nov 2021 13:07:23 +0100 [thread overview]
Message-ID: <20211128120723.4053-1-olivier.heriveaux@ledger.fr> (raw)
Fix issue where the data register may be overwritten by next character
reception before being read and returned.
Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr>
---
hw/char/stm32f2xx_usart.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index 8df0832424..fde67f4f03 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -103,10 +103,11 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
return retvalue;
case USART_DR:
DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);
+ retvalue = s->usart_dr & 0x3FF;
s->usart_sr &= ~USART_SR_RXNE;
qemu_chr_fe_accept_input(&s->chr);
qemu_set_irq(s->irq, 0);
- return s->usart_dr & 0x3FF;
+ return retvalue;
case USART_BRR:
return s->usart_brr;
case USART_CR1:
--
2.17.1
--
Les informations contenues dans ce message électronique ainsi que celles
contenues dans les documents attachés sont strictement confidentielles et
sont destinées à l'usage exclusif du (des) destinataire(s) nommé(s).
Toute
divulgation, distribution ou reproduction, même partielle, en est
strictement interdite sauf autorisation écrite et expresse de l’émetteur.
Si vous recevez ce message par erreur, veuillez le notifier immédiatement à
son émetteur par retour, et le détruire ainsi que tous les documents qui y
sont attachés.
The information contained in this email and in any
document enclosed is strictly confidential and is intended solely for the
use of the individual or entity to which it is addressed.
Partial or total
disclosure, distribution or reproduction of its contents is strictly
prohibited unless expressly approved in writing by the sender.
If you have
received this communication in error, please notify us immediately by
responding to this email, and then delete the message and its attached
files from your system.
next reply other threads:[~2021-11-28 14:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-28 12:07 Olivier Hériveaux [this message]
2021-11-29 10:46 ` [PATCH] Fix STM32F2XX USART data register readout Peter Maydell
2021-11-29 16:35 ` Olivier Heriveaux
2021-11-29 12:07 ` Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211128120723.4053-1-olivier.heriveaux@ledger.fr \
--to=olivier.heriveaux@ledger.fr \
--cc=alistair@alistair23.me \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.