WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] How to map machine address and pseudo-physical address?

To: xen-devel@xxxxxxxxxxxxxxxxxxx <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] How to map machine address and pseudo-physical address?
From: Guillaume Thouvenin <guillaume.thouvenin@xxxxxxxx>
Date: Wed, 28 Feb 2007 15:04:38 +0100
Delivery-date: Wed, 28 Feb 2007 06:05:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Bull S.A.
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hello evrybody,

  I need to parse data structures supplied by the BIOS in machine memory.
I'd like to know how I can do it in dom0? 

  I though about mapping part of memory machine in dom0 but I have the
following problem. I take the example of code taken from Linux in
arch/i386/kernel/summit.c to get the pointer to the EBDA at physical @
0x40E:

...
    unsigned long           ptr;

    /* The pointer to the EBDA is stored in the word @ phys 
       0x40E(40:0E)*/
    ptr = *(unsigned short *)phys_to_virt(0x40Eul);
    ptr = (unsigned long)phys_to_virt(ptr << 4);
...

On a linux kernel, ptr==0xffff810000099000
If I run the same code inside dom0, I get ptr==0xffff880000000000

  It's normal because under dom0 the 0X40E corresponds to the pseudo
physical address and not to the machine address. So the idea (maybe it's
not the good one, it's a try :) is to map the machine address 0x40E to
pseudo physical address 0x40E and then, I should read the correct
pointer value from dom0. Thus in Xen I add a new 'case' in the
function arch/x86/plateform_hypercall.c:do_platform_op() that is:

....
    case XENPF_set_ebda_ptr:
    {
       unsigned long ebda_ptr = op->u.set_ebda_ptr.val;
       unsigned long ptr;
        
        /* the ptr value is used to see if the mapping is working */
        /* The pointer to the EBDA is stored in the word @ maddr
           0x40E(40:0E) */
        ptr = *(unsigned short*)maddr_to_virt(ebda_ptr); 
        ptr = (unsigned long)maddr_to_virt(ptr << 4);
        printk(KERN_INFO "TESTGuill: ptr = 0x%lx \n", ptr);            
        set_gpfn_from_mfn(ebda_ptr, ebda_ptr);
    }       
    break;
....

  I also add needed structure. Now, before reading ptr in dom0, I make an
hypercall to map machine address 0x40E (value passed in
op->u.set_ebda_ptr.val) and I can see in the boot messages the
following:

(XEN) TESTGuill: ptr = 0xffff830000099000
TESTGuill: ptr = 0xffff880000000000

  I expected to see the same value under Xen and under dom0. The value
0xffff830000099000 read under Xen seems OK because it corresponds to 1:1
direct mapping of all physical memory so 0x99000 is the right value.

 So the question is: Is machine memory mapped in dom0? if not, can I map
parts of it?


Regards,
Guillaume 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>