|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] How works Xen mmu ?
On Wed, Jun 2, 2010 at 10:07 PM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
> On 18/05/2010 09:01, "Sylvestre Gallon" <syl@xxxxxxxxx> 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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|