Changeset 63a045c in mainline for boot/arch/mips32
- 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/mips32
- Files:
-
- 5 edited
-
Makefile.inc (modified) (2 diffs)
-
_link.ld.in (modified) (2 diffs)
-
include/arch/types.h (modified) (1 diff)
-
src/asm.S (modified) (1 diff)
-
src/main.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/mips32/Makefile.inc
r63c1dd5 r63a045c 76 76 arch/$(BARCH)/src/main.c \ 77 77 arch/$(BARCH)/src/putchar.c \ 78 $(COMPS).s \ 79 $(COMPS)_desc.c \ 78 $(COMPS).o \ 80 79 genarch/src/division.c \ 81 80 genarch/src/multiplication.c \ … … 86 85 generic/src/str.c \ 87 86 generic/src/version.c \ 88 generic/src/inflate.c 89 90 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) 87 generic/src/inflate.c \ 88 generic/src/gzip.c \ 89 generic/src/tar.c \ 90 generic/src/payload.c -
boot/arch/mips32/_link.ld.in
r63c1dd5 r63a045c 8 8 #endif 9 9 .text : { 10 loader_start = .; 10 11 *(BOOTSTRAP); 11 12 *(.text); … … 21 22 *(.bss); /* uninitialized static variables */ 22 23 *(COMMON); /* global variables */ 23 *(.components); 24 loader_end = .; 25 payload_start = .; 26 *(.payload); 27 payload_end = .; 24 28 } 25 29 -
boot/arch/mips32/include/arch/types.h
r63c1dd5 r63a045c 46 46 47 47 typedef struct { 48 size_t cnt; 49 task_t tasks[TASKMAP_MAX_RECORDS]; 50 } taskmap_t; 51 52 typedef struct { 48 53 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 49 54 uint32_t sdram_size; 50 55 #endif 51 56 uint32_t cpumap; 52 size_t cnt; 53 task_t tasks[TASKMAP_MAX_RECORDS]; 57 taskmap_t taskmap; 54 58 } bootinfo_t; 55 59 -
boot/arch/mips32/src/asm.S
r63c1dd5 r63a045c 147 147 148 148 FUNCTION_BEGIN(jump_to_kernel) 149 /*150 * TODO:151 *152 * Make sure that the I-cache, D-cache and memory are mutually153 * coherent before passing control to the copied code.154 */155 149 j $a0 156 150 nop -
boot/arch/mips32/src/main.c
r63c1dd5 r63a045c 39 39 #include <str.h> 40 40 #include <errno.h> 41 #include <inflate.h> 42 #include "../../components.h" 43 44 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) 41 #include <payload.h> 45 42 46 43 static bootinfo_t *bootinfo = (bootinfo_t *) PA2KA(BOOTINFO_OFFSET); … … 63 60 (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET); 64 61 65 size_t i; 66 for (i = 0; i < COMPONENTS; i++) 67 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 68 (uintptr_t) components[i].addr >= PA2KSEG(0) ? 69 (void *) KSEG2PA(components[i].addr) : 70 (void *) KA2PA(components[i].addr), 71 components[i].name, components[i].inflated, 72 components[i].size); 62 uint8_t *kernel_start = (uint8_t *) PA2KA(BOOT_OFFSET); 63 // FIXME: Use the correct value. 64 uint8_t *ram_end = kernel_start + (1 << 24); 73 65 74 void *dest[COMPONENTS]; 75 size_t top = 0; 76 size_t cnt = 0; 77 bootinfo->cnt = 0; 78 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 79 top = ALIGN_UP(top, PAGE_SIZE); 66 // TODO: Make sure that the I-cache, D-cache and memory are coherent. 67 // (i.e. provide the clear_cache callback) 80 68 81 if (i > 0) { 82 bootinfo->tasks[bootinfo->cnt].addr = TOP2ADDR(top); 83 bootinfo->tasks[bootinfo->cnt].size = components[i].inflated; 84 85 str_cpy(bootinfo->tasks[bootinfo->cnt].name, 86 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 87 88 bootinfo->cnt++; 89 } 90 91 dest[i] = TOP2ADDR(top); 92 top += components[i].inflated; 93 cnt++; 94 } 95 96 printf("\nInflating components ... "); 97 98 for (i = cnt; i > 0; i--) { 99 #ifdef MACHINE_msim 100 void *tail = dest[i - 1] + components[i].inflated; 101 if (tail >= ((void *) PA2KA(LOADER_OFFSET))) { 102 printf("\n%s: Image too large to fit (%p >= %p), halting.\n", 103 components[i].name, tail, (void *) PA2KA(LOADER_OFFSET)); 104 halt(); 105 } 106 #endif 107 108 printf("%s ", components[i - 1].name); 109 110 int err = inflate(components[i - 1].addr, components[i - 1].size, 111 dest[i - 1], components[i - 1].inflated); 112 113 if (err != EOK) { 114 printf("\n%s: Inflating error %d, halting.\n", 115 components[i - 1].name, err); 116 halt(); 117 } 118 } 119 120 printf(".\n"); 69 extract_payload(&bootinfo->taskmap, kernel_start, ram_end, 70 (uintptr_t) kernel_start, NULL); 121 71 122 72 printf("Copying CPU map ... \n"); 123 73 124 74 bootinfo->cpumap = 0; 125 for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {75 for (int i = 0; i < CPUMAP_MAX_RECORDS; i++) { 126 76 if (cpumap[i] != 0) 127 77 bootinfo->cpumap |= (1 << i);
Note:
See TracChangeset
for help on using the changeset viewer.
