Changeset 7ce9284 in mainline
- Timestamp:
- 2005-08-30T17:41:19Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b45aa23
- Parents:
- 10caad0
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/cpu.h
r10caad0 r7ce9284 36 36 #include <arch/asm.h> 37 37 38 #ifdef __SMP__39 #define CPU_ID_ARCH (read_dr0())40 #else41 #define CPU_ID_ARCH (0)42 #endif43 44 38 struct cpu_arch { 45 39 int vendor; -
arch/ia32/include/asm.h
r10caad0 r7ce9284 84 84 static inline __u32 read_cr3(void) { __u32 v; __asm__ volatile ("movl %%cr3,%0" : "=r" (v)); return v; } 85 85 86 /** Write DR087 *88 * Write value to DR0.89 *90 * @param v Value to be written.91 */92 static inline void write_dr0(__u32 v) { __asm__ volatile ("movl %0,%%dr0\n" : : "r" (v)); }93 94 /** Read DR095 *96 * Return value in DR097 *98 * @return Value read.99 */100 static inline __u32 read_dr0(void) { __u32 v; __asm__ volatile ("movl %%dr0,%0" : "=r" (v)); return v; }101 102 86 /** Set priority level low 103 87 * -
arch/ia32/include/cpu.h
r10caad0 r7ce9284 34 34 #include <arch/asm.h> 35 35 36 #ifdef __SMP__37 #define CPU_ID_ARCH (read_dr0())38 #else39 #define CPU_ID_ARCH (0)40 #endif41 42 36 struct cpu_arch { 43 37 int vendor; -
arch/ia32/src/ia32.c
r10caad0 r7ce9284 52 52 pm_init(); 53 53 54 write_dr0(config.cpu_active - 1);55 56 54 if (config.cpu_active == 1) { 57 55 bios_init(); -
arch/ia64/include/cpu.h
r10caad0 r7ce9284 32 32 #include <typedefs.h> 33 33 34 #define CPU_ID_ARCH 035 36 34 struct cpu_arch { 37 35 }; -
arch/mips/include/cpu.h
r10caad0 r7ce9284 30 30 #define __mips_CPU_H__ 31 31 32 #define CPU_ID_ARCH 033 34 32 struct cpu_arch { 35 33 int imp_num; -
arch/ppc/include/cpu.h
r10caad0 r7ce9284 32 32 #include <typedefs.h> 33 33 34 #define CPU_ID_ARCH 035 36 34 struct cpu_arch { 37 35 }; -
include/arch.h
r10caad0 r7ce9284 40 40 #include <proc/task.h> 41 41 42 /* 43 * NOTE: 44 * CPU, THREAD and TASK are not preemption-safe. 45 * Provisions must be made to prevent preemption prior 46 * to using these macros. Simple cpu_priority_high() 47 * call will suffice. 48 */ 49 #define CPU (&cpus[CPU_ID_ARCH]) 50 #define THREAD (cpu_private_data[CPU_ID_ARCH].thread) 51 #define TASK (cpu_private_data[CPU_ID_ARCH].task) 42 #define CPU THE->cpu 43 #define THREAD THE->thread 44 #define TASK THE->task 52 45 53 46 /* -
include/cpu.h
r10caad0 r7ce9284 72 72 }; 73 73 74 /*75 * read/write by associated CPU76 * read only by other CPUs77 */78 struct cpu_private_data {79 thread_t *thread;80 task_t *task;81 };82 83 extern cpu_private_data_t *cpu_private_data;84 74 extern cpu_t *cpus; 85 75 -
src/Makefile.config
r10caad0 r7ce9284 21 21 22 22 # Uncomment if you want to run in the test mode 23 TEST=__TEST__23 #TEST=__TEST__ 24 24 25 25 TEST_FILE=test.c … … 34 34 #TEST_DIR=synch/semaphore2/ 35 35 #TEST_DIR=fpu/fpu1 36 TEST_DIR=print/print136 #TEST_DIR=print/print1 -
src/cpu/cpu.c
r10caad0 r7ce9284 40 40 #include <list.h> 41 41 42 43 cpu_private_data_t *cpu_private_data;44 42 cpu_t *cpus; 45 46 43 47 44 /** Initialize CPUs … … 56 53 if (config.cpu_active == 1) { 57 54 #endif /* __SMP__ */ 58 cpu_private_data = (cpu_private_data_t *) malloc(sizeof(cpu_private_data_t) * config.cpu_count);59 if (!cpu_private_data)60 panic("malloc/cpu_private_data");61 62 55 cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count); 63 56 if (!cpus) … … 65 58 66 59 /* initialize everything */ 67 memsetb((__address) cpu_private_data, sizeof(cpu_private_data_t) * config.cpu_count, 0);68 60 memsetb((__address) cpus, sizeof(cpu_t) * config.cpu_count, 0); 69 61 70 62 for (i=0; i < config.cpu_count; i++) { 71 cpus[i].stack = (__u8 *) malloc(CPU_STACK_SIZE);63 cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC); 72 64 if (!cpus[i].stack) 73 65 panic("malloc/cpus[%d].stack\n", i); … … 87 79 } 88 80 #endif /* __SMP__ */ 81 82 CPU = &cpus[config.cpu_active-1]; 89 83 90 84 CPU->active = 1; -
src/main/main.c
r10caad0 r7ce9284 180 180 t = thread_create(kinit, NULL, k, 0); 181 181 if (!t) panic("can't create kinit thread\n"); 182 183 182 thread_ready(t); 184 183 … … 211 210 config.cpu_active++; 212 211 212 /* 213 * The THE structure is well defined because ctx.sp is used as stack. 214 */ 215 the_initialize(THE); 216 213 217 arch_pre_mm_init(); 214 218 frame_init(); … … 222 226 l_apic_debug(); 223 227 228 the_copy(THE, (the_t *) CPU->stack); 224 229 225 230 /* -
src/proc/scheduler.c
r10caad0 r7ce9284 364 364 priority = THREAD->pri; 365 365 spinlock_unlock(&THREAD->lock); 366 366 367 367 relink_rq(priority); 368 368
Note:
See TracChangeset
for help on using the changeset viewer.