From: Michael Eager <eager@eagercon.com>
To: Joel Sherrill <joel@rtems.org>,
gdb@sourceware.org, Newlib <newlib@sourceware.org>,
Mike Frysinger <vapier@gentoo.org>
Subject: Re: Microblaze libgloss and gdb simulator
Date: Sun, 25 Apr 2021 17:44:28 -0700 [thread overview]
Message-ID: <cdd89a72-3afc-0aa8-82f8-d16c3fac5c25@eagercon.com> (raw)
In-Reply-To: <YIX8mdx+Uk2fLG0J@vapier>
On 4/25/21 4:34 PM, Mike Frysinger wrote:
>> If you are simulating a program which uses libgloss and you expect the
>> behavior of brki to be a syscall, then this is a very reasonable way
>> to implement system calls. Instead of taking the branch to the handler,
>> the simulator does whatever host system call it is supposed to do, then
>> returns, just as if there was an OS handling the system call. (This is
>> what QEMU calls "semihosting".)
>
> yes, this is exactly what we were thinking. i wasn't aware of the QEMU
> terminology, thanks. in the GNU sim, we call them "environments". the
> default is the virtual environment which behaves this way: there is only
> one privilege level, and any exception processing is handled entirely in
> the sim itself.
The "semihosting" terminology may be an ARM-ism, rather than a QEMU-ism,
although that's where I saw it first mentioned.
https://www.keil.com/support/man/docs/armcc/armcc_pge1358787046598.htm
https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/What-are-none-nohost-and-semihost-libraries/m-p/475327
The debugger (or debugger agent on the target) uses a side channel to
perform I/O on the host.
I wasn't aware of sim environments. I haven't looked at gdb/sim in
a long time. :-)
>> I was thinking about the more general case, where you might be
>> simulating an image which includes an exception handler. In this
>> case, the behavior you want is to take the exception and jump to the
>> excption handler address, instead of the simlator interpreting the
>> brki as a syscall.
>
> absolutely this makes sense. this would be the "operating" environment
> where the sim wouldn't hijack anything, and it would be responsible for
> emulating the various privilege levels such as setting mode bits and
> transferring control to any registered exception handlers. this would
> be useful for e.g. fully simulating the Linux kernel & userland.
>
> it sounds like we're in agreement. if there's anyone you think we could
> or should consult before moving forward, please loop them in.
Go for it!
--
Michael Eager
prev parent reply other threads:[~2021-04-26 0:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 22:25 Joel Sherrill
[not found] ` <CAF9ehCV8fPNObXbTALFFpfnOX53ZbKen-EdtNWWrsQNYekxnSQ@mail.gmail.com>
2021-04-23 0:27 ` Mike Frysinger
2021-04-23 0:55 ` Joel Sherrill
2021-04-23 1:19 ` Mike Frysinger
2021-04-24 5:02 ` Mike Frysinger
2021-04-25 17:21 ` Mike Frysinger
2021-04-25 18:37 ` Michael Eager
2021-04-25 20:27 ` Mike Frysinger
2021-04-25 22:29 ` Michael Eager
2021-04-25 23:34 ` Mike Frysinger
2021-04-26 0:44 ` Michael Eager [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=cdd89a72-3afc-0aa8-82f8-d16c3fac5c25@eagercon.com \
--to=eager@eagercon.com \
--cc=gdb@sourceware.org \
--cc=joel@rtems.org \
--cc=newlib@sourceware.org \
--cc=vapier@gentoo.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 read-only IMAP folder(s) and NNTP newsgroup(s).