From: Peter Maydell <peter.maydell@linaro.org>
To: Eva Chen <debby83729@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Question about io_writex()
Date: Tue, 15 May 2018 09:58:07 +0100 [thread overview]
Message-ID: <CAFEAcA-m7-xuMkpVyb4Xy-ENbraCgcDL0BeqMG0y6cb+_6H5EA@mail.gmail.com> (raw)
In-Reply-To: <CAG0V3WQCJ-ttZNo3A4tLy3Y=QADhfk8VaDFRRbrLjNBRWYw63w@mail.gmail.com>
On 15 May 2018 at 02:26, Eva Chen <debby83729@gmail.com> wrote:
> Hello,
>
> I want to know the flow of how devices read/write function be called by
> code_gen_buffer().
> Take pl110_write() for example, I set a breakpoint in pl110_write(), and
> the backtrace shows bellow.
Hi. This code flow is a bit complicated. You'll probably find
your backtraces give you better information if you build QEMU
without optimization (pass --enable-debug to configure). Then
you won't get all those <optimized out> things for parameters
in the backtrace, and the compiler will also be less likely to
confusingly inline functions.
> This backtrace shows that pl110_write() is called by io_wrtex(), but I
> can't find who call the io_writex().
io_writex() is called by functions in accel/tcg/softmmu_template.h.
These are a bit tricky because we include this header file multiple
times and use the C preprocessor to construct function names, like:
static inline void glue(io_write, SUFFIX)(CPUArchState *env,
size_t mmu_idx, size_t index,
DATA_TYPE val,
target_ulong addr,
uintptr_t retaddr)
{
[...]
}
The header is included multiple times, with SUFFIX being 'q', 'l',
'w', and so on, so this one line gives us functions io_writeq,
io_writel, io_writew.
> code_gen_buffer() is the part that QEMU execute the TB, I think maybe
> io_writex() is called by the helper function but I only find io_writex() in
> softmmu_template.h (*static inline void glue(io_write, SUFFIX)), *which is
> not related to the helper function.
It is related. io_writel and friends are called from
the functions defined in softmmu_template.h which look like
they're called 'helper_le_st_name' and 'helper_be_st_name', but
note that those are #defines defined earlier in the file, and
the actual function names are therefore a family of functions
with names like 'helper_le_ldul_mmu'. (A non-optimized build
will probably show you this function in the gdb backtrace.)
Those helper functions are called directly from generated TCG
code.
thanks
-- PMM
prev parent reply other threads:[~2018-05-15 8:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 1:26 [Qemu-devel] Question about io_writex() Eva Chen
2018-05-15 8:58 ` Peter Maydell [this message]
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=CAFEAcA-m7-xuMkpVyb4Xy-ENbraCgcDL0BeqMG0y6cb+_6H5EA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=debby83729@gmail.com \
--cc=qemu-devel@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 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 NNTP newsgroup(s).