Rev 1881 | Rev 1896 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1881 | Rev 1894 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | 28 | ||
29 | #include "main.h" |
29 | #include "main.h" |
30 | #include <printf.h> |
30 | #include <printf.h> |
31 | #include "asm.h" |
31 | #include "asm.h" |
32 | #include "_components.h" |
32 | #include "_components.h" |
- | 33 | #include <balloc.h> |
|
33 | #include <ofw.h> |
34 | #include <ofw.h> |
- | 35 | #include <ofw_tree.h> |
|
34 | #include "ofwarch.h" |
36 | #include "ofwarch.h" |
35 | #include <align.h> |
37 | #include <align.h> |
36 | 38 | ||
37 | #define KERNEL_VIRTUAL_ADDRESS 0x400000 |
39 | #define KERNEL_VIRTUAL_ADDRESS 0x400000 |
38 | 40 | ||
Line 81... | Line 83... | ||
81 | 83 | ||
82 | unsigned int i; |
84 | unsigned int i; |
83 | for (i = 0; i < COMPONENTS; i++) |
85 | for (i = 0; i < COMPONENTS; i++) |
84 | printf(" %P: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size); |
86 | printf(" %P: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size); |
85 | 87 | ||
86 | printf("\nCopying components\n"); |
88 | void * base = (void *) KERNEL_VIRTUAL_ADDRESS; |
87 | unsigned int top = 0; |
89 | unsigned int top = 0; |
- | 90 | ||
- | 91 | printf("\nCopying components\n"); |
|
88 | bootinfo.taskmap.count = 0; |
92 | bootinfo.taskmap.count = 0; |
89 | for (i = 0; i < COMPONENTS; i++) { |
93 | for (i = 0; i < COMPONENTS; i++) { |
90 | void * base = (void *) KERNEL_VIRTUAL_ADDRESS; |
- | |
91 | - | ||
92 | printf(" %s...", components[i].name); |
94 | printf(" %s...", components[i].name); |
93 | top = ALIGN_UP(top, PAGE_SIZE); |
95 | top = ALIGN_UP(top, PAGE_SIZE); |
94 | memcpy(base + top, components[i].start, components[i].size); |
96 | memcpy(base + top, components[i].start, components[i].size); |
95 | if (i > 0) { |
97 | if (i > 0) { |
96 | bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = base + top; |
98 | bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = base + top; |
Line 99... | Line 101... | ||
99 | } |
101 | } |
100 | top += components[i].size; |
102 | top += components[i].size; |
101 | printf("done.\n"); |
103 | printf("done.\n"); |
102 | } |
104 | } |
103 | 105 | ||
- | 106 | balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top, PAGE_SIZE)); |
|
- | 107 | ||
- | 108 | printf("\nCanonizing OpenFirmware device tree..."); |
|
- | 109 | bootinfo.ofw_root = ofw_tree_build(); |
|
- | 110 | printf("done.\n"); |
|
- | 111 | ||
104 | printf("\nBooting the kernel...\n"); |
112 | printf("\nBooting the kernel...\n"); |
105 | jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo)); |
113 | jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo)); |
106 | } |
114 | } |