[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] confusion about monitor table in shadow mode



Hi,Tim
        I have confusion when understanding monitor table in shadow
mode. In arch/x86/mm/shadow/mutli.c, the definition of
sh_make_monitor_table is following:
        #if SHADOW_PAGING_LEVELS == GUEST_PAGING_LEVELS
        mfn_t
        sh_make_monitor_table(struct vcpu *v)
        {
        .......
        }
The macro SHADOW_PAGING_LEVELS is defined in arch/x86/mm/shadow/types.h:
        #if GUEST_PAGING_LEVELS == 4
        #define SHADOW_PAGING_LEVELS 4
        #else
        #define SHADOW_PAGING_LEVELS 3
        #endif
If a 32-bit hvm is created, its GUEST_PAGING_LEVELS should be 2. In this
case, SHADOW_PAGING_LEVELS will be 3 and sh_make_monitor_table will not
be compiled. Is it correct? But, when a hvm domain is initialized, Xen
will call sh_update_paging_modes to create a monitor table for it:
In sh_update_paging_modes:
        #ifdef __x86_64__
            if ( hvm_long_mode_enabled(v) )
            {
                // long mode guest...
                v->arch.paging.mode =
                    &SHADOW_INTERNAL_NAME(sh_paging_mode, 4);
            }
            else
        #endif
                if ( hvm_pae_enabled(v) )
                {
                    // 32-bit PAE mode guest...
                    v->arch.paging.mode =
                        &SHADOW_INTERNAL_NAME(sh_paging_mode, 3);
                }
                else
                {
                    // 32-bit 2 level guest...
                    v->arch.paging.mode =
                        &SHADOW_INTERNAL_NAME(sh_paging_mode, 2);
                }
        }

        if ( pagetable_is_null(v->arch.monitor_table) )
        {
            mfn_t mmfn =
v->arch.paging.mode->shadow.make_monitor_table(v);
            v->arch.monitor_table = pagetable_from_mfn(mmfn);
            make_cr3(v, mfn_x(mmfn));
            hvm_update_host_cr3(v);
        }
This function will finally be called by hvm_domain_initialise. But
sh_make_monitor_table is NULL-poinitor. What will happened in this case?

Need your help!

-Techie



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.