Changeset 393f631 in mainline
- Timestamp:
- 2005-08-31T21:51:04Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33ccb2c
- Parents:
- 94f0ae4
- Files:
-
- 10 added
- 11 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
arch/ppc/Makefile.inc
r94f0ae4 r393f631 13 13 CPPFLAGS=$(DEFS) -nostdinc -I../include 14 14 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O2 15 LFLAGS=-M -no-check-sections - T ../arch/ppc/_link.ld15 LFLAGS=-M -no-check-sections -N -T ../arch/ppc/_link.ld 16 16 17 17 arch_sources= \ … … 19 19 arch/debug/panic.s \ 20 20 arch/fpu_context.c \ 21 arch/ppc.c \ 21 22 arch/dummy.s \ 22 23 arch/start.S \ 23 arch/asm.s \ 24 arch/asm.S \ 25 arch/cpu/cpu.c \ 24 26 arch/mm/frame.c \ 25 27 arch/mm/memory_init.c \ -
arch/ppc/_link.ld
r94f0ae4 r393f631 24 24 *(.data); /* initialized data */ 25 25 *(.sdata); 26 *(.sdata2); 26 27 *(.sbss); 27 28 *(.bss); /* uninitialized static variables */ -
arch/ppc/boot/Makefile
r94f0ae4 r393f631 9 9 cp boot.bin ../../../src/load.bin 10 10 11 CC=$(PPC_BINUTILS_DIR)/$(PPC_TARGET)-gcc 11 12 AS=$(PPC_BINUTILS_DIR)/$(PPC_TARGET)-as 12 13 LD=$(PPC_BINUTILS_DIR)/$(PPC_TARGET)-ld 13 14 14 ASFLAGS= 15 LFLAGS=--oformat=binary -e start 15 CPPFLAGS=$(DEFS) -nostdinc -I../include 16 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O2 17 LFLAGS=-no-check-sections -N -T _link.ld 16 18 17 boot.bin: boot.o 18 $(LD) $(LFLAGS) boot.o -o $@19 boot.bin: boot.o main.o 20 $(LD) $(LFLAGS) boot.o main.o -o $@ 19 21 20 boot.o: 21 $(AS) boot.s -o $@ 22 boot.o: boot.S 23 $(CC) $(CFLAGS) -c boot.S -o $@ 24 25 main.o: main.c 26 $(CC) $(CFLAGS) -c main.c -o $@ 22 27 23 28 clean: -
arch/ppc/boot/boot.S
r94f0ae4 r393f631 27 27 # 28 28 29 .text 29 #include <asm/macro.h> 30 31 .section BOOTSTRAP 30 32 31 33 .global start 34 32 35 start: 33 36 lis r4, ofw@ha 37 addi r4, r4, ofw@l 38 stw r5, 0(r4) 39 40 bl init 41 42 b bootstrap -
arch/ppc/include/asm.h
r94f0ae4 r393f631 79 79 "mfmsr %%r31\n" 80 80 "rlwimi %0, %%r31, 0, 17, 15\n" 81 "cmpw 0, %0, %%r31\n" 82 "beq 0f\n" 81 83 "mtmsr %0\n" 84 "0:\n" 82 85 : "=r" (pri) 83 86 : "0" (pri) 84 87 : "%r31" 85 88 ); 89 } 90 91 /** Return raw priority level 92 * 93 * Return EE. 94 */ 95 static inline pri_t cpu_priority_read(void) { 96 pri_t v; 97 __asm__ volatile ( 98 "mfmsr %0\n" 99 : "=r" (v) 100 ); 101 return v; 86 102 } 87 103 -
arch/ppc/include/context.h
r94f0ae4 r393f631 31 31 32 32 #include <arch/types.h> 33 #include <arch/drivers/ofw.h>34 33 35 34 #define SP_DELTA 8 36 37 #ifdef context_map_stack38 #undef context_map_stack39 #endif40 41 #define context_map_stack(stack, size) \42 ofw_claim((void *) stack, size, 0);43 35 44 36 struct context { -
arch/ppc/src/asm.S
r94f0ae4 r393f631 33 33 .global cpu_halt 34 34 .global cpu_sleep 35 .global memsetb 36 .global memcpy 35 37 36 38 cpu_halt: … … 39 41 cpu_sleep: 40 42 b cpu_sleep 43 44 memsetb: 45 rlwimi r5, r5, 8, 16, 23 46 rlwimi r5, r5, 16, 0, 15 47 48 addi r14, r3, -4 49 50 cmplwi 0, r4, 4 51 blt 7f 52 53 stwu r5, 4(r14) 54 beqlr 55 56 andi. r15, r14, 3 57 add r4, r15, r4 58 subf r14, r15, r14 59 srwi r15, r4, 2 60 mtctr r15 61 62 bdz 6f 63 64 1: 65 stwu r5, 4(r14) 66 bdnz 1b 67 68 6: 69 70 andi. r4, r4, 3 71 72 7: 73 74 cmpwi 0, r4, 0 75 beqlr 76 77 mtctr r4 78 addi r6, r6, 3 79 80 8: 81 82 stbu r5, 1(r14) 83 bdnz 8b 84 85 blr 86 87 memcpy: 88 # TODO 89 blr -
arch/ppc/src/drivers/ofw.c
r94f0ae4 r393f631 42 42 ofw_done(); 43 43 44 if (ofw_ call("getprop", 4, 1, ofw_chosen, "stdout",&ofw_stdout, sizeof(ofw_stdout)) <= 0)44 if (ofw_get_property(ofw_chosen, "stdout", &ofw_stdout, sizeof(ofw_stdout)) <= 0) 45 45 ofw_stdout = 0; 46 46 } -
arch/ppc/src/dummy.s
r94f0ae4 r393f631 29 29 .text 30 30 31 .global memcpy 32 .global cpu_priority_read 33 .global memsetb 31 .global asm_delay_loop 34 32 .global userspace 35 33 .global before_thread_runs_arch 36 .global cpu_sleep37 .global cpu_identify38 .global cpu_arch_init39 .global cpu_print_report40 .global arch_pre_mm_init41 .global arch_post_mm_init42 .global arch_late_init43 .global calibrate_delay_loop44 .global asm_delay_loop45 34 .global dummy 46 35 47 memcpy:48 cpu_priority_read:49 memsetb:50 36 before_thread_runs_arch: 51 37 userspace: 52 calibrate_delay_loop:53 38 asm_delay_loop: 54 cpu_identify:55 cpu_arch_init:56 cpu_print_report:57 arch_pre_mm_init:58 arch_post_mm_init:59 arch_late_init:60 calibrate_delay_loop:61 39 62 40 dummy: -
include/arch.h
r94f0ae4 r393f631 44 44 #define TASK THE->task 45 45 46 #ifndef early_mapping 47 #define early_mapping(stack, size) 48 #endif /* early_mapping */ 49 46 50 /* 47 51 * For each possible kernel stack, structure -
include/context.h
r94f0ae4 r393f631 39 39 #endif /* context_set */ 40 40 41 #ifndef context_map_stack42 #define context_map_stack(stack, size)43 #endif /* context_map_stack */44 45 41 extern int context_save(context_t *c); 46 42 extern void context_restore(context_t *c) __attribute__ ((noreturn)); -
src/main/main.c
r94f0ae4 r393f631 54 54 #include <synch/waitq.h> 55 55 56 #include <arch/arch.h> 56 57 #include <arch.h> 57 58 #include <arch/faddr.h> … … 107 108 config.cpu_count = 1; 108 109 config.cpu_active = 1; 109 110 110 111 kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE; 111 112 heap_delta = PAGE_SIZE - ((hardcoded_load_address + kernel_size) % PAGE_SIZE); 112 113 heap_delta = (heap_delta == PAGE_SIZE) ? 0 : heap_delta; 113 114 kernel_size += heap_delta; 114 115 115 116 config.base = hardcoded_load_address; 116 117 config.memory_size = get_memory_size(); 117 118 config.kernel_size = kernel_size + CONFIG_STACK_SIZE; 118 119 119 120 context_save(&ctx); 121 early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + CONFIG_HEAP_SIZE); 120 122 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); 121 context_map_stack(config.base + kernel_size, CONFIG_STACK_SIZE);122 123 context_restore(&ctx); 123 124 /* not reached */ … … 158 159 cpu_init(); 159 160 calibrate_delay_loop(); 160 161 161 162 timeout_init(); 162 163 scheduler_init(); … … 168 169 */ 169 170 m = vm_create(GET_PTL0_ADDRESS()); 170 if (!m) panic("can't create kernel vm address space\n"); 171 if (!m) 172 panic("can't create kernel vm address space\n"); 171 173 172 174 /* … … 174 176 */ 175 177 k = task_create(m); 176 if (!k) panic("can't create kernel task\n"); 177 178 if (!k) 179 panic("can't create kernel task\n"); 180 178 181 /* 179 182 * Create the first thread. 180 183 */ 181 184 t = thread_create(kinit, NULL, k, 0); 182 if (!t) panic("can't create kinit thread\n"); 185 if (!t) 186 panic("can't create kinit thread\n"); 183 187 thread_ready(t); 184 188 -
src/proc/thread.c
r94f0ae4 r393f631 186 186 spinlock_unlock(&tidlock); 187 187 cpu_priority_restore(pri); 188 188 189 189 memsetb(frame_ks, THREAD_STACK_SIZE, 0); 190 190 link_initialize(&t->rq_link); … … 194 194 t->kstack = (__u8 *) frame_ks; 195 195 t->ustack = (__u8 *) frame_us; 196 197 196 198 197 context_save(&t->saved_context);
Note:
See TracChangeset
for help on using the changeset viewer.