xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Sylvestre Gallon <syl@pmbsd.org>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: How works Xen mmu ?
Date: Thu, 3 Jun 2010 15:16:29 +0200	[thread overview]
Message-ID: <AANLkTim04Uva2LfOPP8MKN1OBbYE7XbMjw-zifD2esae@mail.gmail.com> (raw)
In-Reply-To: <C82C7886.16838%keir.fraser@eu.citrix.com>

On Wed, Jun 2, 2010 at 10:07 PM, Keir Fraser <keir.fraser@eu.citrix.com> wrote:
> On 18/05/2010 09:01, "Sylvestre Gallon" <syl@pmbsd.org> wrote:
>
>> My need is to simply perform an identity mapping at 0xb8000 to allow
>> my operating system to access the vga frammebuffer. So my first idea
>> was to use HYPERVISOR_mmu_update like this :
>>
>> mmu_update_t mmu;
>> uint8_t *buf = (uint8_t *) 0xb8000;
>>
>> mmu.ptr = 0xb8000 | MMU_MACHPHYS_UPDATE
>> mmu.val = 0xb8000
>> HYPERVISOR_mmu_update(&mmu, 1, NULL, DOMID_SELF);
>
> You need to use MMU_NORMAL_PT_UPDATE command, passing a pointer to a pte
> (pagetable entry) in mmu.ptr and the value to write to that pte in mmu.val.
>
>  -- Keir
>

Thanks for you response.

If I understand I need to do something like that :

mmu_update_t mmu;

addr = get_cr3();                     // getting page directory
addr &= 0xfffff000;                   // remove pdir flags
addr = ((uint32_t*) addr_[0];     // get address of first page dir
(0xb8000 is in the first pdir)
addr += 0xb8 * 4;                    // 0xb8000 must be the pte 0xb8 into pdir 0

mmu.ptr = pte | MMU_NORMAL_PT_UPDATE;
mmu.val = 0xb8000 | 0x3;        // 0x3 for pte present and rw flags

HYPERVISOR_mmu_update(&mmu, 1, NULL, DOMID_SELF);

while(42);

But when I try this code I get an unhandled page fault :/

Do I have misunderstood something ?

Thanks a lot for your time,

Cheers,

-- 
Sylvestre Gallon

  reply	other threads:[~2010-06-03 13:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  8:01 How works Xen mmu ? Sylvestre Gallon
2010-06-02 20:07 ` Keir Fraser
2010-06-03 13:16   ` Sylvestre Gallon [this message]
2010-06-03 13:29     ` Keir Fraser
2010-06-03 15:23       ` Sylvestre Gallon
2010-06-03 15:54         ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2010-05-25 13:07 Sylvestre Gallon

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=AANLkTim04Uva2LfOPP8MKN1OBbYE7XbMjw-zifD2esae@mail.gmail.com \
    --to=syl@pmbsd.org \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).