All of lore.kernel.org
 help / color / mirror / Atom feed
* Fetching instructions after page-fault, near page boundary?
@ 2006-06-02 16:34 Petersson, Mats
  2006-06-02 16:40 ` Keir Fraser
  2006-06-02 20:16 ` Fetching instructions after page-fault, near page boundary? Anthony Liguori
  0 siblings, 2 replies; 13+ messages in thread
From: Petersson, Mats @ 2006-06-02 16:34 UTC (permalink / raw)
  To: xen-devel

If we get a page-fault due to a MMIO access to a virtual MMIO device
(such as VGA screen in HVM), we shouldn't need to worry about crossing
the page-boundary at the end of the instruction, right? Let's say the
instruction is a 7-byte instruction like this:

xxxx1FFD: 11 22 33 <page boundary to page xxxx2000> 44 55 66 77

If the page xxxx2000 isn't present when the instruction is started, then
we'd FIRST get a page-fault for this address, so either we fail the
instruction (if xxxx2000 page isn't actually possible to be fixed up),
or we get the page fixed up and therefore the second time, when we get
to the page-fault handler looking at the address the instruction is
accessing [doing the MMIO part], the second page is present [assuming we
haven't got any sneaky code going round modifying the page-tables for
this guest domain - which I don't think is a VALID thing to expect, is
it?]

Next case is where we have a short instruction before an empty(unused
page), say a three-byte instruction (RR is another instructon, such as a
return instruction). 

xxx1FFC: 11 22 33 RR <page boundary to xxxx2000> [not readable since
it's not present]. 


My design idea for the merged x86_emulate.c in QEMU is to read
instruction bytes blind (i.e. not knowing the actual instruction length)
by the this method:
Try to read 15 bytes (MAX_INST_LEN), and if the instruction bytes happen
to cross a page-boundary, and the second page is not readable, I'll just
cut the number of bytes short, assuming that the valid instruction is
shorter than 15 bytes. 

Does anyone see a problem with this method?

[By the way, this makes an improvement over the current setup, which
fails if we try to read a page that isn't readable - which at least the
SVM model does try sometimes]. 

--
Mats

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-06-03  8:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-02 16:34 Fetching instructions after page-fault, near page boundary? Petersson, Mats
2006-06-02 16:40 ` Keir Fraser
2006-06-02 17:07   ` Petersson, Mats
2006-06-02 17:12     ` Keir Fraser
2006-06-02 17:20       ` Petersson, Mats
2006-06-02 18:50         ` Keir Fraser
2006-06-02 19:04           ` Petersson, Mats
2006-06-03  8:53             ` Keir Fraser
2006-06-02 21:39           ` Usage of "container_of" in QEMU Petersson, Mats
2006-06-03  8:50             ` Keir Fraser
2006-06-02 20:16 ` Fetching instructions after page-fault, near page boundary? Anthony Liguori
2006-06-02 20:29   ` Petersson, Mats
2006-06-02 20:35     ` Anthony Liguori

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.