Ignore:
File:
1 edited

Legend:

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

    rae8d7b0 ra35b458  
    4848{
    4949        version_print();
    50        
     50
    5151        bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH;
    5252        bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH;
    53        
     53
    5454        bootinfo.ucbinfo.tohost =
    5555            (volatile uint64_t *) PA2KA((uintptr_t) &tohost);
    5656        bootinfo.ucbinfo.fromhost =
    5757            (volatile uint64_t *) PA2KA((uintptr_t) &fromhost);
    58        
     58
    5959        // FIXME TODO: read from device tree
    6060        bootinfo.physmem_start = PHYSMEM_START;
     
    6363        bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START;
    6464        bootinfo.memmap.zones[0].size = PHYSMEM_SIZE;
    65        
     65
    6666        printf("\nMemory statistics (total %lu MB, starting at %p)\n\n",
    6767            bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
    6868        printf(" %p: boot info structure\n", &bootinfo);
    69        
     69
    7070        uintptr_t top = BOOT_OFFSET;
    71        
     71
    7272        for (size_t i = 0; i < COMPONENTS; i++) {
    7373                printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr,
    7474                    components[i].name, components[i].inflated,
    7575                    components[i].size);
    76                
     76
    7777                uintptr_t tail = (uintptr_t) components[i].addr +
    7878                    components[i].size;
     
    8383                }
    8484        }
    85        
     85
    8686        printf(" %p: inflate area\n", (void *) top);
    87        
     87
    8888        void *kernel_entry = NULL;
    8989        void *dest[COMPONENTS];
    9090        size_t cnt = 0;
    9191        bootinfo.taskmap.cnt = 0;
    92        
     92
    9393        for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    9494                top = ALIGN_UP(top, PAGE_SIZE);
    95                
     95
    9696                if (i > 0) {
    9797                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    9999                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    100100                            components[i].inflated;
    101                        
     101
    102102                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    103103                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    104                        
     104
    105105                        bootinfo.taskmap.cnt++;
    106106                } else
    107107                        kernel_entry = (void *) PA2KA(top);
    108                
     108
    109109                dest[i] = (void *) top;
    110110                top += components[i].inflated;
    111111                cnt++;
    112112        }
    113        
     113
    114114        printf(" %p: kernel entry point\n", kernel_entry);
    115        
     115
    116116        if (top >= bootinfo.physmem_start + bootinfo.memmap.total) {
    117117                printf("Not enough physical memory available.\n");
     
    119119                halt();
    120120        }
    121        
     121
    122122        printf("\nInflating components ... ");
    123        
     123
    124124        for (size_t i = cnt; i > 0; i--) {
    125125                printf("%s ", components[i - 1].name);
    126                
     126
    127127                int err = inflate(components[i - 1].addr, components[i - 1].size,
    128128                    dest[i - 1], components[i - 1].inflated);
    129                
     129
    130130                if (err != EOK) {
    131131                        printf("\n%s: Inflating error %d, halting.\n",
     
    134134                }
    135135        }
    136        
     136
    137137        printf(".\n");
    138        
     138
    139139        printf("Booting the kernel...\n");
    140140        jump_to_kernel(PA2KA(&bootinfo));
Note: See TracChangeset for help on using the changeset viewer.