Ignore:
File:
1 edited

Legend:

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

    r4646710 ra35b458  
    6060        version_print();
    6161        ofw_memmap(&bootinfo.memmap);
    62        
     62
    6363        void *bootinfo_pa = ofw_translate(&bootinfo);
    6464        void *real_mode_pa = ofw_translate(&real_mode);
    6565        void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
    66        
     66
    6767        printf("\nMemory statistics (total %llu MB)\n", bootinfo.memmap.total >> 20);
    6868        printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa);
     
    7272        printf(" %p|%p: loader entry point\n",
    7373            (void *) LOADER_ADDRESS, loader_address_pa);
    74        
     74
    7575        size_t i;
    7676        for (i = 0; i < COMPONENTS; i++)
     
    7878                    ofw_translate(components[i].addr), components[i].name,
    7979                    components[i].inflated, components[i].size);
    80        
     80
    8181        size_t dest[COMPONENTS];
    8282        size_t top = 0;
     
    8585        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    8686                top = ALIGN_UP(top, PAGE_SIZE);
    87                
     87
    8888                if (i > 0) {
    8989                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    9191                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    9292                            components[i].inflated;
    93                        
     93
    9494                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    9595                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    96                        
     96
    9797                        bootinfo.taskmap.cnt++;
    9898                }
    99                
     99
    100100                dest[i] = top;
    101101                top += components[i].inflated;
    102102                cnt++;
    103103        }
    104        
     104
    105105        if (top >= (size_t) loader_address_pa) {
    106106                printf("Inflated components overlap loader area.\n");
     
    108108                halt();
    109109        }
    110        
     110
    111111        void *balloc_base;
    112112        void *balloc_base_pa;
     
    114114            BALLOC_MAX_SIZE, loader_address_pa);
    115115        printf(" %p|%p: boot allocator area\n", balloc_base, balloc_base_pa);
    116        
     116
    117117        void *inflate_base;
    118118        void *inflate_base_pa;
     
    120120            loader_address_pa);
    121121        printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa);
    122        
     122
    123123        uintptr_t balloc_start = ALIGN_UP(top, PAGE_SIZE);
    124124        size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE))
     
    129129            pages * sizeof(void *), loader_address_pa);
    130130        printf(" %p|%p: translate table\n", transtable, transtable_pa);
    131        
     131
    132132        check_overlap("boot allocator area", balloc_base_pa, pages);
    133133        check_overlap("inflate area", inflate_base_pa, pages);
    134134        check_overlap("translate table", transtable_pa, pages);
    135        
     135
    136136        printf("\nInflating components ... ");
    137        
     137
    138138        for (i = cnt; i > 0; i--) {
    139139                printf("%s ", components[i - 1].name);
    140                
     140
    141141                int err = inflate(components[i - 1].addr, components[i - 1].size,
    142142                    inflate_base + dest[i - 1], components[i - 1].inflated);
    143                
     143
    144144                if (err != EOK) {
    145145                        printf("\n%s: Inflating error %d, halting.\n",
     
    148148                }
    149149        }
    150        
     150
    151151        printf(".\n");
    152        
     152
    153153        printf("Setting up boot allocator ...\n");
    154154        balloc_init(&bootinfo.ballocs, balloc_base, PA2KA(balloc_start),
    155155            BALLOC_MAX_SIZE);
    156        
     156
    157157        printf("Setting up screens ...\n");
    158158        ofw_setup_screens();
    159        
     159
    160160        printf("Canonizing OpenFirmware device tree ...\n");
    161161        bootinfo.ofw_root = ofw_tree_build();
    162        
     162
    163163        printf("Setting up translate table ...\n");
    164164        for (i = 0; i < pages; i++) {
    165165                uintptr_t off = i << PAGE_WIDTH;
    166166                void *phys;
    167                
     167
    168168                if (off < balloc_start)
    169169                        phys = ofw_translate(inflate_base + off);
    170170                else
    171171                        phys = ofw_translate(balloc_base + off - balloc_start);
    172                
     172
    173173                ((void **) transtable)[i] = phys;
    174174        }
    175        
     175
    176176        printf("Booting the kernel...\n");
    177177        jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa);
Note: See TracChangeset for help on using the changeset viewer.