Changeset 4e49572 in mainline
- Timestamp:
- 2006-03-17T11:41:05Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 23d22eb
- Parents:
- 5a7d9d1
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r5a7d9d1 r4e49572 69 69 ifeq ($(CONFIG_DEBUG_SPINLOCK),y) 70 70 DEFS += -DCONFIG_DEBUG_SPINLOCK 71 endif 72 ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y) 73 DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT 71 74 endif 72 75 ifeq ($(CONFIG_FPU_LAZY),y) … … 136 139 generic/src/smp/ipi.c \ 137 140 generic/src/ipc/ipc.c \ 138 generic/src/ipc/sysipc.c 141 generic/src/ipc/sysipc.c \ 142 generic/src/ipc/ipcrsc.c 139 143 140 144 ## Test sources -
arch/amd64/Makefile.inc
r5a7d9d1 r4e49572 104 104 arch/$(ARCH)/src/proc/scheduler.c \ 105 105 arch/$(ARCH)/src/userspace.c \ 106 arch/$(ARCH)/src/syscall.c 106 arch/$(ARCH)/src/syscall.c \ 107 arch/$(ARCH)/src/debugger.c 107 108 108 109 ifeq ($(CONFIG_SMP),y) -
arch/amd64/include/asm.h
r5a7d9d1 r4e49572 142 142 } 143 143 144 /** Read CR0145 *146 * Return value in CR0147 *148 * @return Value read.149 */150 static inline __u64 read_cr0(void)151 {152 __u64 v;153 __asm__ volatile ("movq %%cr0,%0\n" : "=r" (v));154 return v;155 }156 157 /** Read CR2158 *159 * Return value in CR2160 *161 * @return Value read.162 */163 static inline __u64 read_cr2(void)164 {165 __u64 v;166 __asm__ volatile ("movq %%cr2,%0\n" : "=r" (v));167 return v;168 }169 170 /** Write CR3171 *172 * Write value to CR3.173 *174 * @param v Value to be written.175 */176 static inline void write_cr3(__u64 v)177 {178 __asm__ volatile ("movq %0,%%cr3\n" : : "r" (v));179 }180 181 /** Read CR3182 *183 * Return value in CR3184 *185 * @return Value read.186 */187 static inline __u64 read_cr3(void)188 {189 __u64 v;190 __asm__ volatile ("movq %%cr3,%0" : "=r" (v));191 return v;192 }193 194 144 /** Write to MSR */ 195 145 static inline void write_msr(__u32 msr, __u64 value) … … 251 201 } 252 202 203 #define GEN_READ_REG(reg) static inline __native read_ ##reg (void) \ 204 { \ 205 __native res; \ 206 __asm__ volatile ("movq %%" #reg ", %0" : "=r" (res) ); \ 207 return res; \ 208 } 209 210 #define GEN_WRITE_REG(reg) static inline void write_ ##reg (__native regn) \ 211 { \ 212 __asm__ volatile ("movq %0, %%" #reg : : "r" (regn)); \ 213 } 214 215 GEN_READ_REG(cr0); 216 GEN_READ_REG(cr2); 217 GEN_READ_REG(cr3); 218 GEN_WRITE_REG(cr3); 219 220 GEN_READ_REG(dr0); 221 GEN_READ_REG(dr1); 222 GEN_READ_REG(dr2); 223 GEN_READ_REG(dr3); 224 GEN_READ_REG(dr6); 225 GEN_READ_REG(dr7); 226 227 GEN_WRITE_REG(dr0); 228 GEN_WRITE_REG(dr1); 229 GEN_WRITE_REG(dr2); 230 GEN_WRITE_REG(dr3); 231 GEN_WRITE_REG(dr6); 232 GEN_WRITE_REG(dr7); 233 234 253 235 extern size_t interrupt_handler_size; 254 236 extern void interrupt_handlers(void); -
arch/amd64/include/cpu.h
r5a7d9d1 r4e49572 30 30 #define __amd64_CPU_H__ 31 31 32 #define RFLAGS_RF (1 << 16) 32 33 33 34 #define EFER_MSR_NUM 0xc0000080 -
arch/amd64/include/interrupt.h
r5a7d9d1 r4e49572 54 54 #endif 55 55 56 #define VECTOR_DEBUG 1 56 57 #define VECTOR_PIC_SPUR (IVT_IRQBASE+IRQ_PIC_SPUR) 57 58 #define VECTOR_CLK (IVT_IRQBASE+IRQ_CLK) -
arch/amd64/src/amd64.c
r5a7d9d1 r4e49572 47 47 #include <interrupt.h> 48 48 #include <arch/syscall.h> 49 #include <arch/debugger.h> 49 50 50 51 /** Disable I/O on non-privileged levels … … 130 131 if (config.cpu_active == 1) { 131 132 ega_init(); /* video */ 133 /* Enable debugger */ 134 debugger_init(); 132 135 } 133 136 /* Setup fast SYSCALL/SYSRET */ 134 137 syscall_setup_cpu(); 135 138 136 139 } 137 140 -
arch/amd64/src/proc/scheduler.c
r5a7d9d1 r4e49572 33 33 #include <arch/context.h> /* SP_DELTA */ 34 34 #include <arch/asm.h> 35 #include <arch/debugger.h> 35 36 36 37 void before_thread_runs_arch(void) … … 43 44 (__u64)&THREAD->kstack); 44 45 swapgs(); 46 47 48 #ifdef CONFIG_DEBUG_AS_WATCHPOINT 49 /* Set watchpoint on AS to ensure that nobody sets it to zero */ 50 static int old_slot = -1; 51 if (old_slot >=0) 52 breakpoint_del(old_slot); 53 old_slot = breakpoint_add(&((the_t *) THREAD->kstack)->as, 54 BKPOINT_WRITE | BKPOINT_CHECK_ZERO); 55 #endif 45 56 } 46 57 -
generic/include/ipc/ipc.h
r5a7d9d1 r4e49572 177 177 178 178 extern answerbox_t *ipc_phone_0; 179 extern void ipc_cleanup(task_t *task); 179 180 180 181 #endif -
generic/src/console/cmd.c
r5a7d9d1 r4e49572 303 303 }; 304 304 305 static int cmd_hello(cmd_arg_t *argv);306 static cmd_info_t hello_info = {307 .name = "hello",308 .description = "Hello Message",309 .func = cmd_hello,310 .argc = 0311 };312 313 305 /** Data and methods for 'cpus' command. */ 314 306 static int cmd_cpus(cmd_arg_t *argv); … … 353 345 &zones_info, 354 346 &zone_info, 355 &hello_info,356 347 NULL 357 348 }; … … 706 697 return 1; 707 698 } 708 709 710 int cmd_hello(cmd_arg_t *argv)711 {712 printf("\nHello, World !!!\n");713 return 1;714 } -
generic/src/ipc/ipc.c
r5a7d9d1 r4e49572 244 244 NULL, NULL, 0); 245 245 } 246 247 /** Cleans up all IPC communication of the given task 248 * 249 * 250 */ 251 void ipc_cleanup(task_t *task) 252 { 253 /* Cancel all calls in my dispatch queue */ 254 255 } -
generic/src/ipc/sysipc.c
r5a7d9d1 r4e49572 36 36 #include <ipc/ipc.h> 37 37 #include <ipc/sysipc.h> 38 #include <ipc/ipcrsc.h> 38 39 39 40 … … 63 64 { 64 65 return 1; 65 }66 67 /** Find call_t * in call table according to callid68 *69 * @return NULL on not found, otherwise pointer to call structure70 */71 static inline call_t * get_call(__native callid)72 {73 /* TODO: Traverse list of dispatched calls and find one */74 /* TODO: locking of call, ripping it from dispatched calls etc. */75 return (call_t *) callid;76 }77 78 /** Return pointer to phone identified by phoneid or NULL if non-existent */79 static phone_t * get_phone(__native phoneid)80 {81 phone_t *phone;82 83 if (phoneid >= IPC_MAX_PHONES)84 return NULL;85 86 phone = &TASK->phones[phoneid];87 if (!phone->callee)88 return NULL;89 return phone;90 }91 92 /** Allocate new phone slot in current TASK structure */93 static int phone_alloc(void)94 {95 int i;96 97 spinlock_lock(&TASK->lock);98 99 for (i=0; i < IPC_MAX_PHONES; i++) {100 if (!TASK->phones[i].busy) {101 TASK->phones[i].busy = 1;102 break;103 }104 }105 spinlock_unlock(&TASK->lock);106 107 if (i >= IPC_MAX_PHONES)108 return -1;109 return i;110 }111 112 /** Disconnect phone */113 static void phone_dealloc(int phoneid)114 {115 spinlock_lock(&TASK->lock);116 117 ASSERT(TASK->phones[phoneid].busy);118 119 if (TASK->phones[phoneid].callee)120 ipc_phone_destroy(&TASK->phones[phoneid]);121 122 TASK->phones[phoneid].busy = 0;123 spinlock_unlock(&TASK->lock);124 }125 126 static void phone_connect(int phoneid, answerbox_t *box)127 {128 phone_t *phone = &TASK->phones[phoneid];129 130 ipc_phone_connect(phone, box);131 66 } 132 67 … … 213 148 phone_t *phone; 214 149 215 phone = get_phone(phoneid);216 if (!phone)217 return ENOENT;218 219 150 if (is_system_method(method)) 220 151 return EPERM; 152 153 phone = get_phone_and_lock(phoneid); 154 if (!phone) 155 return ENOENT; 221 156 222 157 ipc_call_init(&call); … … 238 173 phone_t *phone; 239 174 240 phone = get_phone(phoneid);241 if (!phone)242 return ENOENT;243 244 175 ipc_call_init(&call); 245 176 copy_from_uspace(&call.data, question, sizeof(call.data)); … … 248 179 return EPERM; 249 180 181 phone = get_phone_and_lock(phoneid); 182 if (!phone) 183 return ENOENT; 184 250 185 ipc_call_sync(phone, &call); 251 186 … … 279 214 phone_t *phone; 280 215 281 phone = get_phone(phoneid);282 if (!phone)283 return IPC_CALLRET_FATAL;284 285 216 if (is_system_method(method)) 286 217 return IPC_CALLRET_FATAL; … … 288 219 if (check_call_limit()) 289 220 return IPC_CALLRET_TEMPORARY; 221 222 phone = get_phone_and_lock(phoneid); 223 if (!phone) 224 return IPC_CALLRET_FATAL; 290 225 291 226 call = ipc_call_alloc(); … … 308 243 phone_t *phone; 309 244 310 phone = get_phone(phoneid);311 if (!phone)312 return IPC_CALLRET_FATAL;313 314 245 if (check_call_limit()) 315 246 return IPC_CALLRET_TEMPORARY; 247 248 phone = get_phone_and_lock(phoneid); 249 if (!phone) 250 return IPC_CALLRET_FATAL; 316 251 317 252 call = ipc_call_alloc(); … … 345 280 return ENOENT; 346 281 347 phone = get_phone (phoneid);282 phone = get_phone_and_lock(phoneid); 348 283 if (!phone) { 349 284 IPC_SET_RETVAL(call->data, EFORWARD); … … 437 372 phone_t *phone; 438 373 439 phone = get_phone(phoneid);440 if (!phone)441 return ENOENT;442 443 374 ipc_call_init(&call); 444 375 IPC_SET_METHOD(call.data, IPC_M_CONNECTTOME); … … 446 377 IPC_SET_ARG2(call.data, arg2); 447 378 379 phone = get_phone_and_lock(phoneid); 380 if (!phone) 381 return ENOENT; 382 448 383 ipc_call_sync(phone, &call); 449 384 … … 467 402 int newphid; 468 403 469 phone = get_phone (phoneid);404 phone = get_phone_and_lock(phoneid); 470 405 if (!phone) 471 406 return ENOENT; -
kernel.config
r5a7d9d1 r4e49572 71 71 ! [CONFIG_DEBUG=y&CONFIG_SMP=y] CONFIG_DEBUG_SPINLOCK (y/n) 72 72 73 # Watchpoint on rewriting AS with zero 74 ! [CONFIG_DEBUG=y&ARCH=amd64] CONFIG_DEBUG_AS_WATCHPOINT (y/n) 75 73 76 ## Run-time configuration directives 74 77
Note:
See TracChangeset
for help on using the changeset viewer.