Subversion Repositories HelenOS

Rev

Rev 2071 | Rev 3388 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2071 Rev 2250
Line 90... Line 90...
90
    printf(" %P: boot info structure\n", &bootinfo);
90
    printf(" %P: boot info structure\n", &bootinfo);
91
   
91
   
92
    unsigned int i;
92
    unsigned int i;
93
    for (i = 0; i < COMPONENTS; i++)
93
    for (i = 0; i < COMPONENTS; i++)
94
        printf(" %P: %s image (size %d bytes)\n", components[i].start,
94
        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);
96
 
96
 
97
    void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
97
    void * base = (void *) KERNEL_VIRTUAL_ADDRESS;
98
    unsigned int top = 0;
98
    unsigned int top = 0;
99
 
99
 
100
    printf("\nCopying components\n");
100
    printf("\nCopying components\n");
101
    bootinfo.taskmap.count = 0;
101
    bootinfo.taskmap.count = 0;
102
    for (i = 0; i < COMPONENTS; i++) {
102
    for (i = 0; i < COMPONENTS; i++) {
103
        printf(" %s...", components[i].name);
103
        printf(" %s...", components[i].name);
104
        top = ALIGN_UP(top, PAGE_SIZE);
104
        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
           
105
        memcpy(base + top, components[i].start, components[i].size);
117
        memcpy(base + top, components[i].start, components[i].size);
106
        if (i > 0) {
118
        if (i > 0) {
107
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = base + top;
119
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
-
 
120
                base + top;
108
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size;
121
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
-
 
122
                components[i].size;
109
            bootinfo.taskmap.count++;
123
            bootinfo.taskmap.count++;
110
        }
124
        }
111
        top += components[i].size;
125
        top += components[i].size;
112
        printf("done.\n");
126
        printf("done.\n");
113
    }
127
    }
114
 
128
 
-
 
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);
115
    balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top, PAGE_SIZE));
135
    balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top,
-
 
136
        PAGE_SIZE));
116
 
137
 
117
    printf("\nCanonizing OpenFirmware device tree...");
138
    printf("\nCanonizing OpenFirmware device tree...");
118
    bootinfo.ofw_root = ofw_tree_build();
139
    bootinfo.ofw_root = ofw_tree_build();
119
    printf("done.\n");
140
    printf("done.\n");
120
 
141
 
Line 125... Line 146...
125
    printf("done.\n");
146
    printf("done.\n");
126
#endif
147
#endif
127
 
148
 
128
    printf("\nBooting the kernel...\n");
149
    printf("\nBooting the kernel...\n");
129
    jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
150
    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));
131
}
153
}
-
 
154