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
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Thu Aug 25 14:16:23 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Thu Aug 25 14:16:38 2005 +0000
     3.3 @@ -19,11 +19,13 @@
     3.4  
     3.5  #include "cpu.h"
     3.6  
     3.7 +#ifndef CONFIG_XEN
     3.8  DEFINE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]);
     3.9  EXPORT_PER_CPU_SYMBOL(cpu_gdt_table);
    3.10  
    3.11  DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
    3.12  EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack);
    3.13 +#endif
    3.14  
    3.15  static int cachesize_override __initdata = -1;
    3.16  static int disable_x86_fxsr __initdata = 0;
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Aug 25 14:16:23 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Aug 25 14:16:38 2005 +0000
     4.3 @@ -131,15 +131,7 @@ static void map_cpu_to_logical_apicid(vo
     4.4   */
     4.5  void __init smp_alloc_memory(void)
     4.6  {
     4.7 -#if 1
     4.8 -	int cpu;
     4.9 -
    4.10 -	for (cpu = 1; cpu < NR_CPUS; cpu++) {
    4.11 -		cpu_gdt_descr[cpu].address = (unsigned long)
    4.12 -			alloc_bootmem_low_pages(PAGE_SIZE);
    4.13 -		/* XXX free unused pages later */
    4.14 -	}
    4.15 -#else
    4.16 +#if 0
    4.17  	trampoline_base = (void *) alloc_bootmem_low_pages(PAGE_SIZE);
    4.18  	/*
    4.19  	 * Has to be in very low memory so we can execute
    4.20 @@ -861,8 +853,8 @@ static int __init do_boot_cpu(int apicid
    4.21  	atomic_set(&init_deasserted, 0);
    4.22  
    4.23  #if 1
    4.24 -	if (cpu_gdt_descr[0].size > PAGE_SIZE)
    4.25 -		BUG();
    4.26 +	cpu_gdt_descr[cpu].address = __get_free_page(GFP_KERNEL);
    4.27 +	BUG_ON(cpu_gdt_descr[0].size > PAGE_SIZE);
    4.28  	cpu_gdt_descr[cpu].size = cpu_gdt_descr[0].size;
    4.29  	printk("GDT: copying %d bytes from %lx to %lx\n",
    4.30  		cpu_gdt_descr[0].size, cpu_gdt_descr[0].address,
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Aug 25 14:16:23 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Aug 25 14:16:38 2005 +0000
     5.3 @@ -871,6 +871,7 @@ fastcall void do_simd_coprocessor_error(
     5.4  	}
     5.5  }
     5.6  
     5.7 +#ifndef CONFIG_XEN
     5.8  fastcall void setup_x86_bogus_stack(unsigned char * stk)
     5.9  {
    5.10  	unsigned long *switch16_ptr, *switch32_ptr;
    5.11 @@ -915,6 +916,7 @@ fastcall unsigned char * fixup_x86_bogus
    5.12  	memcpy(stack32, stack16, len);
    5.13  	return stack32;
    5.14  }
    5.15 +#endif
    5.16  
    5.17  /*
    5.18   *  'math_state_restore()' saves the current math information in the
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/early_printk.c	Thu Aug 25 14:16:23 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/early_printk.c	Thu Aug 25 14:16:38 2005 +0000
     8.3 @@ -6,6 +6,8 @@
     8.4  #include <asm/io.h>
     8.5  #include <asm/processor.h>
     8.6  
     8.7 +#ifndef CONFIG_XEN
     8.8 +
     8.9  /* Simple VGA output */
    8.10  
    8.11  #ifdef __i386__
    8.12 @@ -59,7 +61,6 @@ static struct console early_vga_console 
    8.13  	.index =	-1,
    8.14  };
    8.15  
    8.16 -#ifndef CONFIG_XEN
    8.17  /* Serial functions loosely based on a similar package from Klaus P. Gerlicher */ 
    8.18  
    8.19  static int early_serial_base = 0x3f8;  /* ttyS0 */
    8.20 @@ -148,7 +149,8 @@ static __init void early_serial_init(cha
    8.21  	outb((divisor >> 8) & 0xff, early_serial_base + DLH); 
    8.22  	outb(c & ~DLAB, early_serial_base + LCR);
    8.23  }
    8.24 -#else
    8.25 +
    8.26 +#else /* CONFIG_XEN */
    8.27  
    8.28  static void
    8.29  early_serial_write(struct console *con, const char *s, unsigned count)
    8.30 @@ -167,6 +169,13 @@ early_serial_write(struct console *con, 
    8.31  static __init void early_serial_init(char *s)
    8.32  {
    8.33  }
    8.34 +
    8.35 +/*
    8.36 + * No early VGA console on Xen, as we do not have convenient ISA-space
    8.37 + * mappings. Someone should fix this for domain 0. For now, use fake serial.
    8.38 + */
    8.39 +#define early_vga_console early_serial_console
    8.40 +
    8.41  #endif
    8.42  
    8.43  static struct console early_serial_console = {
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Thu Aug 25 14:16:23 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S	Thu Aug 25 14:16:38 2005 +0000
     9.3 @@ -206,11 +206,13 @@ ENTRY(cpu_gdt_table)
     9.4  	.quad   0,0,0			/* three TLS descriptors */ 
     9.5  	.quad	0			/* unused now?   __KERNEL16_CS - 16bit PM for S3 wakeup. */
     9.6  
     9.7 -gdt_end:	
     9.8 +gdt_end:
     9.9 +#if 0
    9.10  	/* asm/segment.h:GDT_ENTRIES must match this */	
    9.11  	/* This should be a multiple of the cache line size */
    9.12  	/* GDTs of other CPUs: */	
    9.13  	.fill (GDT_SIZE * NR_CPUS) - (gdt_end - cpu_gdt_table)
    9.14 +#endif
    9.15  
    9.16  .org 0x8000
    9.17  ENTRY(empty_zero_page)
    11.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Thu Aug 25 14:16:23 2005 +0000
    11.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Thu Aug 25 14:16:38 2005 +0000
    11.3 @@ -536,48 +536,7 @@ static inline void copy_edd(void)
    11.4  }
    11.5  #endif
    11.6  
    11.7 -#ifdef CONFIG_XEN
    11.8 -#define reserve_ebda_region() void(0)
    11.9 -
   11.10 -static void __init print_memory_map(char *who)
   11.11 -{
   11.12 -        int i;
   11.13 -
   11.14 -        for (i = 0; i < e820.nr_map; i++) {
   11.15 -                early_printk(" %s: %016Lx - %016Lx ", who,
   11.16 -                        e820.map[i].addr,
   11.17 -                        e820.map[i].addr + e820.map[i].size);
   11.18 -                switch (e820.map[i].type) {
   11.19 -                case E820_RAM:  early_printk("(usable)\n");
   11.20 -                                break;
   11.21 -                case E820_RESERVED:
   11.22 -                                early_printk("(reserved)\n");
   11.23 -                                break;
   11.24 -                case E820_ACPI:
   11.25 -                                early_printk("(ACPI data)\n");
   11.26 -                                break;
   11.27 -                case E820_NVS:
   11.28 -                                early_printk("(ACPI NVS)\n");
   11.29 -                                break;
   11.30 -                default:        early_printk("type %u\n", e820.map[i].type);
   11.31 -                                break;
   11.32 -                }
   11.33 -        }
   11.34 -}
   11.35 -
   11.36 -void __init smp_alloc_memory(void)
   11.37 -{
   11.38 -	int cpu;
   11.39 -
   11.40 -	for (cpu = 1; cpu < NR_CPUS; cpu++) {
   11.41 -		cpu_gdt_descr[cpu].address = (unsigned long)
   11.42 -			alloc_bootmem_low_pages(PAGE_SIZE);
   11.43 -		/* XXX free unused pages later */
   11.44 -	}
   11.45 -}
   11.46 -
   11.47 -
   11.48 -#else
   11.49 +#ifndef CONFIG_XEN
   11.50  #define EBDA_ADDR_POINTER 0x40E
   11.51  static void __init reserve_ebda_region(void)
   11.52  {
   11.53 @@ -628,7 +587,6 @@ void __init setup_arch(char **cmdline_p)
   11.54  			     VMASST_TYPE_writable_pagetables);
   11.55  
   11.56          ARCH_SETUP
   11.57 -        print_memory_map(machine_specific_memory_setup());
   11.58  #else
   11.59   	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
   11.60   	drive_info = DRIVE_INFO;
   11.61 @@ -744,9 +702,6 @@ void __init setup_arch(char **cmdline_p)
   11.62  		}
   11.63  	}
   11.64  #endif
   11.65 -#ifdef CONFIG_SMP
   11.66 -	smp_alloc_memory();
   11.67 -#endif
   11.68  #else	/* CONFIG_XEN */
   11.69  #ifdef CONFIG_BLK_DEV_INITRD
   11.70  	if (LOADER_TYPE && INITRD_START) {
    12.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Thu Aug 25 14:16:23 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Thu Aug 25 14:16:38 2005 +0000
    12.3 @@ -286,10 +286,10 @@ void __init cpu_init (void)
    12.4  
    12.5  	memcpy(me->thread.tls_array, cpu_gdt_table[cpu], GDT_ENTRY_TLS_ENTRIES * 8);
    12.6  #else
    12.7 - 	memcpy(me->thread.tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
    12.8 +	memcpy(me->thread.tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
    12.9  	    GDT_ENTRY_TLS_ENTRIES * 8);
   12.10  
   12.11 -    cpu_gdt_init(&cpu_gdt_descr[cpu]);
   12.12 +	cpu_gdt_init(&cpu_gdt_descr[cpu]);
   12.13  #endif
   12.14         
   12.15  	/*
    13.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c	Thu Aug 25 14:16:23 2005 +0000
    13.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c	Thu Aug 25 14:16:38 2005 +0000
    13.3 @@ -739,8 +739,8 @@ static int __cpuinit do_boot_cpu(int cpu
    13.4  	atomic_set(&init_deasserted, 0);
    13.5  
    13.6  #ifdef CONFIG_XEN
    13.7 -	if (cpu_gdt_descr[0].size > PAGE_SIZE)
    13.8 -		BUG();
    13.9 +	cpu_gdt_descr[cpu].address = __get_free_page(GFP_KERNEL);
   13.10 +	BUG_ON(cpu_gdt_descr[0].size > PAGE_SIZE);
   13.11  	cpu_gdt_descr[cpu].size = cpu_gdt_descr[0].size;
   13.12  	memcpy((void *)cpu_gdt_descr[cpu].address,
   13.13  		(void *)cpu_gdt_descr[0].address, cpu_gdt_descr[0].size);
   13.14 @@ -798,6 +798,8 @@ static int __cpuinit do_boot_cpu(int cpu
   13.15  	ctxt.ctrlreg[3] = virt_to_mfn(init_level4_pgt) << PAGE_SHIFT;
   13.16  
   13.17  	boot_error = HYPERVISOR_boot_vcpu(cpu, &ctxt);
   13.18 +	if (boot_error)
   13.19 +		printk("boot error: %ld\n", boot_error);
   13.20  
   13.21  	if (!boot_error) {
   13.22  		/*
    14.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Aug 25 14:16:23 2005 +0000
    14.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Thu Aug 25 14:16:38 2005 +0000
    14.3 @@ -536,70 +536,38 @@ static void __init find_early_table_spac
    14.4  	    		  round_up(ptes * 8, PAGE_SIZE); 
    14.5  }
    14.6  
    14.7 -static void xen_copy_pt(void)
    14.8 -{
    14.9 -	unsigned long va = __START_KERNEL_map;
   14.10 -	unsigned long addr, *pte_page;
   14.11 -	int i;
   14.12 -	pud_t *pud; pmd_t *pmd; pte_t *pte;
   14.13 -	unsigned long *page = (unsigned long *) init_level4_pgt;
   14.14 -
   14.15 -	addr = (unsigned long) page[pgd_index(va)];
   14.16 -	addr_to_page(addr, page);
   14.17 -
   14.18 -	pud = (pud_t *) &page[pud_index(va)];
   14.19 -	addr = page[pud_index(va)];
   14.20 -	addr_to_page(addr, page);
   14.21 -
   14.22 -	level3_kernel_pgt[pud_index(va)] = 
   14.23 -		__pud(__pa_symbol(level2_kernel_pgt) | _KERNPG_TABLE | _PAGE_USER);
   14.24 -
   14.25 -	for (;;) {
   14.26 -		pmd = (pmd_t *) &page[pmd_index(va)];
   14.27 -		if (pmd_present(*pmd)) {
   14.28 -			level2_kernel_pgt[pmd_index(va)] = *pmd;
   14.29 -			/*
   14.30 -			 * if pmd is valid, check pte.
   14.31 -			 */
   14.32 -			addr = page[pmd_index(va)];
   14.33 -			addr_to_page(addr, pte_page);
   14.34 -			
   14.35 -			for (i = 0; i < PTRS_PER_PTE; i++) {
   14.36 -				pte = (pte_t *) &pte_page[pte_index(va)];
   14.37 -				if (pte_present(*pte))
   14.38 -					va += PAGE_SIZE;
   14.39 -				else
   14.40 -				    break;
   14.41 -			}
   14.42 -
   14.43 -		} else
   14.44 -		    break;
   14.45 -	}
   14.46 -
   14.47 -	init_level4_pgt[pgd_index(__START_KERNEL_map)] = 
   14.48 -		mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
   14.49 -}
   14.50 -
   14.51  void __init xen_init_pt(void)
   14.52  {
   14.53 +	unsigned long addr, *page;
   14.54  	int i;
   14.55  
   14.56  	for (i = 0; i < NR_CPUS; i++)
   14.57  		per_cpu(cur_pgd, i) = init_mm.pgd;
   14.58  
   14.59 -	memcpy((void *)init_level4_pgt, 
   14.60 -	       (void *)xen_start_info.pt_base, PAGE_SIZE);
   14.61 -
   14.62 +	memset((void *)init_level4_pgt,   0, PAGE_SIZE);
   14.63  	memset((void *)level3_kernel_pgt, 0, PAGE_SIZE);
   14.64  	memset((void *)level2_kernel_pgt, 0, PAGE_SIZE);
   14.65  
   14.66 -	xen_copy_pt();
   14.67 +	/* Find the initial pte page that was built for us. */
   14.68 +	page = (unsigned long *)xen_start_info.pt_base;
   14.69 +	addr = page[pgd_index(__START_KERNEL_map)];
   14.70 +	addr_to_page(addr, page);
   14.71 +	addr = page[pud_index(__START_KERNEL_map)];
   14.72 +	addr_to_page(addr, page);
   14.73 +
   14.74 +	/* Construct mapping of initial pte page in our own directories. */
   14.75 +	init_level4_pgt[pgd_index(__START_KERNEL_map)] = 
   14.76 +		mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
   14.77 +	level3_kernel_pgt[pud_index(__START_KERNEL_map)] = 
   14.78 +		__pud(__pa_symbol(level2_kernel_pgt) |
   14.79 +		      _KERNPG_TABLE | _PAGE_USER);
   14.80 +        memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
   14.81  
   14.82  	make_page_readonly(init_level4_pgt);
   14.83 +	make_page_readonly(init_level4_user_pgt);
   14.84  	make_page_readonly(level3_kernel_pgt);
   14.85 +	make_page_readonly(level3_user_pgt);
   14.86  	make_page_readonly(level2_kernel_pgt);
   14.87 -	make_page_readonly(init_level4_user_pgt);
   14.88 -	make_page_readonly(level3_user_pgt); /* for vsyscall stuff */
   14.89  
   14.90  	xen_pgd_pin(__pa_symbol(init_level4_pgt));
   14.91  	xen_pgd_pin(__pa_symbol(init_level4_user_pgt));
   14.92 @@ -609,7 +577,6 @@ void __init xen_init_pt(void)
   14.93  
   14.94  	set_pgd((pgd_t *)(init_level4_user_pgt + 511), 
   14.95  		mk_kernel_pgd(__pa_symbol(level3_user_pgt)));
   14.96 -
   14.97  }
   14.98  
   14.99  /*
  14.100 @@ -617,69 +584,58 @@ void __init xen_init_pt(void)
  14.101   * mapping done by Xen is minimal (e.g. 8MB) and we need to extend the
  14.102   * mapping for early initialization.
  14.103   */
  14.104 -
  14.105 -#define MIN_INIT_SIZE	0x800000
  14.106  static unsigned long current_size, extended_size;
  14.107  
  14.108  void __init extend_init_mapping(void) 
  14.109  {
  14.110  	unsigned long va = __START_KERNEL_map;
  14.111 -	unsigned long addr, *pte_page;
  14.112 -
  14.113 -	unsigned long phys;
  14.114 +	unsigned long phys, addr, *pte_page;
  14.115          pmd_t *pmd;
  14.116  	pte_t *pte, new_pte;
  14.117  	unsigned long *page = (unsigned long *) init_level4_pgt;
  14.118  	int i;
  14.119  
  14.120 -	addr = (unsigned long) page[pgd_index(va)];
  14.121 +	addr = page[pgd_index(va)];
  14.122  	addr_to_page(addr, page);
  14.123 -
  14.124  	addr = page[pud_index(va)];
  14.125  	addr_to_page(addr, page);
  14.126  
  14.127  	for (;;) {
  14.128 -		pmd = (pmd_t *) &page[pmd_index(va)];
  14.129 -		if (pmd_present(*pmd)) {
  14.130 -			/*
  14.131 -			 * if pmd is valid, check pte.
  14.132 -			 */
  14.133 -			addr = page[pmd_index(va)];
  14.134 -			addr_to_page(addr, pte_page);
  14.135 -			
  14.136 -			for (i = 0; i < PTRS_PER_PTE; i++) {
  14.137 -				pte = (pte_t *) &pte_page[pte_index(va)];
  14.138 -				
  14.139 -				if (pte_present(*pte)) {
  14.140 -					va += PAGE_SIZE;
  14.141 -					current_size += PAGE_SIZE;
  14.142 -				} else
  14.143 -				    break;
  14.144 -			}
  14.145 -
  14.146 -		} else
  14.147 -		    break;
  14.148 +		pmd = (pmd_t *)&page[pmd_index(va)];
  14.149 +		if (!pmd_present(*pmd))
  14.150 +			break;
  14.151 +		addr = page[pmd_index(va)];
  14.152 +		addr_to_page(addr, pte_page);
  14.153 +		for (i = 0; i < PTRS_PER_PTE; i++) {
  14.154 +			pte = (pte_t *) &pte_page[pte_index(va)];
  14.155 +			if (!pte_present(*pte))
  14.156 +				break;
  14.157 +			va += PAGE_SIZE;
  14.158 +			current_size += PAGE_SIZE;
  14.159 +		}
  14.160  	}
  14.161  
  14.162 -	for (; va < __START_KERNEL_map + current_size + tables_space; ) {
  14.163 +	while (va < __START_KERNEL_map + current_size + tables_space) {
  14.164  		pmd = (pmd_t *) &page[pmd_index(va)];
  14.165 -
  14.166 -		if (pmd_none(*pmd)) {
  14.167 -			pte_page = (unsigned long *) alloc_static_page(&phys);
  14.168 -			make_page_readonly(pte_page);
  14.169 -			xen_pte_pin(phys);
  14.170 -			set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
  14.171 +		if (!pmd_none(*pmd))
  14.172 +			continue;
  14.173 +		pte_page = (unsigned long *) alloc_static_page(&phys);
  14.174 +		make_page_readonly(pte_page);
  14.175 +		xen_pte_pin(phys);
  14.176 +		set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
  14.177 +		for (i = 0; i < PTRS_PER_PTE; i++, va += PAGE_SIZE) {
  14.178 +			new_pte = pfn_pte(
  14.179 +				(va - __START_KERNEL_map) >> PAGE_SHIFT, 
  14.180 +				__pgprot(_KERNPG_TABLE | _PAGE_USER));
  14.181 +			pte = (pte_t *)&pte_page[pte_index(va)];
  14.182 +			xen_l1_entry_update(pte, new_pte);
  14.183 +			extended_size += PAGE_SIZE;
  14.184 +		}
  14.185 +	}
  14.186  
  14.187 -			for (i = 0; i < PTRS_PER_PTE; i++, va += PAGE_SIZE) {
  14.188 -				new_pte = pfn_pte((va -  __START_KERNEL_map) >> PAGE_SHIFT, 
  14.189 -						  __pgprot(_KERNPG_TABLE | _PAGE_USER));
  14.190 -
  14.191 -				pte = (pte_t *) &pte_page[pte_index(va)];
  14.192 -				xen_l1_entry_update(pte, new_pte);
  14.193 -				extended_size += PAGE_SIZE;
  14.194 -			}
  14.195 -		} 
  14.196 -	}
  14.197 +	/* Kill mapping of low 1MB. */
  14.198 +	for (va = __START_KERNEL_map; va < (unsigned long)&_text; va += PAGE_SIZE)
  14.199 +		HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
  14.200  }
  14.201  
  14.202  
  14.203 @@ -720,10 +676,6 @@ void __init init_memory_mapping(unsigned
  14.204  
  14.205          start_pfn = ((current_size + extended_size) >> PAGE_SHIFT);
  14.206  
  14.207 -        /*
  14.208 -         * TBD: Need to calculate at runtime
  14.209 -         */
  14.210 -
  14.211  	__flush_tlb_all();
  14.212          init_mapping_done = 1;
  14.213  }
    52.1 --- a/tools/libxc/Makefile	Thu Aug 25 14:16:23 2005 +0000
    52.2 +++ b/tools/libxc/Makefile	Thu Aug 25 14:16:38 2005 +0000
    52.3 @@ -92,7 +92,7 @@ install: build
    52.4  	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
    52.5  	ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
    52.6  	ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
    52.7 -	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen
    52.8 +	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include
    52.9  
   52.10  	$(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   52.11  	$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)