ia64/xen-unstable

changeset 6424:4abd299ef2f6

merge?
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 25 14:16:38 2005 +0000 (2005-08-25)
parents f4bc62ee03b4 8d31f9a9c423
children 488bdf86c686
files Config.mk linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/early_printk.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/Makefile linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h tools/blktap/blktaplib.h tools/blktap/parallax/block-async.h tools/blktap/parallax/blockstore.h tools/console/Makefile tools/console/client/main.c tools/console/daemon/io.c tools/console/daemon/main.c tools/console/daemon/utils.c tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c tools/debugger/libxendebug/Makefile tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_evtchn.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xc.c tools/debugger/pdb/pdb_caml_xcs.c tools/debugger/pdb/pdb_xen.c tools/examples/README tools/firmware/acpi/acpi2_0.h tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/hw/ioapic.h tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/libxc/Makefile tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_aout9.c tools/libxc/xc_load_bin.c tools/libxc/xc_load_elf.c tools/libxc/xc_private.c tools/libxc/xc_private.h tools/libxc/xc_vmx_build.c tools/libxc/xenctrl.h tools/libxc/xenguest.h tools/libxc/xg_private.c tools/libxc/xg_private.h tools/misc/Makefile tools/misc/cpuperf/Makefile tools/misc/cpuperf/cpuperf_xeno.h tools/misc/xc_shadow.c tools/misc/xenperf.c tools/python/setup.py tools/python/xen/lowlevel/xc/xc.c tools/python/xen/lowlevel/xu/xu.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py tools/xcs/Makefile tools/xcs/dump.h tools/xcs/xcs.h tools/xcs/xcsdump.c tools/xcutils/Makefile tools/xcutils/xc_restore.c tools/xcutils/xc_save.c tools/xenstore/Makefile tools/xenstore/xs_dom0_test.c tools/xenstore/xs_lib.h tools/xentrace/Makefile tools/xentrace/xenctx.c xen/arch/x86/cpu/amd.c xen/arch/x86/mm.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Thu Aug 25 14:16:23 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Thu Aug 25 14:16:38 2005 +0000
     1.3 @@ -19,11 +19,13 @@
     1.4  
     1.5  #include "cpu.h"
     1.6  
     1.7 +#ifndef CONFIG_XEN
     1.8  DEFINE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]);
     1.9  EXPORT_PER_CPU_SYMBOL(cpu_gdt_table);
    1.10  
    1.11  DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
    1.12  EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack);
    1.13 +#endif
    1.14  
    1.15  static int cachesize_override __initdata = -1;
    1.16  static int disable_x86_fxsr __initdata = 0;
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Aug 25 14:16:23 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Aug 25 14:16:38 2005 +0000
     2.3 @@ -131,15 +131,7 @@ static void map_cpu_to_logical_apicid(vo
     2.4   */
     2.5  void __init smp_alloc_memory(void)
     2.6  {
     2.7 -#if 1
     2.8 -	int cpu;
     2.9 -
    2.10 -	for (cpu = 1; cpu < NR_CPUS; cpu++) {
    2.11 -		cpu_gdt_descr[cpu].address = (unsigned long)
    2.12 -			alloc_bootmem_low_pages(PAGE_SIZE);
    2.13 -		/* XXX free unused pages later */
    2.14 -	}
    2.15 -#else
    2.16 +#if 0
    2.17  	trampoline_base = (void *) alloc_bootmem_low_pages(PAGE_SIZE);
    2.18  	/*
    2.19  	 * Has to be in very low memory so we can execute
    2.20 @@ -861,8 +853,8 @@ static int __init do_boot_cpu(int apicid
    2.21  	atomic_set(&init_deasserted, 0);
    2.22  
    2.23  #if 1
    2.24 -	if (cpu_gdt_descr[0].size > PAGE_SIZE)
    2.25 -		BUG();
    2.26 +	cpu_gdt_descr[cpu].address = __get_free_page(GFP_KERNEL);
    2.27 +	BUG_ON(cpu_gdt_descr[0].size > PAGE_SIZE);
    2.28  	cpu_gdt_descr[cpu].size = cpu_gdt_descr[0].size;
    2.29  	printk("GDT: copying %d bytes from %lx to %lx\n",
    2.30  		cpu_gdt_descr[0].size, cpu_gdt_descr[0].address,
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Aug 25 14:16:23 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Aug 25 14:16:38 2005 +0000
     3.3 @@ -871,6 +871,7 @@ fastcall void do_simd_coprocessor_error(
     3.4  	}
     3.5  }
     3.6  
     3.7 +#ifndef CONFIG_XEN
     3.8  fastcall void setup_x86_bogus_stack(unsigned char * stk)
     3.9  {
    3.10  	unsigned long *switch16_ptr, *switch32_ptr;
    3.11 @@ -915,6 +916,7 @@ fastcall unsigned char * fixup_x86_bogus
    3.12  	memcpy(stack32, stack16, len);
    3.13  	return stack32;
    3.14  }
    3.15 +#endif
    3.16  
    3.17  /*
    3.18   *  'math_state_restore()' saves the current math information in the
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/early_printk.c	Thu Aug 25 14:16:23 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/early_printk.c	Thu Aug 25 14:16:38 2005 +0000
     4.3 @@ -6,6 +6,8 @@
     4.4  #include <asm/io.h>
     4.5  #include <asm/processor.h>
     4.6  
     4.7 +#ifndef CONFIG_XEN
     4.8 +
     4.9  /* Simple VGA output */
    4.10  
    4.11  #ifdef __i386__
    4.12 @@ -59,7 +61,6 @@ static struct console early_vga_console 
    4.13  	.index =	-1,
    4.14  };
    4.15  
    4.16 -#ifndef CONFIG_XEN
    4.17  /* Serial functions loosely based on a similar package from Klaus P. Gerlicher */ 
    4.18  
    4.19  static int early_serial_base = 0x3f8;  /* ttyS0 */
    4.20 @@ -148,7 +149,8 @@ static __init void early_serial_init(cha
    4.21  	outb((divisor >> 8) & 0xff, early_serial_base + DLH); 
    4.22  	outb(c & ~DLAB, early_serial_base + LCR);
    4.23  }
    4.24 -#else
    4.25 +
    4.26 +#else /* CONFIG_XEN */
    4.27  
    4.28  static void
    4.29  early_serial_write(struct console *con, const char *s, unsigned count)
    4.30 @@ -167,6 +169,13 @@ early_serial_write(struct console *con, 
    4.31  static __init void early_serial_init(char *s)
    4.32  {
    4.33  }
    4.34 +
    4.35 +/*
    4.36 + * No early VGA console on Xen, as we do not have convenient ISA-space
    4.37 + * mappings. Someone should fix this for domain 0. For now, use fake serial.
    4.38 + */
    4.39 +#define early_vga_console early_serial_console
    4.40 +
    4.41  #endif
    4.42  
    4.43  static struct console early_serial_console = {
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Thu Aug 25 14:16:23 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Thu Aug 25 14:16:38 2005 +0000
     5.3 @@ -206,11 +206,13 @@ ENTRY(cpu_gdt_table)
     5.4  	.quad   0,0,0			/* three TLS descriptors */ 
     5.5  	.quad	0			/* unused now?   __KERNEL16_CS - 16bit PM for S3 wakeup. */
     5.6  
     5.7 -gdt_end:	
     5.8 +gdt_end:
     5.9 +#if 0
    5.10  	/* asm/segment.h:GDT_ENTRIES must match this */	
    5.11  	/* This should be a multiple of the cache line size */
    5.12  	/* GDTs of other CPUs: */	
    5.13  	.fill (GDT_SIZE * NR_CPUS) - (gdt_end - cpu_gdt_table)
    5.14 +#endif
    5.15  
    5.16  .org 0x8000
    5.17  ENTRY(empty_zero_page)
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Thu Aug 25 14:16:23 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Thu Aug 25 14:16:38 2005 +0000
     6.3 @@ -536,48 +536,7 @@ static inline void copy_edd(void)
     6.4  }
     6.5  #endif
     6.6  
     6.7 -#ifdef CONFIG_XEN
     6.8 -#define reserve_ebda_region() void(0)
     6.9 -
    6.10 -static void __init print_memory_map(char *who)
    6.11 -{
    6.12 -        int i;
    6.13 -
    6.14 -        for (i = 0; i < e820.nr_map; i++) {
    6.15 -                early_printk(" %s: %016Lx - %016Lx ", who,
    6.16 -                        e820.map[i].addr,
    6.17 -                        e820.map[i].addr + e820.map[i].size);
    6.18 -                switch (e820.map[i].type) {
    6.19 -                case E820_RAM:  early_printk("(usable)\n");
    6.20 -                                break;
    6.21 -                case E820_RESERVED:
    6.22 -                                early_printk("(reserved)\n");
    6.23 -                                break;
    6.24 -                case E820_ACPI:
    6.25 -                                early_printk("(ACPI data)\n");
    6.26 -                                break;
    6.27 -                case E820_NVS:
    6.28 -                                early_printk("(ACPI NVS)\n");
    6.29 -                                break;
    6.30 -                default:        early_printk("type %u\n", e820.map[i].type);
    6.31 -                                break;
    6.32 -                }
    6.33 -        }
    6.34 -}
    6.35 -
    6.36 -void __init smp_alloc_memory(void)
    6.37 -{
    6.38 -	int cpu;
    6.39 -
    6.40 -	for (cpu = 1; cpu < NR_CPUS; cpu++) {
    6.41 -		cpu_gdt_descr[cpu].address = (unsigned long)
    6.42 -			alloc_bootmem_low_pages(PAGE_SIZE);
    6.43 -		/* XXX free unused pages later */
    6.44 -	}
    6.45 -}
    6.46 -
    6.47 -
    6.48 -#else
    6.49 +#ifndef CONFIG_XEN
    6.50  #define EBDA_ADDR_POINTER 0x40E
    6.51  static void __init reserve_ebda_region(void)
    6.52  {
    6.53 @@ -628,7 +587,6 @@ void __init setup_arch(char **cmdline_p)
    6.54  			     VMASST_TYPE_writable_pagetables);
    6.55  
    6.56          ARCH_SETUP
    6.57 -        print_memory_map(machine_specific_memory_setup());
    6.58  #else
    6.59   	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
    6.60   	drive_info = DRIVE_INFO;
    6.61 @@ -744,9 +702,6 @@ void __init setup_arch(char **cmdline_p)
    6.62  		}
    6.63  	}
    6.64  #endif
    6.65 -#ifdef CONFIG_SMP
    6.66 -	smp_alloc_memory();
    6.67 -#endif
    6.68  #else	/* CONFIG_XEN */
    6.69  #ifdef CONFIG_BLK_DEV_INITRD
    6.70  	if (LOADER_TYPE && INITRD_START) {
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Thu Aug 25 14:16:23 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Thu Aug 25 14:16:38 2005 +0000
     7.3 @@ -286,10 +286,10 @@ void __init cpu_init (void)
     7.4  
     7.5  	memcpy(me->thread.tls_array, cpu_gdt_table[cpu], GDT_ENTRY_TLS_ENTRIES * 8);
     7.6  #else
     7.7 - 	memcpy(me->thread.tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
     7.8 +	memcpy(me->thread.tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
     7.9  	    GDT_ENTRY_TLS_ENTRIES * 8);
    7.10  
    7.11 -    cpu_gdt_init(&cpu_gdt_descr[cpu]);
    7.12 +	cpu_gdt_init(&cpu_gdt_descr[cpu]);
    7.13  #endif
    7.14         
    7.15  	/*
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c	Thu Aug 25 14:16:23 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c	Thu Aug 25 14:16:38 2005 +0000
     8.3 @@ -739,8 +739,8 @@ static int __cpuinit do_boot_cpu(int cpu
     8.4  	atomic_set(&init_deasserted, 0);
     8.5  
     8.6  #ifdef CONFIG_XEN
     8.7 -	if (cpu_gdt_descr[0].size > PAGE_SIZE)
     8.8 -		BUG();
     8.9 +	cpu_gdt_descr[cpu].address = __get_free_page(GFP_KERNEL);
    8.10 +	BUG_ON(cpu_gdt_descr[0].size > PAGE_SIZE);
    8.11  	cpu_gdt_descr[cpu].size = cpu_gdt_descr[0].size;
    8.12  	memcpy((void *)cpu_gdt_descr[cpu].address,
    8.13  		(void *)cpu_gdt_descr[0].address, cpu_gdt_descr[0].size);
    8.14 @@ -798,6 +798,8 @@ static int __cpuinit do_boot_cpu(int cpu
    8.15  	ctxt.ctrlreg[3] = virt_to_mfn(init_level4_pgt) << PAGE_SHIFT;
    8.16  
    8.17  	boot_error = HYPERVISOR_boot_vcpu(cpu, &ctxt);
    8.18 +	if (boot_error)
    8.19 +		printk("boot error: %ld\n", boot_error);
    8.20  
    8.21  	if (!boot_error) {
    8.22  		/*
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Aug 25 14:16:23 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Aug 25 14:16:38 2005 +0000
     9.3 @@ -536,70 +536,38 @@ static void __init find_early_table_spac
     9.4  	    		  round_up(ptes * 8, PAGE_SIZE); 
     9.5  }
     9.6  
     9.7 -static void xen_copy_pt(void)
     9.8 -{
     9.9 -	unsigned long va = __START_KERNEL_map;
    9.10 -	unsigned long addr, *pte_page;
    9.11 -	int i;
    9.12 -	pud_t *pud; pmd_t *pmd; pte_t *pte;
    9.13 -	unsigned long *page = (unsigned long *) init_level4_pgt;
    9.14 -
    9.15 -	addr = (unsigned long) page[pgd_index(va)];
    9.16 -	addr_to_page(addr, page);
    9.17 -
    9.18 -	pud = (pud_t *) &page[pud_index(va)];
    9.19 -	addr = page[pud_index(va)];
    9.20 -	addr_to_page(addr, page);
    9.21 -
    9.22 -	level3_kernel_pgt[pud_index(va)] = 
    9.23 -		__pud(__pa_symbol(level2_kernel_pgt) | _KERNPG_TABLE | _PAGE_USER);
    9.24 -
    9.25 -	for (;;) {
    9.26 -		pmd = (pmd_t *) &page[pmd_index(va)];
    9.27 -		if (pmd_present(*pmd)) {
    9.28 -			level2_kernel_pgt[pmd_index(va)] = *pmd;
    9.29 -			/*
    9.30 -			 * if pmd is valid, check pte.
    9.31 -			 */
    9.32 -			addr = page[pmd_index(va)];
    9.33 -			addr_to_page(addr, pte_page);
    9.34 -			
    9.35 -			for (i = 0; i < PTRS_PER_PTE; i++) {
    9.36 -				pte = (pte_t *) &pte_page[pte_index(va)];
    9.37 -				if (pte_present(*pte))
    9.38 -					va += PAGE_SIZE;
    9.39 -				else
    9.40 -				    break;
    9.41 -			}
    9.42 -
    9.43 -		} else
    9.44 -		    break;
    9.45 -	}
    9.46 -
    9.47 -	init_level4_pgt[pgd_index(__START_KERNEL_map)] = 
    9.48 -		mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
    9.49 -}
    9.50 -
    9.51  void __init xen_init_pt(void)
    9.52  {
    9.53 +	unsigned long addr, *page;
    9.54  	int i;
    9.55  
    9.56  	for (i = 0; i < NR_CPUS; i++)
    9.57  		per_cpu(cur_pgd, i) = init_mm.pgd;
    9.58  
    9.59 -	memcpy((void *)init_level4_pgt, 
    9.60 -	       (void *)xen_start_info.pt_base, PAGE_SIZE);
    9.61 -
    9.62 +	memset((void *)init_level4_pgt,   0, PAGE_SIZE);
    9.63  	memset((void *)level3_kernel_pgt, 0, PAGE_SIZE);
    9.64  	memset((void *)level2_kernel_pgt, 0, PAGE_SIZE);
    9.65  
    9.66 -	xen_copy_pt();
    9.67 +	/* Find the initial pte page that was built for us. */
    9.68 +	page = (unsigned long *)xen_start_info.pt_base;
    9.69 +	addr = page[pgd_index(__START_KERNEL_map)];
    9.70 +	addr_to_page(addr, page);
    9.71 +	addr = page[pud_index(__START_KERNEL_map)];
    9.72 +	addr_to_page(addr, page);
    9.73 +
    9.74 +	/* Construct mapping of initial pte page in our own directories. */
    9.75 +	init_level4_pgt[pgd_index(__START_KERNEL_map)] = 
    9.76 +		mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
    9.77 +	level3_kernel_pgt[pud_index(__START_KERNEL_map)] = 
    9.78 +		__pud(__pa_symbol(level2_kernel_pgt) |
    9.79 +		      _KERNPG_TABLE | _PAGE_USER);
    9.80 +        memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
    9.81  
    9.82  	make_page_readonly(init_level4_pgt);
    9.83 +	make_page_readonly(init_level4_user_pgt);
    9.84  	make_page_readonly(level3_kernel_pgt);
    9.85 +	make_page_readonly(level3_user_pgt);
    9.86  	make_page_readonly(level2_kernel_pgt);
    9.87 -	make_page_readonly(init_level4_user_pgt);
    9.88 -	make_page_readonly(level3_user_pgt); /* for vsyscall stuff */
    9.89  
    9.90  	xen_pgd_pin(__pa_symbol(init_level4_pgt));
    9.91  	xen_pgd_pin(__pa_symbol(init_level4_user_pgt));
    9.92 @@ -609,7 +577,6 @@ void __init xen_init_pt(void)
    9.93  
    9.94  	set_pgd((pgd_t *)(init_level4_user_pgt + 511), 
    9.95  		mk_kernel_pgd(__pa_symbol(level3_user_pgt)));
    9.96 -
    9.97  }
    9.98  
    9.99  /*
   9.100 @@ -617,69 +584,58 @@ void __init xen_init_pt(void)
   9.101   * mapping done by Xen is minimal (e.g. 8MB) and we need to extend the
   9.102   * mapping for early initialization.
   9.103   */
   9.104 -
   9.105 -#define MIN_INIT_SIZE	0x800000
   9.106  static unsigned long current_size, extended_size;
   9.107  
   9.108  void __init extend_init_mapping(void) 
   9.109  {
   9.110  	unsigned long va = __START_KERNEL_map;
   9.111 -	unsigned long addr, *pte_page;
   9.112 -
   9.113 -	unsigned long phys;
   9.114 +	unsigned long phys, addr, *pte_page;
   9.115          pmd_t *pmd;
   9.116  	pte_t *pte, new_pte;
   9.117  	unsigned long *page = (unsigned long *) init_level4_pgt;
   9.118  	int i;
   9.119  
   9.120 -	addr = (unsigned long) page[pgd_index(va)];
   9.121 +	addr = page[pgd_index(va)];
   9.122  	addr_to_page(addr, page);
   9.123 -
   9.124  	addr = page[pud_index(va)];
   9.125  	addr_to_page(addr, page);
   9.126  
   9.127  	for (;;) {
   9.128 -		pmd = (pmd_t *) &page[pmd_index(va)];
   9.129 -		if (pmd_present(*pmd)) {
   9.130 -			/*
   9.131 -			 * if pmd is valid, check pte.
   9.132 -			 */
   9.133 -			addr = page[pmd_index(va)];
   9.134 -			addr_to_page(addr, pte_page);
   9.135 -			
   9.136 -			for (i = 0; i < PTRS_PER_PTE; i++) {
   9.137 -				pte = (pte_t *) &pte_page[pte_index(va)];
   9.138 -				
   9.139 -				if (pte_present(*pte)) {
   9.140 -					va += PAGE_SIZE;
   9.141 -					current_size += PAGE_SIZE;
   9.142 -				} else
   9.143 -				    break;
   9.144 -			}
   9.145 -
   9.146 -		} else
   9.147 -		    break;
   9.148 +		pmd = (pmd_t *)&page[pmd_index(va)];
   9.149 +		if (!pmd_present(*pmd))
   9.150 +			break;
   9.151 +		addr = page[pmd_index(va)];
   9.152 +		addr_to_page(addr, pte_page);
   9.153 +		for (i = 0; i < PTRS_PER_PTE; i++) {
   9.154 +			pte = (pte_t *) &pte_page[pte_index(va)];
   9.155 +			if (!pte_present(*pte))
   9.156 +				break;
   9.157 +			va += PAGE_SIZE;
   9.158 +			current_size += PAGE_SIZE;
   9.159 +		}
   9.160  	}
   9.161  
   9.162 -	for (; va < __START_KERNEL_map + current_size + tables_space; ) {
   9.163 +	while (va < __START_KERNEL_map + current_size + tables_space) {
   9.164  		pmd = (pmd_t *) &page[pmd_index(va)];
   9.165 -
   9.166 -		if (pmd_none(*pmd)) {
   9.167 -			pte_page = (unsigned long *) alloc_static_page(&phys);
   9.168 -			make_page_readonly(pte_page);
   9.169 -			xen_pte_pin(phys);
   9.170 -			set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
   9.171 +		if (!pmd_none(*pmd))
   9.172 +			continue;
   9.173 +		pte_page = (unsigned long *) alloc_static_page(&phys);
   9.174 +		make_page_readonly(pte_page);
   9.175 +		xen_pte_pin(phys);
   9.176 +		set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
   9.177 +		for (i = 0; i < PTRS_PER_PTE; i++, va += PAGE_SIZE) {
   9.178 +			new_pte = pfn_pte(
   9.179 +				(va - __START_KERNEL_map) >> PAGE_SHIFT, 
   9.180 +				__pgprot(_KERNPG_TABLE | _PAGE_USER));
   9.181 +			pte = (pte_t *)&pte_page[pte_index(va)];
   9.182 +			xen_l1_entry_update(pte, new_pte);
   9.183 +			extended_size += PAGE_SIZE;
   9.184 +		}
   9.185 +	}
   9.186  
   9.187 -			for (i = 0; i < PTRS_PER_PTE; i++, va += PAGE_SIZE) {
   9.188 -				new_pte = pfn_pte((va -  __START_KERNEL_map) >> PAGE_SHIFT, 
   9.189 -						  __pgprot(_KERNPG_TABLE | _PAGE_USER));
   9.190 -
   9.191 -				pte = (pte_t *) &pte_page[pte_index(va)];
   9.192 -				xen_l1_entry_update(pte, new_pte);
   9.193 -				extended_size += PAGE_SIZE;
   9.194 -			}
   9.195 -		} 
   9.196 -	}
   9.197 +	/* Kill mapping of low 1MB. */
   9.198 +	for (va = __START_KERNEL_map; va < (unsigned long)&_text; va += PAGE_SIZE)
   9.199 +		HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
   9.200  }
   9.201  
   9.202  
   9.203 @@ -720,10 +676,6 @@ void __init init_memory_mapping(unsigned
   9.204  
   9.205          start_pfn = ((current_size + extended_size) >> PAGE_SHIFT);
   9.206  
   9.207 -        /*
   9.208 -         * TBD: Need to calculate at runtime
   9.209 -         */
   9.210 -
   9.211  	__flush_tlb_all();
   9.212          init_mapping_done = 1;
   9.213  }
    10.1 --- a/tools/libxc/Makefile	Thu Aug 25 14:16:23 2005 +0000
    10.2 +++ b/tools/libxc/Makefile	Thu Aug 25 14:16:38 2005 +0000
    10.3 @@ -92,7 +92,7 @@ install: build
    10.4  	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
    10.5  	ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
    10.6  	ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
    10.7 -	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen
    10.8 +	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include
    10.9  
   10.10  	$(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   10.11  	$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)