Remove the distinction between GDT and LDT pages, as was discussed a while back. Such pages could really be used in both tables. The purpose, however, is to free up a page type which can subsequently (by code yet to be written) be used for a generic guest-may-only-map- readonly page type as would be desirable for e.g. implementing debug store virtualization (Linux 2.6.25 made a first attempt at adding support for the debug trace store to the ptrace interface, but due to issues with that code it got disabled again - nevertheless I would prefer Xen being able to handle this once it becomes available, so we don''t need to prevent the code from being executed in the kernel). Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: 2008-04-01/xen/arch/x86/mm.c ==================================================================--- 2008-04-01.orig/xen/arch/x86/mm.c 2008-04-01 14:24:03.000000000 +0200 +++ 2008-04-01/xen/arch/x86/mm.c 2008-04-01 15:12:27.000000000 +0200 @@ -476,7 +476,7 @@ static void invalidate_shadow_ldt(struct if ( pfn == 0 ) continue; l1e_write(&v->arch.perdomain_ptes[i], l1e_empty()); page = mfn_to_page(pfn); - ASSERT_PAGE_IS_TYPE(page, PGT_ldt_page); + ASSERT_PAGE_IS_TYPE(page, PGT_descriptor_page); ASSERT_PAGE_IS_DOMAIN(page, v->domain); put_page_and_type(page); } @@ -530,7 +530,7 @@ int map_ldt_shadow_page(unsigned int off if ( unlikely(!mfn_valid(mfn)) ) return 0; - okay = get_page_and_type(mfn_to_page(mfn), d, PGT_ldt_page); + okay = get_page_and_type(mfn_to_page(mfn), d, PGT_descriptor_page); if ( unlikely(!okay) ) return 0; @@ -924,7 +924,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, { /* We expect this is rare so we blow the entire shadow LDT. */ if ( unlikely(((page->u.inuse.type_info & PGT_type_mask) == - PGT_ldt_page)) && + PGT_descriptor_page)) && unlikely(((page->u.inuse.type_info & PGT_count_mask) != 0)) && (d == e) ) { @@ -1748,8 +1748,7 @@ static int alloc_page_type(struct page_i return alloc_l3_table(page); case PGT_l4_page_table: return alloc_l4_table(page); - case PGT_gdt_page: - case PGT_ldt_page: + case PGT_descriptor_page: return alloc_segdesc_page(page); default: printk("Bad type in alloc_page_type %lx t=%" PRtype_info " c=%x\n", @@ -3134,7 +3133,7 @@ long set_gdt(struct vcpu *v, { mfn = frames[i] = gmfn_to_mfn(d, frames[i]); if ( !mfn_valid(mfn) || - !get_page_and_type(mfn_to_page(mfn), d, PGT_gdt_page) ) + !get_page_and_type(mfn_to_page(mfn), d, PGT_descriptor_page) ) goto fail; } @@ -3211,12 +3210,8 @@ long do_update_descriptor(u64 pa, u64 de /* Check if the given frame is in use in an unsafe context. */ switch ( page->u.inuse.type_info & PGT_type_mask ) { - case PGT_gdt_page: - if ( unlikely(!get_page_type(page, PGT_gdt_page)) ) - goto out; - break; - case PGT_ldt_page: - if ( unlikely(!get_page_type(page, PGT_ldt_page)) ) + case PGT_descriptor_page: + if ( unlikely(!get_page_type(page, PGT_descriptor_page)) ) goto out; break; default: Index: 2008-04-01/xen/include/asm-x86/mm.h ==================================================================--- 2008-04-01.orig/xen/include/asm-x86/mm.h 2008-04-01 14:20:25.000000000 +0200 +++ 2008-04-01/xen/include/asm-x86/mm.h 2008-04-01 15:09:44.000000000 +0200 @@ -69,8 +69,7 @@ struct page_info #define PGT_l2_page_table (2U<<29) /* using this page as an L2 page table? */ #define PGT_l3_page_table (3U<<29) /* using this page as an L3 page table? */ #define PGT_l4_page_table (4U<<29) /* using this page as an L4 page table? */ -#define PGT_gdt_page (5U<<29) /* using this page in a GDT? */ -#define PGT_ldt_page (6U<<29) /* using this page in an LDT? */ +#define PGT_descriptor_page (5U<<29) /* using this page in a GDT/LDT? */ #define PGT_writable_page (7U<<29) /* has writable mappings of this page? */ #define PGT_type_mask (7U<<29) /* Bits 29-31. */ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel