Rev 4436 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4436 | Rev 4647 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | 37 | ||
38 | #include "main.h" |
38 | #include "main.h" |
39 | #include "asm.h" |
39 | #include "asm.h" |
40 | #include "_components.h" |
40 | #include "_components.h" |
41 | #include <printf.h> |
41 | #include <printf.h> |
- | 42 | #include <align.h> |
|
- | 43 | #include <macros.h> |
|
- | 44 | #include <string.h> |
|
42 | 45 | ||
43 | #include "mm.h" |
46 | #include "mm.h" |
44 | 47 | ||
45 | /** Kernel entry point address. */ |
48 | /** Kernel entry point address. */ |
46 | #define KERNEL_VIRTUAL_ADDRESS 0x80200000 |
49 | #define KERNEL_VIRTUAL_ADDRESS 0x80200000 |
47 | 50 | ||
48 | 51 | ||
49 | char *release = RELEASE; |
52 | char *release = STRING(RELEASE); |
50 | 53 | ||
51 | #ifdef REVISION |
54 | #ifdef REVISION |
52 | char *revision = ", revision " REVISION; |
55 | char *revision = ", revision " STRING(REVISION); |
53 | #else |
56 | #else |
54 | char *revision = ""; |
57 | char *revision = ""; |
55 | #endif |
58 | #endif |
56 | 59 | ||
57 | #ifdef TIMESTAMP |
60 | #ifdef TIMESTAMP |
58 | char *timestamp = "\nBuilt on " TIMESTAMP; |
61 | char *timestamp = "\nBuilt on " STRING(TIMESTAMP); |
59 | #else |
62 | #else |
60 | char *timestamp = ""; |
63 | char *timestamp = ""; |
61 | #endif |
64 | #endif |
62 | 65 | ||
63 | 66 | ||
Line 82... | Line 85... | ||
82 | 85 | ||
83 | printf("\nMemory statistics\n"); |
86 | printf("\nMemory statistics\n"); |
84 | printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS); |
87 | printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS); |
85 | printf(" %L: boot info structure\n", &bootinfo); |
88 | printf(" %L: boot info structure\n", &bootinfo); |
86 | 89 | ||
- | 90 | unsigned int top = 0; |
|
- | 91 | bootinfo.cnt = 0; |
|
87 | unsigned int i, j; |
92 | unsigned int i, j; |
88 | for (i = 0; i < COMPONENTS; i++) { |
93 | for (i = 0; i < COMPONENTS; i++) { |
89 | printf(" %L: %s image (size %d bytes)\n", |
94 | printf(" %L: %s image (size %d bytes)\n", |
90 | components[i].start, components[i].name, components[i].size); |
95 | components[i].start, components[i].name, components[i].size); |
91 | } |
- | |
92 | - | ||
93 | printf("\nCopying components\n"); |
- | |
94 | - | ||
95 | unsigned int top = 0; |
- | |
96 | bootinfo.cnt = 0; |
- | |
97 | for (i = 0; i < COMPONENTS; i++) { |
- | |
98 | printf(" %s...", components[i].name); |
- | |
99 | top = ALIGN_UP(top, KERNEL_PAGE_SIZE); |
96 | top = ALIGN_UP(top, KERNEL_PAGE_SIZE); |
100 | memcpy(((void *) KERNEL_VIRTUAL_ADDRESS) + top, components[i].start, components[i].size); |
- | |
101 | if (i > 0) { |
97 | if (i > 0) { |
102 | bootinfo.tasks[bootinfo.cnt].addr = ((void *) KERNEL_VIRTUAL_ADDRESS) + top; |
98 | bootinfo.tasks[bootinfo.cnt].addr = ((void *) KERNEL_VIRTUAL_ADDRESS) + top; |
103 | bootinfo.tasks[bootinfo.cnt].size = components[i].size; |
99 | bootinfo.tasks[bootinfo.cnt].size = components[i].size; |
- | 100 | strncpy(bootinfo.tasks[bootinfo.cnt].name, |
|
- | 101 | components[i].name, BOOTINFO_TASK_NAME_BUFLEN); |
|
104 | bootinfo.cnt++; |
102 | bootinfo.cnt++; |
105 | } |
103 | } |
106 | top += components[i].size; |
104 | top += components[i].size; |
- | 105 | } |
|
- | 106 | j = bootinfo.cnt - 1; |
|
- | 107 | ||
- | 108 | printf("\nCopying components\n"); |
|
- | 109 | ||
- | 110 | for (i = COMPONENTS - 1; i > 0; i--, j--) { |
|
- | 111 | printf(" %s...", components[i].name); |
|
- | 112 | memcpy((void *)bootinfo.tasks[j].addr, components[i].start, |
|
- | 113 | components[i].size); |
|
107 | printf("done.\n"); |
114 | printf("done.\n"); |
108 | } |
115 | } |
109 | 116 | ||
- | 117 | printf("\nCopying kernel..."); |
|
- | 118 | memcpy((void *)KERNEL_VIRTUAL_ADDRESS, components[0].start, |
|
- | 119 | components[0].size); |
|
- | 120 | printf("done.\n"); |
|
- | 121 | ||
110 | printf("\nBooting the kernel...\n"); |
122 | printf("\nBooting the kernel...\n"); |
111 | jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo)); |
123 | jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo); |
112 | } |
124 | } |
113 | 125 | ||
114 | /** @} |
126 | /** @} |
115 | */ |
127 | */ |
116 | 128 |