Changeset 96e0748d in mainline
- Timestamp:
- 2009-02-17T22:47:27Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f89979b
- Parents:
- e662a5f
- Files:
-
- 2 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/loader/asm.h
re662a5f r96e0748d 33 33 /** @file 34 34 * @brief Functions implemented in assembly. 35 */ 35 */ 36 36 37 37 … … 41 41 42 42 /** Copies cnt bytes from dst to src. 43 * 43 * 44 44 * @param dst Destination address. 45 45 * @param src Source address. 46 * @param cnt Count of bytes to be copied. 46 * @param cnt Count of bytes to be copied. 47 47 */ 48 48 #define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt)) … … 59 59 /** Jumps to the kernel entry point. 60 60 * 61 * @param entry 62 * @param bootinfo 63 * @param bootinfo_size Size of the bootinfo structure.61 * @param entry Kernel entry point address. 62 * @param bootinfo Structure holding information about loaded tasks. 63 * 64 64 */ 65 extern void jump_to_kernel(void *entry, void *bootinfo, 66 unsigned int bootinfo_size) __attribute__((noreturn)); 65 extern void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn)); 67 66 68 67 -
boot/arch/arm32/loader/boot.S
re662a5f r96e0748d 54 54 page_table: 55 55 .skip PTL0_ENTRIES * PTL0_ENTRY_SIZE 56 57 -
boot/arch/arm32/loader/main.c
re662a5f r96e0748d 33 33 /** @file 34 34 * @brief Bootstrap. 35 */ 35 */ 36 36 37 37 … … 40 40 #include "_components.h" 41 41 #include <printf.h> 42 #include <align.h> 42 43 #include <macros.h> 43 44 … … 110 111 111 112 printf("\nBooting the kernel...\n"); 112 jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo , sizeof(bootinfo));113 jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo); 113 114 } 114 115 -
boot/arch/arm32/loader/main.h
re662a5f r96e0748d 33 33 /** @file 34 34 * @brief Boot related declarations. 35 */ 35 */ 36 36 37 37 … … 39 39 #define BOOT_arm32_MAIN_H 40 40 41 42 /** Aligns to the nearest higher address.43 *44 * @param addr Address or number to be aligned.45 * @param align Size of alignment, must be power of 2.46 */47 #define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))48 41 49 42 /** Maximum number of tasks in the #bootinfo_t struct. */ … … 75 68 /** @} 76 69 */ 77 -
boot/arch/mips32/loader/asm.h
re662a5f r96e0748d 30 30 #define BOOT_mips32_ASM_H_ 31 31 32 #define PAGE_SIZE 1638433 #define PAGE_WIDTH 1432 #define PAGE_SIZE 16384 33 #define PAGE_WIDTH 14 34 34 35 #define memcpy(dst, src, cnt) 35 #define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt)) 36 36 37 void jump_to_kernel(void *entry, void *bootinfo , unsigned int bootinfo_size) __attribute__((noreturn));37 void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn)); 38 38 39 39 #endif -
boot/arch/mips32/loader/boot.S
re662a5f r96e0748d 28 28 29 29 #include "regname.h" 30 31 #define INITIAL_STACK 0x80040000 32 #define MSIM_DORDER_ADDRESS 0x90000004 30 #include "main.h" 33 31 34 32 .set noat … … 41 39 start: 42 40 41 /* Setup CPU map (on msim this code 42 is executed in parallel on all CPUs, 43 but it not an issue) */ 44 la $a0, CPUMAP 45 46 sw $zero, 0($a0) 47 sw $zero, 4($a0) 48 sw $zero, 8($a0) 49 sw $zero, 12($a0) 50 51 sw $zero, 16($a0) 52 sw $zero, 20($a0) 53 sw $zero, 24($a0) 54 sw $zero, 28($a0) 55 56 sw $zero, 32($a0) 57 sw $zero, 36($a0) 58 sw $zero, 40($a0) 59 sw $zero, 44($a0) 60 61 sw $zero, 48($a0) 62 sw $zero, 52($a0) 63 sw $zero, 56($a0) 64 sw $zero, 60($a0) 65 66 sw $zero, 64($a0) 67 sw $zero, 68($a0) 68 sw $zero, 72($a0) 69 sw $zero, 76($a0) 70 71 sw $zero, 80($a0) 72 sw $zero, 84($a0) 73 sw $zero, 88($a0) 74 sw $zero, 92($a0) 75 76 sw $zero, 96($a0) 77 sw $zero, 100($a0) 78 sw $zero, 104($a0) 79 sw $zero, 108($a0) 80 81 sw $zero, 112($a0) 82 sw $zero, 116($a0) 83 sw $zero, 120($a0) 84 sw $zero, 124($a0) 85 86 lui $a1, 1 87 43 88 #ifdef MACHINE_msim 89 44 90 /* Read dorder value */ 45 91 la $k0, MSIM_DORDER_ADDRESS 46 lw $k 0, ($k0)92 lw $k1, ($k0) 47 93 48 94 /* If we are not running on BSP 49 end in an infinite loop */50 beq $k 0, $zero, bsp95 then end in an infinite loop */ 96 beq $k1, $zero, bsp 51 97 nop 98 99 /* Record CPU presence */ 100 sll $a2, $k1, 2 101 addu $a2, $a2, $a0 102 sw $a1, ($a2) 52 103 53 104 loop: … … 58 109 59 110 bsp: 111 /* Record CPU presence */ 112 sw $a1, ($a0) 113 60 114 /* Setup initial stack */ 61 lui $sp, INITIAL_STACK >> 16 62 ori $sp, $sp, INITIAL_STACK & 0xffff 115 la $sp, INITIAL_STACK 63 116 64 117 j bootstrap -
boot/arch/mips32/loader/main.c
re662a5f r96e0748d 29 29 #include "main.h" 30 30 #include <printf.h> 31 #include <align.h> 31 32 #include <macros.h> 32 33 #include "msim.h" … … 74 75 75 76 printf("\nCopying components\n"); 77 76 78 unsigned int top = 0; 77 79 bootinfo.cnt = 0; 78 for (i = 0; i < COMPONENTS; i++) {80 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 79 81 printf(" %s...", components[i].name); 80 82 top = ALIGN_UP(top, PAGE_SIZE); … … 89 91 } 90 92 93 unsigned int *cpumap = (unsigned int *) CPUMAP; 94 bootinfo.cpumap = 0; 95 for (i = 0; i < CPUMAP_MAX_RECORDS; i++) { 96 if (cpumap[i] != 0) 97 bootinfo.cpumap |= (1 << i); 98 } 99 91 100 printf("\nBooting the kernel...\n"); 92 jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo , sizeof(bootinfo));101 jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo); 93 102 } -
boot/arch/mips32/loader/main.h
re662a5f r96e0748d 30 30 #define BOOT_mips32_MAIN_H_ 31 31 32 /** Align to the nearest higher address. 33 * 34 * @param addr Address or size to be aligned. 35 * @param align Size of alignment, must be power of 2. 36 */ 37 #define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1)) 32 #define CPUMAP 0x80001000 33 #define INITIAL_STACK 0x80002000 34 #define MSIM_DORDER_ADDRESS 0xb0000004 38 35 39 #define TASKMAP_MAX_RECORDS 32 36 #define TASKMAP_MAX_RECORDS 32 37 #define CPUMAP_MAX_RECORDS 32 38 39 #ifndef __ASM__ 40 40 41 41 typedef struct { … … 45 45 46 46 typedef struct { 47 unsigned int cpumap; 47 48 unsigned int cnt; 48 49 task_t tasks[TASKMAP_MAX_RECORDS]; … … 53 54 54 55 #endif 56 57 #endif -
kernel/arch/arm32/include/arch.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup arm32 29 /** @addtogroup arm32 30 30 * @{ 31 31 */ … … 37 37 #define KERN_arm32_ARCH_H_ 38 38 39 #define TASKMAP_MAX_RECORDS 32 40 #define CPUMAP_MAX_RECORDS 32 41 42 #include <typedefs.h> 43 44 typedef struct { 45 uintptr_t addr; 46 uint32_t size; 47 } utask_t; 48 49 typedef struct { 50 uint32_t cnt; 51 utask_t tasks[TASKMAP_MAX_RECORDS]; 52 } bootinfo_t; 53 54 extern void arch_pre_main(void *entry, bootinfo_t *bootinfo); 55 39 56 #endif 40 57 -
kernel/arch/arm32/include/asm/boot.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup arm32 29 /** @addtogroup arm32 30 30 * @{ 31 31 */ … … 40 40 #define TEMP_STACK_SIZE 0x100 41 41 42 #ifndef __ASM__43 44 /** Kernel entry point.45 *46 * Implemented in assembly. Copies boot_bootinfo (declared as bootinfo in47 * boot/arch/arm32/loader/main.c) to #bootinfo struct. Then jumps to48 * #arch_pre_main and #main_bsp.49 *50 * @param entry Entry point address (not used).51 * @param boot_bootinfo Struct holding information about loaded tasks.52 * @param bootinfo_size Size of the bootinfo structure.53 */54 extern void kernel_image_start(void *entry, void *boot_bootinfo,55 unsigned int bootinfo_size);56 57 #endif58 59 42 #endif 60 43 -
kernel/arch/arm32/src/arm32.c
re662a5f r96e0748d 35 35 36 36 #include <arch.h> 37 #include <arch/boot.h>38 37 #include <config.h> 39 38 #include <arch/console.h> … … 49 48 #include <arch/machine.h> 50 49 #include <userspace.h> 51 52 /** Information about loaded tasks. */ 53 bootinfo_t bootinfo; 50 #include <macros.h> 54 51 55 52 /** Performs arm32 specific initialization before main_bsp() is called. */ 56 void arch_pre_main(void )53 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo) 57 54 { 58 55 unsigned int i; 59 60 init.cnt = bootinfo .cnt;61 62 for (i = 0; i < bootinfo.cnt; ++i) {63 init.tasks[i].addr = bootinfo .tasks[i].addr;64 init.tasks[i].size = bootinfo .tasks[i].size;56 57 init.cnt = bootinfo->cnt; 58 59 for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); ++i) { 60 init.tasks[i].addr = bootinfo->tasks[i].addr; 61 init.tasks[i].size = bootinfo->tasks[i].size; 65 62 } 66 67 63 } 68 64 -
kernel/arch/arm32/src/start.S
re662a5f r96e0748d 41 41 bic r3, r3, #0x1f 42 42 orr r3, r3, #0x13 43 msr cpsr_c, r3 43 msr cpsr_c, r3 44 44 45 45 ldr sp, =temp_stack 46 47 cmp r2, #048 beq bootinfo_end49 50 ldr r3, =bootinfo51 52 bootinfo_loop:53 ldr r4, [r1]54 str r4, [r3]55 56 add r1, r1, #457 add r3, r3, #458 add r2, r2, #-459 60 cmp r2, #061 bne bootinfo_loop62 46 63 bootinfo_end:64 65 47 bl arch_pre_main 66 48 67 49 bl main_bsp 68 50 … … 75 57 supervisor_sp: 76 58 .space 4 77 -
kernel/arch/ia64/include/arch.h
re662a5f r96e0748d 40 40 #include <arch/ski/ski.h> 41 41 42 extern void arch_pre_main(void); 43 42 44 #endif 43 45 -
kernel/arch/mips32/include/arch.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_mips32_ARCH_H_ 37 37 38 #define TASKMAP_MAX_RECORDS 32 39 #define CPUMAP_MAX_RECORDS 32 40 41 #include <typedefs.h> 42 43 extern count_t cpu_count; 44 45 typedef struct { 46 uintptr_t addr; 47 uint32_t size; 48 } utask_t; 49 50 typedef struct { 51 uint32_t cpumap; 52 uint32_t cnt; 53 utask_t tasks[TASKMAP_MAX_RECORDS]; 54 } bootinfo_t; 55 56 extern void arch_pre_main(void *entry, bootinfo_t *bootinfo); 57 38 58 #endif 39 59 -
kernel/arch/mips32/include/asm/boot.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ -
kernel/arch/mips32/src/mips32.c
re662a5f r96e0748d 34 34 35 35 #include <arch.h> 36 #include <arch/boot.h>37 36 #include <arch/cp0.h> 38 37 #include <arch/exception.h> … … 59 58 #include <arch/asm/regname.h> 60 59 61 /* Size of the code jumping to the exception handler code 62 * - J+NOP 63 */ 64 #define EXCEPTION_JUMP_SIZE 65 66 #define TLB_EXC ((char *) 0x80000000)67 #define NORM_EXC ((char *) 0x80000180)68 #define CACHE_EXC ((char *) 0x80000100)60 /* Size of the code jumping to the exception handler code 61 * - J+NOP 62 */ 63 #define EXCEPTION_JUMP_SIZE 8 64 65 #define TLB_EXC ((char *) 0x80000000) 66 #define NORM_EXC ((char *) 0x80000180) 67 #define CACHE_EXC ((char *) 0x80000100) 69 68 70 69 71 70 /* Why the linker moves the variable 64K away in assembler 72 * when not in .text section ???????? 73 */ 71 * when not in .text section? 72 */ 73 74 /* Stack pointer saved when entering user mode */ 74 75 uintptr_t supervisor_sp __attribute__ ((section (".text"))); 75 /* Stack pointer saved when entering user mode */ 76 /* TODO: How do we do it on SMP system???? */ 77 bootinfo_t bootinfo __attribute__ ((section (".text"))); 78 79 void arch_pre_main(void) 76 77 count_t cpu_count = 0; 78 79 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo) 80 80 { 81 81 /* Setup usermode */ 82 init.cnt = bootinfo.cnt; 83 84 uint32_t i; 85 86 for (i = 0; i < bootinfo.cnt; i++) { 87 init.tasks[i].addr = bootinfo.tasks[i].addr; 88 init.tasks[i].size = bootinfo.tasks[i].size; 82 init.cnt = bootinfo->cnt; 83 84 count_t i; 85 for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { 86 init.tasks[i].addr = bootinfo->tasks[i].addr; 87 init.tasks[i].size = bootinfo->tasks[i].size; 88 } 89 90 for (i = 0; i < CPUMAP_MAX_RECORDS; i++) { 91 if ((bootinfo->cpumap & (1 << i)) != 0) 92 cpu_count++; 89 93 } 90 94 } -
kernel/arch/mips32/src/smp/smp.c
re662a5f r96e0748d 33 33 */ 34 34 35 #include <config.h> 35 36 #include <smp/smp.h> 37 #include <arch/arch.h> 36 38 37 39 #ifdef CONFIG_SMP … … 39 41 void smp_init(void) 40 42 { 43 config.cpu_count = cpu_count; 41 44 } 42 45 -
kernel/arch/mips32/src/start.S
re662a5f r96e0748d 32 32 #include <arch/context_offset.h> 33 33 #include <arch/stack.h> 34 34 35 35 .text 36 36 … … 153 153 # Move $k0 (superveisor_sp) 154 154 lw $k0, 0($k0) 155 1: 155 1: 156 156 .endm 157 157 158 158 .org 0x0 159 159 kernel_image_start: … … 162 162 ori $sp, $sp, %lo(end_stack) 163 163 164 /* Not sure about this, but might 165 be needed for PIC code */ 166 lui $gp, 0x8000 167 164 168 /* $a1 contains physical address of bootinfo_t */ 165 /* $a2 contains size of bootinfo_t */166 167 beq $a2, $0, bootinfo_end168 169 /* Not sure about this, but might be needed for PIC code???? */170 lui $gp, 0x8000171 172 lui $a3, %hi(bootinfo)173 ori $a3, $a3, %lo(bootinfo)174 175 bootinfo_loop:176 177 lw $v0, 0($a1)178 sw $v0, 0($a3)179 180 addi $a1, $a1, 4181 addi $a3, $a3, 4182 addi $a2, $a2, -4183 184 bgtz $a2, bootinfo_loop185 nop186 187 bootinfo_end:188 169 189 170 jal arch_pre_main … … 206 187 exception_entry: 207 188 j exception_handler 208 nop 209 189 nop 190 210 191 exception_handler: 211 192 KERNEL_STACK_TO_K0 … … 216 197 mfc0 $k0, $cause 217 198 218 sra $k0, $k0, 0x2 219 andi $k0, $k0, 0x1f 220 sub $k0, 8 199 sra $k0, $k0, 0x2 # cp0_exc_cause() part 1 200 andi $k0, $k0, 0x1f # cp0_exc_cause() part 2 201 sub $k0, 8 # 8 = SYSCALL 221 202 222 203 beqz $k0, syscall_shortcut 223 add $k0, 8 204 add $k0, 8 # Revert $k0 back to correct exc number 224 205 225 206 REGISTERS_STORE_AND_EXC_RESET $sp 226 207 227 208 move $a1, $sp 228 jal exc_dispatch 209 jal exc_dispatch # exc_dispatch(excno, register_space) 229 210 move $a0, $k0 230 211 -
kernel/arch/ppc32/include/arch.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup ppc32 29 /** @addtogroup ppc32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ppc32_ARCH_H_ 37 37 38 #include <arch/drivers/cuda.h> 38 extern void arch_pre_main(void); 39 39 40 40 #endif -
kernel/arch/ppc32/include/boot/boot.h
re662a5f r96e0748d 27 27 */ 28 28 29 /** @addtogroup ppc32 29 /** @addtogroup ppc32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ppc32_BOOT_H_ 37 37 38 #define BOOT_OFFSET 38 #define BOOT_OFFSET 0x8000 39 39 40 40 /* Temporary stack size for boot process */ 41 #define TEMP_STACK_SIZE 0x100041 #define TEMP_STACK_SIZE 0x1000 42 42 43 #define TASKMAP_MAX_RECORDS 3244 #define MEMMAP_MAX_RECORDS 3243 #define TASKMAP_MAX_RECORDS 32 44 #define MEMMAP_MAX_RECORDS 32 45 45 46 46 #ifndef __ASM__ -
kernel/arch/ppc32/src/boot/boot.S
re662a5f r96e0748d 34 34 .global kernel_image_start 35 35 kernel_image_start: 36 36 37 37 # load temporal kernel stack 38 38 … … 53 53 54 54 addis r3, r3, 0x8000 55 55 56 56 lis r31, bootinfo@ha 57 57 addi r31, r31, bootinfo@l # r31 = bootinfo -
kernel/arch/ppc32/src/ppc32.c
re662a5f r96e0748d 46 46 #include <ddi/irq.h> 47 47 #include <arch/drivers/pic.h> 48 #include <macros.h> 48 49 49 #define IRQ_COUNT 50 #define IRQ_COUNT 64 50 51 51 52 bootinfo_t bootinfo; … … 53 54 void arch_pre_main(void) 54 55 { 55 /* Setup usermode */56 56 init.cnt = bootinfo.taskmap.count; 57 57 58 58 uint32_t i; 59 59 60 for (i = 0; i < bootinfo.taskmap.count; i++) {60 for (i = 0; i < min3(bootinfo.taskmap.count, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { 61 61 init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); 62 62 init.tasks[i].size = bootinfo.taskmap.tasks[i].size; -
kernel/arch/sparc64/include/arch.h
re662a5f r96e0748d 46 46 #define NWINDOWS 8 /** Number of register window sets. */ 47 47 48 #ifndef __ASM__ 49 50 extern void arch_pre_main(void); 51 52 #endif /* __ASM__ */ 53 48 54 #endif 49 55 -
kernel/generic/include/arch.h
re662a5f r96e0748d 64 64 } the_t; 65 65 66 #define THE ((the_t *)(get_stack_base()))66 #define THE ((the_t * )(get_stack_base())) 67 67 68 68 extern void the_initialize(the_t *the); 69 69 extern void the_copy(the_t *src, the_t *dst); 70 70 71 extern void arch_pre_main(void);72 71 extern void arch_pre_mm_init(void); 73 72 extern void arch_post_mm_init(void);
Note:
See TracChangeset
for help on using the changeset viewer.