From: "John R. Hogerhuis" <jhoger@pobox.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Storing code caching
Date: Thu, 08 Jul 2004 11:28:44 -0700 [thread overview]
Message-ID: <1089311324.12380.1750.camel@aragorn> (raw)
In-Reply-To: <431F9EDC-D108-11D8-8B8C-000A95B1EB4C@mac.com>
On Thu, 2004-07-08 at 10:57, Martin Williams wrote:
> My idea is to write a program that caches individual files code (rather
> than everything) - based around the idea that when a block is started
> executing, the cache would be accessed and address minus the base
> address (in other words the offset of the block) would be used to find
> it within the cache (some algorithm is needed for an efficient method
> of storing and locating these blocks as they will not be the same size
> as the originals). The basic idea would then be that once qemu detects
> a self modifying piece of code, (by a write to a memory address), it
> would then black list the block in which the write happened (is this
> possible?).
>
Again... are you talking about User Mode QEMU where you are only running
one program + libraries or are you talking about QEMU running an
operating system?
I can imagine in running an OS you are going to get a lot of collisions
where two blocks are at the same offset. Throw in the length of the
block and I suppose you will have a lot less but I would guess it will
still happen enough to be a problem. You'll have to try and see. The
difference between the regular QEMU cache and one saved to disk is that
the segment selectors are not valid across runs.
In any event, if you do get a collision you can do a memcmp to see if
they are really the same exact thing. The trick is to have good enough
heurisitics that you don't do the memcmp very often.
> The program I would write would basically use the qemu core to process
> an entire executable, creating the blocks that are executable on the
> host machine, and store them. Then start work on modifying qemu to
> recognise the existense of the cache file and use the blocks. Then deal
> with the self-modyfing code issue as above ...
>
QEMU loads the binary to RAM and builds the cache as it simulates its
execution. Working from a executable file without simulating is a bit
different. For that you should probably look into how a disassembler
works and also realize you have a lot of reworking to do if you want to
take the approach. I wouldn't, unless your goal is to be able to
actually make a new shippable translated binary image. If you are
looking to do that, I think that's, well... ambitious would be the nice
word.
> Martin
>
> PS - I'm a CS undergrad, but I'm game for it anyway :)
Well that just means you can attack the halting problem with more
optimism than some of the other folks here ;-) Actually when people
bring that up you just need to keep in mind that it is theory.
Important, but in engineering the solution just has to meet the
threshold of "good enough."
next prev parent reply other threads:[~2004-07-08 18:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-08 12:26 [Qemu-devel] Storing code caching Martin Williams
2004-07-08 17:05 ` John R. Hogerhuis
2004-07-08 17:25 ` Antony T Curtis
2004-07-08 18:42 ` [spam score 1/10 -pobox] " John R. Hogerhuis
2004-07-08 19:42 ` Re[2]: " Igor Shmukler
2004-07-08 17:57 ` Martin Williams
2004-07-08 18:28 ` John R. Hogerhuis [this message]
2004-07-08 19:11 ` Julian Seward
2004-07-08 19:45 ` John R. Hogerhuis
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=1089311324.12380.1750.camel@aragorn \
--to=jhoger@pobox.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).