kexec-tools: Use EFI_LOADER_DATA for ELF core header (ia64)

The address where the ELF core header is stored is passed to the secondary 
kernel as a kernel command line option. The memory area for this header is 
also marked as a separate EFI memory descriptor on ia64.

The separate EFI memory descriptor is at the moment of the type
EFI_UNUSABLE_MEMORY. With such a type the secondary kernel skips over the
entire memory granule (config option, 16M or 64M) when detecting memory. 
If we are lucky we will just lose some memory, but if we happen to have data
in the same granule (such as an initramfs image), then this data will never
get mapped and the kernel bombs out when trying to access it.

So this is an attempt to fix this by changing the EFI memory descriptor
type into EFI_LOADER_DATA. This type is the same type used for the kernel 
data and for initramfs. In the secondary kernel we then handle the ELF core 
header data the same way as we handle the initramfs image.

This strategy requires changes in the secondary kernel as well, I'll
post the kernel patches in a little while.

Signed-off-by: Magnus Damm <[EMAIL PROTECTED]>
---

 Applies to kexec-tools-testing 40f4b56e54c3e42ef32189682a85bcdc1bf240f1.

 kexec/arch/ia64/crashdump-ia64.c     |    3 ---
 purgatory/arch/ia64/purgatory-ia64.c |    4 +---
 2 files changed, 1 insertion(+), 6 deletions(-)

--- 0001/kexec/arch/ia64/crashdump-ia64.c
+++ work/kexec/arch/ia64/crashdump-ia64.c       2007-02-15 21:08:40.000000000 
+0900
@@ -55,7 +55,6 @@ static unsigned long kernel_code_end;
 struct loaded_segment {
         unsigned long start;
         unsigned long end;
-       unsigned long reserved;
 };
 
 #define MAX_LOAD_SEGMENTS      128
@@ -90,7 +89,6 @@ static void add_loaded_segments_info(str
                         start&~(ELF_PAGE_SIZE-1);
                 loaded_segments[loaded_segments_num].end =
                         (end + ELF_PAGE_SIZE - 1)&~(ELF_PAGE_SIZE - 1);
-               loaded_segments[loaded_segments_num].reserved = 0;
                loaded_segments_num++;
        }
 }
@@ -243,7 +241,6 @@ int load_crashdump_segments(struct kexec
                        loaded_segments[loaded_segments_num].start = elfcorehdr;
                        loaded_segments[loaded_segments_num].end = elfcorehdr +
                                                                   sz;
-                       loaded_segments[loaded_segments_num].reserved = 1;
                        loaded_segments_num++;
                        cmdline_add_elfcorehdr(cmdline, elfcorehdr);
                }
--- 0001/purgatory/arch/ia64/purgatory-ia64.c
+++ work/purgatory/arch/ia64/purgatory-ia64.c   2007-02-15 21:09:14.000000000 
+0900
@@ -123,7 +123,6 @@ typedef struct {
 struct loaded_segment {
         unsigned long start;
         unsigned long end;
-        unsigned long reserved;
 };
 
 struct kexec_boot_params {
@@ -202,8 +201,7 @@ patch_efi_memmap(struct kexec_boot_param
                        }
                        dst_md->phys_addr = seg->start;
                        dst_md->num_pages = mid_pages;
-                       dst_md->type = seg->reserved ?
-                               EFI_UNUSABLE_MEMORY:EFI_LOADER_DATA;
+                       dst_md->type = EFI_LOADER_DATA;
                        if (!end_pages)
                                break;
                        dest += boot_param->efi_memdesc_size;
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to