- Timestamp:
- 2017-10-17T13:11:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 60af4cdb
- Parents:
- dbf32b1 (diff), a416d070 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- boot/arch
- Files:
-
- 1 added
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/amd64/Makefile.inc
rdbf32b1 r95c675b 71 71 72 72 BOOT_OUTPUT = $(ROOT_PATH)/image.iso 73 PREBUILD = $(INITRD).img74 73 BUILD = Makefile.grub -
boot/arch/arm32/Makefile.inc
rdbf32b1 r95c675b 45 45 ifeq ($(MACHINE), raspberrypi) 46 46 BOOT_OUTPUT = image.boot 47 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 47 POST_OUTPUT = $(ROOT_PATH)/uImage.bin 48 48 LADDR = 0x00008000 49 49 SADDR = 0x00008000 50 POSTBUILD = Makefile.uboot 50 POSTBUILD = Makefile.uboot 51 51 endif 52 52 … … 76 76 char/atkbd \ 77 77 char/ps2mouse \ 78 intctl/icp-ic \ 78 79 platform/icp 79 RD_SRVS_ESSENTIAL += \80 $(USPACE_PATH)/srv/hw/irc/icp-ic/icp-ic81 80 endif 82 81 … … 96 95 arch/$(BARCH)/src/mm.c \ 97 96 arch/$(BARCH)/src/putchar.c \ 98 $(COMPS_C) \ 97 $(COMPS).s \ 98 $(COMPS)_desc.c \ 99 99 genarch/src/division.c \ 100 100 generic/src/memstr.c \ … … 105 105 generic/src/version.c \ 106 106 generic/src/inflate.c 107 108 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/arm32/_link.ld.in
rdbf32b1 r95c675b 23 23 *(.bss); /* uninitialized static variables */ 24 24 *(COMMON); /* global variables */ 25 [[COMPONENTS]] 25 *(.components); 26 26 } 27 27 bdata_end = .; -
boot/arch/arm32/include/mm.h
rdbf32b1 r95c675b 42 42 #ifndef BOOT_arm32__MM_H 43 43 #define BOOT_arm32__MM_H 44 45 #include <typedefs.h>46 44 47 45 /** Describe "section" page table entry (one-level paging with 1 MB sized pages). */ -
boot/arch/arm32/include/types.h
rdbf32b1 r95c675b 37 37 #define BOOT_arm32_TYPES_H 38 38 39 #include <arch/common.h> 40 39 41 #define TASKMAP_MAX_RECORDS 32 40 42 #define BOOTINFO_TASK_NAME_BUFLEN 32 -
boot/arch/arm32/src/main.c
rdbf32b1 r95c675b 37 37 #include <arch/asm.h> 38 38 #include <arch/mm.h> 39 #include <arch/_components.h>40 39 #include <halt.h> 41 40 #include <printf.h> … … 44 43 #include <macros.h> 45 44 #include <align.h> 45 #include <stdbool.h> 46 46 #include <str.h> 47 47 #include <errno.h> 48 48 #include <inflate.h> 49 49 #include <arch/cp15.h> 50 #include "../../components.h" 50 51 51 52 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) … … 98 99 99 100 for (size_t i = 0; i < COMPONENTS; i++) { 100 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i]. start,101 components[i]. start, components[i].name, components[i].inflated,101 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].addr, 102 components[i].addr, components[i].name, components[i].inflated, 102 103 components[i].size); 103 104 } … … 128 129 129 130 for (size_t i = cnt; i > 0; i--) { 130 void *tail = components[i - 1]. start+ components[i - 1].size;131 void *tail = components[i - 1].addr + components[i - 1].size; 131 132 if (tail >= dest[i - 1]) { 132 133 printf("\n%s: Image too large to fit (%p >= %p), halting.\n", … … 137 138 printf("%s ", components[i - 1].name); 138 139 139 int err = inflate(components[i - 1]. start, components[i - 1].size,140 int err = inflate(components[i - 1].addr, components[i - 1].size, 140 141 dest[i - 1], components[i - 1].inflated); 141 142 if (err != EOK) { -
boot/arch/arm32/src/mm.c
rdbf32b1 r95c675b 34 34 */ 35 35 36 #include < typedefs.h>36 #include <stdint.h> 37 37 #include <arch/asm.h> 38 38 #include <arch/mm.h> -
boot/arch/arm32/src/putchar.c
rdbf32b1 r95c675b 36 36 */ 37 37 38 #include <typedefs.h>39 38 #include <arch/main.h> 40 39 #include <putchar.h> 40 #include <stddef.h> 41 #include <stdint.h> 41 42 #include <str.h> 42 43 -
boot/arch/ia64/Makefile.inc
rdbf32b1 r95c675b 48 48 arch/$(BARCH)/src/pal_asm.S \ 49 49 arch/$(BARCH)/src/putchar.c \ 50 $(COMPS_C) \ 50 $(COMPS).s \ 51 $(COMPS)_desc.c \ 51 52 genarch/src/efi.c \ 52 53 genarch/src/division.c \ … … 88 89 bus/isa 89 90 91 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/ia64/_link.ld.in
rdbf32b1 r95c675b 16 16 *(.bss); /* uninitialized static variables */ 17 17 *(COMMON); 18 [[COMPONENTS]] 18 *(.components); 19 19 } 20 20 21 21 /DISCARD/ : { 22 22 *(.*); -
boot/arch/ia64/include/pal.h
rdbf32b1 r95c675b 31 31 32 32 #include <arch/types.h> 33 #include <typedefs.h> 33 #include <stddef.h> 34 #include <stdint.h> 34 35 35 36 /* -
boot/arch/ia64/include/sal.h
rdbf32b1 r95c675b 31 31 32 32 #include <arch/types.h> 33 #include <typedefs.h> 33 #include <stddef.h> 34 #include <stdint.h> 34 35 35 36 /* -
boot/arch/ia64/include/ski.h
rdbf32b1 r95c675b 30 30 #define BOOT_ia64_SKI_H_ 31 31 32 #include <stddef.h> 32 33 #include <str.h> 33 34 -
boot/arch/ia64/src/main.c
rdbf32b1 r95c675b 33 33 #include <arch/arch.h> 34 34 #include <arch/asm.h> 35 #include <arch/_components.h>36 35 #include <genarch/efi.h> 37 36 #include <arch/sal.h> … … 46 45 #include <errno.h> 47 46 #include <inflate.h> 47 #include "../../components.h" 48 48 49 49 #define DEFAULT_MEMORY_BASE 0x4000000ULL … … 78 78 memmap[items].size = DEFAULT_LEGACY_IO_SIZE; 79 79 memmap[items].type = MEMMAP_IO_PORTS; 80 items++; 80 items++; 81 81 } else { 82 82 char *cur, *mm_base = (char *) bootpar->efi_memmap; … … 159 159 size_t i; 160 160 for (i = 0; i < COMPONENTS; i++) 161 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i]. start,162 components[i]. start, components[i].name,161 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 162 components[i].addr, components[i].name, 163 163 components[i].inflated, components[i].size); 164 164 … … 202 202 * overlap with the destination for inflate(). 203 203 */ 204 memmove((void *) top, components[i - 1]. start, components[i - 1].size);204 memmove((void *) top, components[i - 1].addr, components[i - 1].size); 205 205 206 206 int err = inflate((void *) top, components[i - 1].size, -
boot/arch/ia64/src/putchar.c
rdbf32b1 r95c675b 27 27 */ 28 28 29 #include <typedefs.h>30 29 #include <arch/arch.h> 31 30 #include <putchar.h> 31 #include <stddef.h> 32 32 #include <str.h> 33 33 #include <arch/ski.h> -
boot/arch/ia64/src/ski.c
rdbf32b1 r95c675b 28 28 29 29 #include <arch/ski.h> 30 #include <typedefs.h> 30 #include <stdbool.h> 31 #include <stddef.h> 31 32 32 33 #define SKI_INIT_CONSOLE 20 -
boot/arch/mips32/Makefile.inc
rdbf32b1 r95c675b 30 30 BITS = 32 31 31 EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32 32 AS_PROLOG = .module softfloat; 32 33 33 34 ifeq ($(MACHINE),msim) … … 74 75 arch/$(BARCH)/src/main.c \ 75 76 arch/$(BARCH)/src/putchar.c \ 76 $(COMPS_C) \ 77 $(COMPS).s \ 78 $(COMPS)_desc.c \ 77 79 genarch/src/division.c \ 78 80 genarch/src/multiplication.c \ … … 84 86 generic/src/version.c \ 85 87 generic/src/inflate.c 88 89 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/mips32/_link.ld.in
rdbf32b1 r95c675b 21 21 *(.bss); /* uninitialized static variables */ 22 22 *(COMMON); /* global variables */ 23 [[COMPONENTS]] 23 *(.components); 24 24 } 25 25 -
boot/arch/mips32/include/types.h
rdbf32b1 r95c675b 30 30 #define BOOT_mips32_TYPES_H_ 31 31 32 #include <arch/common.h> 33 32 34 #define TASKMAP_MAX_RECORDS 32 33 35 #define CPUMAP_MAX_RECORDS 32 -
boot/arch/mips32/src/main.c
rdbf32b1 r95c675b 30 30 #include <arch/arch.h> 31 31 #include <arch/asm.h> 32 #include <arch/_components.h>33 32 #include <halt.h> 34 33 #include <printf.h> … … 40 39 #include <errno.h> 41 40 #include <inflate.h> 41 #include "../../components.h" 42 42 43 43 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) … … 64 64 size_t i; 65 65 for (i = 0; i < COMPONENTS; i++) 66 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i]. start,67 (uintptr_t) components[i]. start>= PA2KSEG(0) ?68 (void *) KSEG2PA(components[i]. start) :69 (void *) KA2PA(components[i]. start),66 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 67 (uintptr_t) components[i].addr >= PA2KSEG(0) ? 68 (void *) KSEG2PA(components[i].addr) : 69 (void *) KA2PA(components[i].addr), 70 70 components[i].name, components[i].inflated, 71 71 components[i].size); … … 107 107 printf("%s ", components[i - 1].name); 108 108 109 int err = inflate(components[i - 1]. start, components[i - 1].size,109 int err = inflate(components[i - 1].addr, components[i - 1].size, 110 110 dest[i - 1], components[i - 1].inflated); 111 111 -
boot/arch/mips32/src/putchar.c
rdbf32b1 r95c675b 27 27 */ 28 28 29 #include <typedefs.h> 29 #include <stddef.h> 30 #include <stdint.h> 30 31 #include <arch/arch.h> 31 32 #include <putchar.h> -
boot/arch/ppc32/Makefile.inc
rdbf32b1 r95c675b 44 44 RD_DRVS_ESSENTIAL += \ 45 45 platform/mac \ 46 bus/adb/cuda_adb \ 46 47 bus/pci/pciintel \ 47 48 bus/usb/ohci \ … … 57 58 arch/$(BARCH)/src/main.c \ 58 59 arch/$(BARCH)/src/ofw.c \ 59 $(COMPS_C) \ 60 $(COMPS).s \ 61 $(COMPS)_desc.c \ 60 62 genarch/src/ofw.c \ 61 63 genarch/src/ofw_tree.c \ … … 70 72 generic/src/version.c \ 71 73 generic/src/inflate.c 74 75 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/ppc32/_link.ld.in
rdbf32b1 r95c675b 18 18 *(.bss); /* uninitialized static variables */ 19 19 *(COMMON); /* global variables */ 20 [[COMPONENTS]] 20 *(.components); 21 21 } 22 22 -
boot/arch/ppc32/include/asm.h
rdbf32b1 r95c675b 30 30 #define BOOT_ppc32_ASM_H_ 31 31 32 #include < typedefs.h>32 #include <stddef.h> 33 33 #include <arch/main.h> 34 34 -
boot/arch/ppc32/include/main.h
rdbf32b1 r95c675b 30 30 #define BOOT_ppc32_MAIN_H_ 31 31 32 #include < typedefs.h>32 #include <stddef.h> 33 33 #include <balloc.h> 34 34 #include <genarch/ofw_tree.h> -
boot/arch/ppc32/include/types.h
rdbf32b1 r95c675b 30 30 #define BOOT_ppc32_TYPES_H_ 31 31 32 #include <arch/common.h> 33 32 34 #define TASKMAP_MAX_RECORDS 32 33 35 #define BOOTINFO_TASK_NAME_BUFLEN 32 -
boot/arch/ppc32/src/main.c
rdbf32b1 r95c675b 30 30 #include <arch/arch.h> 31 31 #include <arch/asm.h> 32 #include <arch/_components.h>33 32 #include <genarch/ofw.h> 34 33 #include <genarch/ofw_tree.h> … … 42 41 #include <errno.h> 43 42 #include <inflate.h> 43 #include "../../components.h" 44 44 45 45 #define BALLOC_MAX_SIZE 131072 … … 75 75 size_t i; 76 76 for (i = 0; i < COMPONENTS; i++) 77 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i]. start,78 ofw_translate(components[i]. start), components[i].name,77 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 78 ofw_translate(components[i].addr), components[i].name, 79 79 components[i].inflated, components[i].size); 80 80 … … 139 139 printf("%s ", components[i - 1].name); 140 140 141 int err = inflate(components[i - 1]. start, components[i - 1].size,141 int err = inflate(components[i - 1].addr, components[i - 1].size, 142 142 inflate_base + dest[i - 1], components[i - 1].inflated); 143 143 -
boot/arch/ppc32/src/ofw.c
rdbf32b1 r95c675b 28 28 29 29 #include <genarch/ofw.h> 30 #include < typedefs.h>30 #include <stddef.h> 31 31 #include <putchar.h> 32 32 #include <str.h> -
boot/arch/riscv64/Makefile.inc
rdbf32b1 r95c675b 34 34 BITS = 64 35 35 ENDIANESS = LE 36 EXTRA_CFLAGS = -mcmodel=medany 36 37 37 38 SOURCES = \ … … 40 41 arch/$(BARCH)/src/ucb.c \ 41 42 arch/$(BARCH)/src/putchar.c \ 42 $(COMPS_C) \ 43 $(COMPS).s \ 44 $(COMPS)_desc.c \ 43 45 generic/src/memstr.c \ 44 46 generic/src/printf_core.c \ … … 48 50 generic/src/version.c \ 49 51 generic/src/inflate.c 52 53 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/riscv64/_link.ld.in
rdbf32b1 r95c675b 1 #include <arch/arch.h> 2 1 3 ENTRY(start) 2 4 3 5 SECTIONS { 6 . = PHYSMEM_START; 7 4 8 .text : { 5 9 *(BOOTSTRAP); 6 10 *(.text); 7 11 } 12 13 . = ALIGN(0x1000); 14 .htif : { 15 htif_page = .; 16 *(.htif) 17 } 18 . = ALIGN(0x1000); 19 20 . = ALIGN(0x1000); 21 .pt : { 22 pt_page = .; 23 *(.pt) 24 } 25 . = ALIGN(0x1000); 8 26 9 27 .data : { … … 17 35 *(.bss); /* uninitialized static variables */ 18 36 *(COMMON); /* global variables */ 19 [[COMPONENTS]] 37 *(.components); 20 38 } 21 39 -
boot/arch/riscv64/include/arch.h
rdbf32b1 r95c675b 35 35 #define BOOT_STACK_SIZE PAGE_SIZE 36 36 37 #define PHYSMEM_START 0x40000000 38 #define PHYSMEM_SIZE 1073741824 39 #define BOOT_OFFSET 0x48000000 40 37 41 #define DEFAULT_MTVEC 0x00000100 38 42 #define TRAP_VECTOR_RESET 0x0100 -
boot/arch/riscv64/include/asm.h
rdbf32b1 r95c675b 30 30 #define BOOT_riscv64_ASM_H_ 31 31 32 #include < typedefs.h>32 #include <stddef.h> 33 33 34 extern void jump_to_kernel(void *, uintptr_t) 34 extern char htif_page[]; 35 extern char pt_page[]; 36 37 extern void jump_to_kernel(uintptr_t) 35 38 __attribute__((noreturn)); 36 39 -
boot/arch/riscv64/include/types.h
rdbf32b1 r95c675b 30 30 #define BOOT_riscv64_TYPES_H_ 31 31 32 #include <arch/common.h> 33 32 34 #define MEMMAP_MAX_RECORDS 32 33 35 #define TASKMAP_MAX_RECORDS 32 … … 38 40 39 41 typedef int64_t ptrdiff_t; 42 43 typedef struct { 44 volatile uint64_t *tohost; 45 volatile uint64_t *fromhost; 46 } ucbinfo_t; 40 47 41 48 typedef struct { … … 65 72 66 73 typedef struct { 74 ucbinfo_t ucbinfo; 75 uintptr_t physmem_start; 76 uintptr_t htif_frame; 77 uintptr_t pt_frame; 67 78 memmap_t memmap; 68 79 taskmap_t taskmap; -
boot/arch/riscv64/include/ucb.h
rdbf32b1 r95c675b 36 36 */ 37 37 38 #include < typedefs.h>38 #include <stddef.h> 39 39 40 #define CSR_MTOHOST 0x780 41 #define CSR_MFROMHOST 0x781 40 extern volatile uint64_t tohost; 41 extern volatile uint64_t fromhost; 42 42 43 43 #define HTIF_DEVICE_CONSOLE 1 -
boot/arch/riscv64/src/asm.S
rdbf32b1 r95c675b 29 29 #include <abi/asmtool.h> 30 30 #include <arch/arch.h> 31 #include <arch/mm.h> 32 33 #define MCOUNTEREN_CY_MASK 0x00000001 34 #define MCOUNTEREN_TM_MASK 0x00000002 35 #define MCOUNTEREN_IR_MASK 0x00000004 36 37 #define MSTATUS_MPP_MASK 0x00001800 38 #define MSTATUS_MPP_USER 0x00000000 39 #define MSTATUS_MPP_SUPERVISOR 0x00000800 40 #define MSTATUS_MPP_MACHINE 0x00001800 41 42 #define MSTATUS_SUM_MASK 0x00040000 43 44 #define SATP_PFN_MASK 0x00000fffffffffff 45 46 #define SATP_MODE_MASK 0xf000000000000000 47 #define SATP_MODE_BARE 0x0000000000000000 48 #define SATP_MODE_SV39 0x8000000000000000 49 #define SATP_MODE_SV48 0x9000000000000000 31 50 32 51 .section BOOTSTRAP … … 76 95 77 96 FUNCTION_BEGIN(jump_to_kernel) 78 j halt 97 /* Enable performance counters access in supervisor mode */ 98 csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK 99 100 /* Setup SV48 paging for supervisor mode */ 101 la t0, ptl_0 102 srli t0, t0, 12 103 104 li t1, SATP_PFN_MASK 105 and t0, t0, t1 106 107 li t1, SATP_MODE_SV48 108 or t0, t0, t1 109 110 csrw sptbr, t0 111 112 /* Jump to supervisor mode */ 113 csrr t0, mstatus 114 115 li t1, ~MSTATUS_MPP_MASK 116 and t0, t0, t1 117 118 /* 119 * TODO: Enable running with Supervisor User Mode 120 * access disabled. 121 */ 122 li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK 123 or t0, t0, t1 124 125 csrw mstatus, t0 126 127 li ra, PA2KA(BOOT_OFFSET) 128 csrw mepc, ra 129 130 mret 79 131 FUNCTION_END(jump_to_kernel) 80 132 … … 88 140 SYMBOL(boot_stack) 89 141 .space BOOT_STACK_SIZE 142 143 .section .pt, "aw", @progbits 144 145 .align PAGE_WIDTH 146 SYMBOL(ptl_0) 147 .fill 256, 8, 0 148 /* Identity mapping for [0; 512G) */ 149 .quad 0 + (PTL_DIRTY | PTL_ACCESSED | PTL_EXECUTABLE | PTL_WRITABLE | PTL_READABLE | PTL_VALID) 150 .fill 255, 8, 0 -
boot/arch/riscv64/src/main.c
rdbf32b1 r95c675b 30 30 #include <arch/arch.h> 31 31 #include <arch/asm.h> 32 #include <arch/ucb.h> 33 #include <arch/mm.h> 32 34 #include <version.h> 33 #include < typedefs.h>35 #include <stddef.h> 34 36 #include <printf.h> 35 37 #include <macros.h> … … 39 41 #include <halt.h> 40 42 #include <inflate.h> 41 #include <arch/_components.h> 42 43 #define KA2PA(x) (((uintptr_t) (x)) - UINT64_C(0xffff800000000000)) 44 #define PA2KA(x) (((uintptr_t) (x)) + UINT64_C(0xffff800000000000)) 43 #include "../../components.h" 45 44 46 45 static bootinfo_t bootinfo; … … 50 49 version_print(); 51 50 51 bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH; 52 bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH; 53 54 bootinfo.ucbinfo.tohost = 55 (volatile uint64_t *) PA2KA((uintptr_t) &tohost); 56 bootinfo.ucbinfo.fromhost = 57 (volatile uint64_t *) PA2KA((uintptr_t) &fromhost); 58 52 59 // FIXME TODO: read from device tree 53 bootinfo.memmap.total = 1024 * 1024 * 1024; 54 bootinfo.memmap.cnt = 0; 60 bootinfo.physmem_start = PHYSMEM_START; 61 bootinfo.memmap.total = PHYSMEM_SIZE; 62 bootinfo.memmap.cnt = 1; 63 bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START; 64 bootinfo.memmap.zones[0].size = PHYSMEM_SIZE; 55 65 56 printf("\nMemory statistics (total %lu MB)\n\n", bootinfo.memmap.total >> 20); 66 printf("\nMemory statistics (total %lu MB, starting at %p)\n\n", 67 bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start); 57 68 printf(" %p: boot info structure\n", &bootinfo); 58 69 59 uintptr_t top = 0;70 uintptr_t top = BOOT_OFFSET; 60 71 61 72 for (size_t i = 0; i < COMPONENTS; i++) { 62 printf(" %p: %s image (%zu/%zu bytes)\n", components[i]. start,73 printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr, 63 74 components[i].name, components[i].inflated, 64 75 components[i].size); 65 76 66 uintptr_t tail = (uintptr_t) components[i]. start+77 uintptr_t tail = (uintptr_t) components[i].addr + 67 78 components[i].size; 68 if (tail > top) 69 top = tail; 79 if (tail > top) { 80 printf("\n%s: Image too large to fit (%p >= %p), halting.\n", 81 components[i].name, (void *) tail, (void *) top); 82 halt(); 83 } 70 84 } 71 85 72 top = ALIGN_UP(top, PAGE_SIZE);73 86 printf(" %p: inflate area\n", (void *) top); 74 87 … … 92 105 bootinfo.taskmap.cnt++; 93 106 } else 94 kernel_entry = (void *) top;107 kernel_entry = (void *) PA2KA(top); 95 108 96 109 dest[i] = (void *) top; … … 101 114 printf(" %p: kernel entry point\n", kernel_entry); 102 115 103 if (top >= bootinfo. memmap.total) {116 if (top >= bootinfo.physmem_start + bootinfo.memmap.total) { 104 117 printf("Not enough physical memory available.\n"); 105 118 printf("The boot image is too large. Halting.\n"); … … 112 125 printf("%s ", components[i - 1].name); 113 126 114 int err = inflate(components[i - 1]. start, components[i - 1].size,127 int err = inflate(components[i - 1].addr, components[i - 1].size, 115 128 dest[i - 1], components[i - 1].inflated); 116 129 … … 125 138 126 139 printf("Booting the kernel...\n"); 127 jump_to_kernel( kernel_entry,PA2KA(&bootinfo));140 jump_to_kernel(PA2KA(&bootinfo)); 128 141 } -
boot/arch/riscv64/src/putchar.c
rdbf32b1 r95c675b 27 27 */ 28 28 29 #include < typedefs.h>29 #include <stddef.h> 30 30 #include <arch/arch.h> 31 31 #include <putchar.h> -
boot/arch/riscv64/src/ucb.c
rdbf32b1 r95c675b 31 31 #include <macros.h> 32 32 33 volatile uint64_t tohost __attribute__((section(".htif"))); 34 volatile uint64_t fromhost __attribute__((section(".htif"))); 35 36 static void poll_fromhost() 37 { 38 uint64_t val = fromhost; 39 if (!val) 40 return; 41 42 fromhost = 0; 43 } 44 33 45 void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload) 34 46 { … … 36 48 (((uint64_t) cmd) << 48) | 37 49 (payload & UINT64_C(0xffffffffffff)); 38 uint64_t retval;39 50 40 do { 41 asm volatile ( 42 "csrrw %[retval], " STRING(CSR_MTOHOST) ", %[val]\n" 43 : [retval] "=r" (retval) 44 : [val] "r" (val) 45 ); 46 } while (retval != 0); 51 while (tohost) 52 poll_fromhost(); 53 54 tohost = val; 47 55 } -
boot/arch/sparc64/Makefile.inc
rdbf32b1 r95c675b 57 57 arch/$(BARCH)/src/main.c \ 58 58 arch/$(BARCH)/src/ofw.c \ 59 $(COMPS_C) \ 59 $(COMPS).s \ 60 $(COMPS)_desc.c \ 60 61 genarch/src/ofw.c \ 61 62 genarch/src/ofw_tree.c \ … … 68 69 generic/src/version.c \ 69 70 generic/src/inflate.c 71 72 PRE_DEPEND = $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) -
boot/arch/sparc64/_link.ld.in
rdbf32b1 r95c675b 15 15 *(.bss); /* uninitialized static variables */ 16 16 *(COMMON); /* global variables */ 17 [[COMPONENTS]] 17 *(.components); 18 18 } 19 19 -
boot/arch/sparc64/include/asm.h
rdbf32b1 r95c675b 31 31 #define BOOT_sparc64_ASM_H_ 32 32 33 #include < typedefs.h>33 #include <stdint.h> 34 34 35 35 extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo, -
boot/arch/sparc64/include/main.h
rdbf32b1 r95c675b 30 30 #define BOOT_sparc64_MAIN_H_ 31 31 32 #include < typedefs.h>32 #include <stdint.h> 33 33 #include <balloc.h> 34 34 #include <genarch/ofw_tree.h> -
boot/arch/sparc64/include/ofw.h
rdbf32b1 r95c675b 30 30 #define BOOT_sparc64_OFW_H_ 31 31 32 #include < typedefs.h>32 #include <stdint.h> 33 33 34 34 #define OFW_ADDRESS_CELLS 2 -
boot/arch/sparc64/include/types.h
rdbf32b1 r95c675b 30 30 #define BOOT_sparc64_TYPES_H_ 31 31 32 #include <arch/common.h> 33 32 34 #define TASKMAP_MAX_RECORDS 32 33 35 #define BOOTINFO_TASK_NAME_BUFLEN 32 -
boot/arch/sparc64/src/main.c
rdbf32b1 r95c675b 32 32 #include <arch/asm.h> 33 33 #include <arch/ofw.h> 34 #include <arch/_components.h>35 34 #include <genarch/ofw.h> 36 35 #include <genarch/ofw_tree.h> … … 44 43 #include <errno.h> 45 44 #include <inflate.h> 45 #include "../../components.h" 46 46 47 47 /* The lowest ID (read from the VER register) of some US3 CPU model */ … … 220 220 size_t i; 221 221 for (i = 0; i < COMPONENTS; i++) 222 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i]. start,223 ofw_translate(components[i]. start), components[i].name,222 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 223 ofw_translate(components[i].addr), components[i].name, 224 224 components[i].inflated, components[i].size); 225 225 … … 267 267 ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1); 268 268 269 int err = inflate(components[i - 1]. start, components[i - 1].size,269 int err = inflate(components[i - 1].addr, components[i - 1].size, 270 270 dest[i - 1], components[i - 1].inflated); 271 271 -
boot/arch/sparc64/src/ofw.c
rdbf32b1 r95c675b 36 36 #include <arch/ofw.h> 37 37 #include <genarch/ofw.h> 38 #include <typedefs.h> 38 #include <stddef.h> 39 #include <stdint.h> 39 40 #include <printf.h> 40 41 #include <halt.h>
Note:
See TracChangeset
for help on using the changeset viewer.