Index: xen-ia64-unstable-14854.hg/xen/arch/ia64/linux-xen/efi.c
===================================================================
--- xen-ia64-unstable-14854.hg.orig/xen/arch/ia64/linux-xen/efi.c	2007-04-24 13:20:38.000000000 +0900
+++ xen-ia64-unstable-14854.hg/xen/arch/ia64/linux-xen/efi.c	2007-04-24 14:05:20.000000000 +0900
@@ -34,7 +34,7 @@
 
 #include <linux/efi.h>
 
-#define EFI_DEBUG	0
+#define EFI_DEBUG	1
 
 extern efi_status_t efi_call_phys (void *, ...);
 extern unsigned long long memparse (char *ptr, char **retptr);
@@ -594,14 +594,27 @@ efi_enter_virtual_mode (void)
 		}
 	}
 
-	status = efi_call_phys(__va(runtime->set_virtual_address_map),
-			       ia64_boot_param->efi_memmap_size,
-			       efi_desc_size, ia64_boot_param->efi_memdesc_version,
-			       ia64_boot_param->efi_memmap);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "warning: unable to switch EFI into virtual mode "
-		       "(status=%lu)\n", status);
-		return;
+	if ((unsigned long)__va(runtime->set_virtual_address_map) ==
+	    runtime->set_virtual_address_map) {
+		printk(KERN_WARNING "warning: EFI is already mapped "
+		       "in the right place\n");
+	}
+	else if (runtime->set_virtual_address_map & (0xfUL << 60)) {
+		printk(KERN_WARNING "warning: EFI is already mapped "
+		       "in the wrong place\n");
+	 	return;
+	}
+	else {
+		status = efi_call_phys(__va(runtime->set_virtual_address_map),
+				       ia64_boot_param->efi_memmap_size,
+				       efi_desc_size,
+				       ia64_boot_param->efi_memdesc_version,
+				       ia64_boot_param->efi_memmap);
+		if (status != EFI_SUCCESS) {
+			printk(KERN_WARNING "warning: unable to switch EFI "
+			       "into virtual mode (status=%lu)\n", status);
+			return;
+		}
 	}
 
 	/*
Index: xen-ia64-unstable-14854.hg/xen/arch/ia64/xen/machine_kexec.c
===================================================================
--- xen-ia64-unstable-14854.hg.orig/xen/arch/ia64/xen/machine_kexec.c	2007-04-24 13:20:38.000000000 +0900
+++ xen-ia64-unstable-14854.hg/xen/arch/ia64/xen/machine_kexec.c	2007-04-24 13:22:38.000000000 +0900
@@ -44,27 +44,6 @@ void machine_kexec_unload(int type, int 
 {
 }
 
-/*
- * boot_param is used inside purgatory and purgatory runs
- * in physical mode, so translate the addresses that purgatory
- * accesses from virtual to physical.
- */
-static unsigned long machine_kexec_prepare_boot_param (void)
-{
-	efi_system_table_t *systab;
-
-	systab = (efi_system_table_t *)__va(ia64_boot_param->efi_systab);
-
-	if ((unsigned long)systab->runtime > PAGE_OFFSET) {
-		systab->runtime->set_virtual_address_map =
-				__pa(systab->runtime->set_virtual_address_map);
-		systab->runtime = (efi_runtime_services_t *)
-				__pa(systab->runtime);
-	}
-
-	return __pa(ia64_boot_param);
-}
-
 static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
 {
     xen_kexec_image_t *image = arg;
@@ -102,7 +81,7 @@ static void ia64_machine_kexec(struct un
     platform_kernel_launch_event();
     rnk = (relocate_new_kernel_t)&code_addr;
     (*rnk)(image->indirection_page, image->start_address,
-    	   machine_kexec_prepare_boot_param(),
+    	   ia64_boot_param,
            GRANULEROUNDDOWN((unsigned long) pal_vaddr), cpu_data_pa,
 	   KERNEL_START, PAGE_OFFSET);
     BUG();
