Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e8d3165e in mainline


Ignore:
Timestamp:
2019-01-01T21:48:25Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
ca645a2
Parents:
68f1254c
Message:

Treat additional region types as available memory

In order for the ia64 loader to find the memory map area occupied by the
kernel (a.k.a. ram_end), it needs to consider additioanl region types
which also denote available memory (after the call to ExitBootServices?).
These are: EfiLoaderCode?, EfiLoaderData?, EfiBootServicesCode? and
EfiBootServicesData?. Without this the memory map is incomplete and
contains a big hole that covers the entire area of the loaded image. The
loader then cannot find ram_end and the boot fails. The memory map also
needs to be compacted so that adjacent regions of the same type are not
too small for a successful boot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/src/main.c

    r68f1254c re8d3165e  
    9494                    cur += md_size) {
    9595                        efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;
     96                        memmap_item_t *o = NULL;
     97
     98                        if (items)
     99                                o = &memmap[items - 1];
    96100
    97101                        switch ((efi_memory_type_t) md->type) {
     102                        case EFI_LOADER_CODE:
     103                        case EFI_LOADER_DATA:
     104                        case EFI_BOOT_SERVICES_CODE:
     105                        case EFI_BOOT_SERVICES_DATA:
    98106                        case EFI_CONVENTIONAL_MEMORY:
     107                                if (o && o->type == MEMMAP_FREE_MEM &&
     108                                    o->base + o->size == md->phys_start) {
     109                                        o->size += md->pages * EFI_PAGE_SIZE;
     110                                        continue;
     111                                }
    99112                                memmap[items].type = MEMMAP_FREE_MEM;
    100113                                break;
Note: See TracChangeset for help on using the changeset viewer.