Changeset 63a045c in mainline for boot/arch/ia64
- Timestamp:
- 2018-10-10T17:41:44Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9286475
- Parents:
- 63c1dd5
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:11:15)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:41:44)
- Location:
- boot/arch/ia64
- Files:
-
- 4 edited
-
Makefile.inc (modified) (3 diffs)
-
_link.ld.in (modified) (2 diffs)
-
include/arch/types.h (modified) (2 diffs)
-
src/main.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ia64/Makefile.inc
r63c1dd5 r63a045c 48 48 arch/$(BARCH)/src/pal_asm.S \ 49 49 arch/$(BARCH)/src/putchar.c \ 50 $(COMPS).s \ 51 $(COMPS)_desc.c \ 50 $(COMPS).o \ 52 51 genarch/src/efi.c \ 53 52 genarch/src/division.c \ … … 59 58 generic/src/str.c \ 60 59 generic/src/version.c \ 61 generic/src/inflate.c 60 generic/src/inflate.c \ 61 generic/src/tar.c \ 62 generic/src/gzip.c \ 63 generic/src/payload.c 62 64 63 65 ifeq ($(MACHINE),ski) … … 97 99 platform/ski 98 100 endif 99 100 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/ia64/_link.ld.in
r63c1dd5 r63a045c 4 4 SECTIONS { 5 5 .boot 0x4400000: AT (0x4400000) { 6 loader_start = .; 6 7 *(BOOTSTRAP); 7 8 *(.text); … … 16 17 *(.bss); /* uninitialized static variables */ 17 18 *(COMMON); 18 *(.components); 19 loader_end = .; 20 payload_start = .; 21 *(.payload); 22 payload_end = .; 19 23 } 20 24 -
boot/arch/ia64/include/arch/types.h
r63c1dd5 r63a045c 40 40 size_t size; 41 41 char name[BOOTINFO_TASK_NAME_BUFLEN]; 42 } binit_task_t;42 } task_t; 43 43 44 44 typedef struct { 45 45 size_t cnt; 46 binit_task_t tasks[TASKMAP_MAX_RECORDS];47 } binit_t;46 task_t tasks[TASKMAP_MAX_RECORDS]; 47 } taskmap_t; 48 48 49 49 typedef struct { … … 54 54 55 55 typedef struct { 56 binit_t taskmap;56 taskmap_t taskmap; 57 57 58 58 memmap_item_t memmap[MEMMAP_ITEMS]; -
boot/arch/ia64/src/main.c
r63c1dd5 r63a045c 43 43 #include <str.h> 44 44 #include <errno.h> 45 #include <inflate.h> 46 #include "../../components.h" 45 #include <payload.h> 47 46 48 47 #define DEFAULT_MEMORY_BASE 0x4000000ULL … … 150 149 version_print(); 151 150 151 printf("Boot loader: %p -> %p\n", loader_start, loader_end); 152 152 printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo); 153 153 printf(" %p|%p: kernel entry point\n", … … 156 156 (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS); 157 157 158 size_t i;159 for (i = 0; i < COMPONENTS; i++)160 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,161 components[i].addr, components[i].name,162 components[i].inflated, components[i].size);163 164 void *dest[COMPONENTS];165 size_t top = KERNEL_ADDRESS;166 size_t cnt = 0;167 bootinfo.taskmap.cnt = 0;168 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {169 top = ALIGN_UP(top, PAGE_SIZE);170 171 if (i > 0) {172 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =173 (void *) top;174 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =175 components[i].inflated;176 177 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,178 BOOTINFO_TASK_NAME_BUFLEN, components[i].name);179 180 bootinfo.taskmap.cnt++;181 }182 183 dest[i] = (void *) top;184 top += components[i].inflated;185 cnt++;186 }187 188 printf("\nInflating components ... ");189 190 /*191 * We will use the next available address for a copy of each component to192 * make sure that inflate() works with disjunctive memory regions.193 */194 top = ALIGN_UP(top, PAGE_SIZE);195 196 for (i = cnt; i > 0; i--) {197 printf("%s ", components[i - 1].name);198 199 /*200 * Copy the component to a location which is guaranteed not to201 * overlap with the destination for inflate().202 */203 memmove((void *) top, components[i - 1].addr, components[i - 1].size);204 205 int err = inflate((void *) top, components[i - 1].size,206 dest[i - 1], components[i - 1].inflated);207 208 if (err != EOK) {209 printf("\n%s: Inflating error %d, halting.\n",210 components[i - 1].name, err);211 halt();212 }213 }214 215 printf(".\n");216 217 158 read_efi_memmap(); 218 159 read_sal_configuration(); 219 160 read_pal_configuration(); 220 161 162 uint8_t *kernel_start = (uint8_t *) KERNEL_ADDRESS; 163 uint8_t *ram_end = NULL; 164 165 /* Find the end of the memory area occupied by the kernel. */ 166 for (unsigned i = 0; i < bootinfo.memmap_items; i++) { 167 memmap_item_t m = bootinfo.memmap[i]; 168 if (m.type == MEMMAP_FREE_MEM && 169 m.base <= (uintptr_t) kernel_start && 170 m.base + m.size > (uintptr_t) kernel_start) { 171 ram_end = (uint8_t *) (m.base + m.size); 172 } 173 } 174 175 if (ram_end == NULL) { 176 printf("Memory map doesn't contain usable area at kernel's address.\n"); 177 halt(); 178 } 179 180 // FIXME: Correct kernel's logical address. 181 extract_payload(&bootinfo.taskmap, kernel_start, ram_end, 182 (uintptr_t) kernel_start, NULL); 183 221 184 printf("Booting the kernel ...\n"); 222 185 jump_to_kernel(&bootinfo);
Note:
See TracChangeset
for help on using the changeset viewer.
