Changeset 80cd7cd in mainline for kernel/generic
- Timestamp:
- 2011-01-13T20:58:24Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 87e373b
- Parents:
- eaef141 (diff), a613fea1 (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:
- kernel/generic
- Files:
-
- 13 edited
-
include/ddi/ddi.h (modified) (1 diff)
-
include/ddi/irq.h (modified) (3 diffs)
-
include/interrupt.h (modified) (1 diff)
-
include/proc/task.h (modified) (1 diff)
-
include/syscall/syscall.h (modified) (2 diffs)
-
src/ddi/ddi.c (modified) (1 diff)
-
src/interrupt/interrupt.c (modified) (1 diff)
-
src/ipc/ipc.c (modified) (1 diff)
-
src/ipc/irq.c (modified) (1 diff)
-
src/main/main.c (modified) (2 diffs)
-
src/mm/slab.c (modified) (2 diffs)
-
src/proc/task.c (modified) (1 diff)
-
src/syscall/syscall.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ddi/ddi.h
reaef141 r80cd7cd 54 54 extern sysarg_t sys_physmem_map(sysarg_t, sysarg_t, sysarg_t, sysarg_t); 55 55 extern sysarg_t sys_iospace_enable(ddi_ioarg_t *); 56 extern sysarg_t sys_interrupt_enable(int irq, int enable);57 56 58 57 /* -
kernel/generic/include/ddi/irq.h
reaef141 r80cd7cd 54 54 /** Read 4 bytes from the I/O space. */ 55 55 CMD_PIO_READ_32, 56 56 57 /** Write 1 byte to the I/O space. */ 57 58 CMD_PIO_WRITE_8, … … 62 63 63 64 /** 64 * Perform a bit test on the source argument and store the result into 65 * the destination argument. 65 * Write 1 byte from the source argument 66 * to the I/O space. 67 */ 68 CMD_PIO_WRITE_A_8, 69 /** 70 * Write 2 bytes from the source argument 71 * to the I/O space. 72 */ 73 CMD_PIO_WRITE_A_16, 74 /** 75 * Write 4 bytes from the source argument 76 * to the I/O space. 77 */ 78 CMD_PIO_WRITE_A_32, 79 80 /** 81 * Perform a bit masking on the source argument 82 * and store the result into the destination argument. 66 83 */ 67 84 CMD_BTEST, 68 85 69 86 /** 70 * Predicate the execution of the following N commands by the boolean 71 * value of the source argument. 87 * Predicate the execution of the following 88 * N commands by the boolean value of the source 89 * argument. 72 90 */ 73 91 CMD_PREDICATE, … … 75 93 /** Accept the interrupt. */ 76 94 CMD_ACCEPT, 95 77 96 /** Decline the interrupt. */ 78 97 CMD_DECLINE, -
kernel/generic/include/interrupt.h
reaef141 r80cd7cd 60 60 extern void fault_if_from_uspace(istate_t *, const char *, ...) 61 61 PRINTF_ATTRIBUTE(2, 3); 62 extern istate_t *istate_get(thread_t *); 62 63 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t); 63 64 extern void exc_dispatch(unsigned int, istate_t *); -
kernel/generic/include/proc/task.h
reaef141 r80cd7cd 154 154 155 155 extern sysarg_t sys_task_set_name(const char *, size_t); 156 extern sysarg_t sys_task_kill(task_id_t *); 156 157 157 158 #endif -
kernel/generic/include/syscall/syscall.h
reaef141 r80cd7cd 47 47 SYS_TASK_GET_ID, 48 48 SYS_TASK_SET_NAME, 49 SYS_TASK_KILL, 49 50 SYS_PROGRAM_SPAWN_LOADER, 50 51 … … 81 82 SYS_PHYSMEM_MAP, 82 83 SYS_IOSPACE_ENABLE, 83 SYS_INTERRUPT_ENABLE,84 84 85 85 SYS_SYSINFO_GET_TAG, -
kernel/generic/src/ddi/ddi.c
reaef141 r80cd7cd 258 258 } 259 259 260 /** Disable or enable specified interrupts.261 *262 * @param irq the interrupt to be enabled/disabled.263 * @param enable if true enable the interrupt, disable otherwise.264 *265 * @retutn Zero on success, error code otherwise.266 */267 sysarg_t sys_interrupt_enable(int irq, int enable)268 {269 /* FIXME: this needs to be generic code, or better not be in kernel at all. */270 #if 0271 cap_t task_cap = cap_get(TASK);272 if (!(task_cap & CAP_IRQ_REG))273 return EPERM;274 275 if (irq < 0 || irq > 16) {276 return EINVAL;277 }278 279 uint16_t irq_mask = (uint16_t)(1 << irq);280 if (enable) {281 trap_virtual_enable_irqs(irq_mask);282 } else {283 trap_virtual_disable_irqs(irq_mask);284 }285 286 #endif287 return 0;288 }289 290 260 /** @} 291 261 */ -
kernel/generic/src/interrupt/interrupt.c
reaef141 r80cd7cd 209 209 } 210 210 211 /** Get istate structure of a thread. 212 * 213 * Get pointer to the istate structure at the bottom of the kernel stack. 214 * 215 * This function can be called in interrupt or user context. In interrupt 216 * context the istate structure is created by the low-level exception 217 * handler. In user context the istate structure is created by the 218 * low-level syscall handler. 219 */ 220 istate_t *istate_get(thread_t *thread) 221 { 222 /* 223 * The istate structure should be right at the bottom of the kernel 224 * stack. 225 */ 226 return (istate_t *) ((uint8_t *) thread->kstack + THREAD_STACK_SIZE - 227 sizeof(istate_t)); 228 } 229 211 230 #ifdef CONFIG_KCONSOLE 212 231 -
kernel/generic/src/ipc/ipc.c
reaef141 r80cd7cd 706 706 break; 707 707 case IPC_PHONE_CONNECTED: 708 printf("connected to: %p ", 709 task->phones[i].callee); 708 printf("connected to: %p (%" PRIu64 ") ", 709 task->phones[i].callee, 710 task->phones[i].callee->task->taskid); 710 711 break; 711 712 case IPC_PHONE_SLAMMED: -
kernel/generic/src/ipc/irq.c
reaef141 r80cd7cd 404 404 (uint32_t) code->cmds[i].value); 405 405 break; 406 case CMD_PIO_WRITE_A_8: 407 if (srcarg) { 408 pio_write_8((ioport8_t *) code->cmds[i].addr, 409 (uint8_t) scratch[srcarg]); 410 } 411 break; 412 case CMD_PIO_WRITE_A_16: 413 if (srcarg) { 414 pio_write_16((ioport16_t *) code->cmds[i].addr, 415 (uint16_t) scratch[srcarg]); 416 } 417 break; 418 case CMD_PIO_WRITE_A_32: 419 if (srcarg) { 420 pio_write_32((ioport32_t *) code->cmds[i].addr, 421 (uint32_t) scratch[srcarg]); 422 } 423 break; 406 424 case CMD_BTEST: 407 425 if ((srcarg) && (dstarg)) { -
kernel/generic/src/main/main.c
reaef141 r80cd7cd 185 185 LOG("\nconfig.base=%p config.kernel_size=%zu" 186 186 "\nconfig.stack_base=%p config.stack_size=%zu", 187 config.base, config.kernel_size, config.stack_base,188 config.stack_size);187 (void *) config.base, config.kernel_size, 188 (void *) config.stack_base, config.stack_size); 189 189 190 190 #ifdef CONFIG_KCONSOLE … … 242 242 for (i = 0; i < init.cnt; i++) 243 243 LOG("init[%zu].addr=%p, init[%zu].size=%zu", 244 i, init.tasks[i].addr, i, init.tasks[i].size);244 i, (void *) init.tasks[i].addr, i, init.tasks[i].size); 245 245 } else 246 246 printf("No init binaries found.\n"); -
kernel/generic/src/mm/slab.c
reaef141 r80cd7cd 806 806 } 807 807 808 /** Go through all caches and reclaim what is possible 809 * 810 * Interrupts must be disabled before calling this function, 811 * otherwise memory allocation from interrupts can deadlock. 812 * 813 */ 808 /** Go through all caches and reclaim what is possible */ 814 809 size_t slab_reclaim(unsigned int flags) 815 810 { 816 irq_spinlock_lock(&slab_cache_lock, false);811 irq_spinlock_lock(&slab_cache_lock, true); 817 812 818 813 size_t frames = 0; … … 824 819 } 825 820 826 irq_spinlock_unlock(&slab_cache_lock, false);821 irq_spinlock_unlock(&slab_cache_lock, true); 827 822 828 823 return frames; -
kernel/generic/src/proc/task.c
reaef141 r80cd7cd 360 360 } 361 361 362 /** Syscall to forcefully terminate a task 363 * 364 * @param uspace_taskid Pointer to task ID in user space. 365 * 366 * @return 0 on success or an error code from @ref errno.h. 367 * 368 */ 369 sysarg_t sys_task_kill(task_id_t *uspace_taskid) 370 { 371 task_id_t taskid; 372 int rc; 373 374 rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid)); 375 if (rc != 0) 376 return (sysarg_t) rc; 377 378 return (sysarg_t) task_kill(taskid); 379 } 380 362 381 /** Find task structure corresponding to task ID. 363 382 * -
kernel/generic/src/syscall/syscall.c
reaef141 r80cd7cd 45 45 #include <debug.h> 46 46 #include <ddi/device.h> 47 #include <interrupt.h> 47 48 #include <ipc/sysipc.h> 48 49 #include <synch/futex.h> … … 66 67 #ifdef CONFIG_UDEBUG 67 68 /* 69 * An istate_t-compatible record was created on the stack by the 70 * low-level syscall handler. This is the userspace space state 71 * structure. 72 */ 73 THREAD->udebug.uspace_state = istate_get(THREAD); 74 75 /* 68 76 * Early check for undebugged tasks. We do not lock anything as this 69 77 * test need not be precise in either direction. 70 *71 78 */ 72 79 if (THREAD->udebug.active) … … 98 105 udebug_stoppable_end(); 99 106 } 107 108 /* Clear userspace state pointer */ 109 THREAD->udebug.uspace_state = NULL; 100 110 #endif 101 111 … … 120 130 (syshandler_t) sys_task_get_id, 121 131 (syshandler_t) sys_task_set_name, 132 (syshandler_t) sys_task_kill, 122 133 (syshandler_t) sys_program_spawn_loader, 123 134 … … 160 171 (syshandler_t) sys_physmem_map, 161 172 (syshandler_t) sys_iospace_enable, 162 (syshandler_t) sys_interrupt_enable,163 173 164 174 /* Sysinfo syscalls */
Note:
See TracChangeset
for help on using the changeset viewer.
