Changeset 95b47c82 in mainline for boot/arch/sparc64/loader/main.c


Ignore:
Timestamp:
2007-04-15T20:51:04Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a7a970
Parents:
ddee708
Message:

Fix ticket #31.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/main.c

    rddee708 r95b47c82  
    9393        for (i = 0; i < COMPONENTS; i++)
    9494                printf(" %P: %s image (size %d bytes)\n", components[i].start,
    95                         components[i].name, components[i].size);
     95                    components[i].name, components[i].size);
    9696
    9797        void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
     
    103103                printf(" %s...", components[i].name);
    104104                top = ALIGN_UP(top, PAGE_SIZE);
     105
     106                /*
     107                 * At this point, we claim the physical memory that we are
     108                 * going to use. We should be safe in case of the virtual
     109                 * address space because the OpenFirmware, according to its
     110                 * SPARC binding, should restrict its use of virtual memory
     111                 * to addresses from [0xffd00000; 0xffefffff] and
     112                 * [0xfe000000; 0xfeffffff].
     113                 */
     114                (void) ofw_claim_phys(bootinfo.physmem_start + base + top,
     115                    ALIGN_UP(components[i].size, PAGE_SIZE));
     116                   
    105117                memcpy(base + top, components[i].start, components[i].size);
    106118                if (i > 0) {
    107                         bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = base + top;
    108                         bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size;
     119                        bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
     120                            base + top;
     121                        bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
     122                            components[i].size;
    109123                        bootinfo.taskmap.count++;
    110124                }
     
    113127        }
    114128
    115         balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top, PAGE_SIZE));
     129        /*
     130         * Claim the physical memory for the boot allocator.
     131         * Initialize the boot allocator.
     132         */
     133        (void) ofw_claim_phys(bootinfo.physmem_start +
     134            base + ALIGN_UP(top, PAGE_SIZE), BALLOC_MAX_SIZE);
     135        balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top,
     136            PAGE_SIZE));
    116137
    117138        printf("\nCanonizing OpenFirmware device tree...");
     
    128149        printf("\nBooting the kernel...\n");
    129150        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
    130                 bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo, sizeof(bootinfo));
     151            bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
     152            sizeof(bootinfo));
    131153}
     154
Note: See TracChangeset for help on using the changeset viewer.