Changeset f52e54da in mainline
- Timestamp:
- 2006-04-14T09:08:10Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9e1b581
- Parents:
- 9c1ecf9
- Files:
-
- 7 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
r9c1ecf9 rf52e54da 89 89 arch/$(ARCH)/src/pm.c \ 90 90 arch/$(ARCH)/src/context.S \ 91 arch/$(ARCH)/src/ddi/ddi.c \ 91 92 arch/$(ARCH)/src/drivers/ega.c \ 92 93 arch/$(ARCH)/src/drivers/i8254.c \ -
arch/ia32/Makefile.inc
r9c1ecf9 rf52e54da 128 128 arch/$(ARCH)/src/mm/page.c \ 129 129 arch/$(ARCH)/src/mm/tlb.c \ 130 arch/$(ARCH)/src/ddi/ddi.c \ 130 131 arch/$(ARCH)/src/drivers/i8254.c \ 131 132 arch/$(ARCH)/src/drivers/i8259.c \ -
arch/ia64/Makefile.inc
r9c1ecf9 rf52e54da 86 86 arch/$(ARCH)/src/mm/tlb.c \ 87 87 arch/$(ARCH)/src/proc/scheduler.c \ 88 arch/$(ARCH)/src/ddi/ddi.c \ 88 89 arch/$(ARCH)/src/drivers/it.c -
arch/mips32/Makefile.inc
r9c1ecf9 rf52e54da 126 126 arch/$(ARCH)/src/mm/as.c \ 127 127 arch/$(ARCH)/src/fpu_context.c \ 128 arch/$(ARCH)/src/ddi/ddi.c \ 128 129 arch/$(ARCH)/src/drivers/arc.c \ 129 130 arch/$(ARCH)/src/drivers/msim.c \ -
arch/ppc32/Makefile.inc
r9c1ecf9 rf52e54da 69 69 arch/$(ARCH)/src/cpu/cpu.c \ 70 70 arch/$(ARCH)/src/proc/scheduler.c \ 71 arch/$(ARCH)/src/ddi/ddi.c \ 71 72 arch/$(ARCH)/src/drivers/cuda.c \ 72 73 arch/$(ARCH)/src/mm/as.c \ -
arch/ppc64/Makefile.inc
r9c1ecf9 rf52e54da 68 68 arch/$(ARCH)/src/asm.S \ 69 69 arch/$(ARCH)/src/cpu/cpu.c \ 70 arch/$(ARCH)/src/ddi/ddi.c \ 70 71 arch/$(ARCH)/src/proc/scheduler.c \ 71 72 arch/$(ARCH)/src/mm/as.c \ -
arch/sparc64/Makefile.inc
r9c1ecf9 rf52e54da 90 90 arch/$(ARCH)/src/trap/exception.c \ 91 91 arch/$(ARCH)/src/trap/interrupt.c \ 92 arch/$(ARCH)/src/ddi/ddi.c \ 92 93 arch/$(ARCH)/src/drivers/tick.c -
generic/include/ddi/ddi.h
r9c1ecf9 rf52e54da 32 32 #include <ddi/ddi_arg.h> 33 33 #include <arch/types.h> 34 #include <typedefs.h> 34 35 35 extern __native sys_map_physmem(ddi_arg_t *uspace_ddi_arg); 36 extern __native sys_map_physmem(ddi_memarg_t *uspace_mem_arg); 37 extern __native sys_enable_iospace(ddi_ioarg_t *uspace_io_arg); 38 39 /* 40 * Interface to be implemented by all architectures. 41 */ 42 extern int ddi_enable_iospace_arch(task_t *task, __address ioaddr, size_t size); 36 43 37 44 #endif -
generic/include/ddi/ddi_arg.h
r9c1ecf9 rf52e54da 37 37 unsigned long pages; /** Number of pages to map. */ 38 38 int writable; /** True if the mapping should be writable. */ 39 } ddi_arg_t; 39 } ddi_memarg_t; 40 41 /** Structure encapsulating arguments for SYS_ENABLE_IOSPACE syscall. */ 42 typedef struct { 43 unsigned long long task_id; /** ID of the destination task. */ 44 void *ioaddr; /** Starting I/O space address. */ 45 unsigned long size; /** Number of bytes. */ 46 } ddi_ioarg_t; 40 47 41 48 #endif -
generic/include/syscall/syscall.h
r9c1ecf9 rf52e54da 50 50 SYS_IPC_HANGUP, 51 51 SYS_MAP_PHYSMEM, 52 SYS_ENABLE_IOSPACE, 52 53 SYSCALL_END 53 54 } syscall_t; -
generic/src/ddi/ddi.c
r9c1ecf9 rf52e54da 112 112 } 113 113 114 /** Enable range of I/O space for task. 115 * 116 * @param id Task ID of the destination task. 117 * @param ioaddr Starting I/O address. 118 * @param size Size of the enabled I/O space.. 119 * 120 * @return 0 on success, EPERM if the caller lacks capabilities to use this syscall, 121 * ENOENT if there is no task matching the specified ID. 122 */ 123 static int ddi_enable_iospace(task_id_t id, __address ioaddr, size_t size) 124 { 125 ipl_t ipl; 126 cap_t caps; 127 task_t *t; 128 int rc; 129 130 /* 131 * Make sure the caller is authorised to make this syscall. 132 */ 133 caps = cap_get(TASK); 134 if (!(caps & CAP_IO_MANAGER)) 135 return EPERM; 136 137 ipl = interrupts_disable(); 138 spinlock_lock(&tasks_lock); 139 140 t = task_find_by_id(id); 141 142 if (!t) { 143 /* 144 * There is no task with the specified ID. 145 */ 146 spinlock_unlock(&tasks_lock); 147 interrupts_restore(ipl); 148 return ENOENT; 149 } 150 151 /* 152 * TODO: We are currently lacking support for task destroying. 153 * Once it is added to the kernel, we must take care to 154 * synchronize in a way that prevents race conditions here. 155 */ 156 157 /* Lock the task and release the lock protecting tasks_btree. */ 158 spinlock_lock(&t->lock); 159 spinlock_unlock(&tasks_lock); 160 161 rc = ddi_enable_iospace_arch(t, ioaddr, size); 162 163 spinlock_unlock(&t->lock); 164 interrupts_restore(ipl); 165 return rc; 166 } 167 114 168 /** Wrapper for SYS_MAP_PHYSMEM syscall. 169 * 170 * @param User space address of memory DDI argument structure. 171 * 172 * @return 0 on success, otherwise it returns error code found in errno.h 173 */ 174 __native sys_map_physmem(ddi_memarg_t *uspace_mem_arg) 175 { 176 ddi_memarg_t arg; 177 178 copy_from_uspace(&arg, uspace_mem_arg, sizeof(ddi_memarg_t)); 179 return (__native) ddi_map_physmem((task_id_t) arg.task_id, ALIGN_DOWN((__address) arg.phys_base, FRAME_SIZE), 180 ALIGN_DOWN((__address) arg.virt_base, PAGE_SIZE), (count_t) arg.pages, 181 (bool) arg.writable); 182 } 183 184 /** Wrapper for SYS_ENABLE_IOSPACE syscall. 115 185 * 116 186 * @param User space address of DDI argument structure. … … 118 188 * @return 0 on success, otherwise it returns error code found in errno.h 119 189 */ 120 __native sys_ map_physmem(ddi_arg_t *uspace_ddi_arg)190 __native sys_enable_iospace(ddi_ioarg_t *uspace_io_arg) 121 191 { 122 ddi_ arg_t arg;192 ddi_ioarg_t arg; 123 193 124 copy_from_uspace(&arg, uspace_ddi_arg, sizeof(ddi_arg_t)); 125 return (__native) ddi_map_physmem((task_id_t) arg.task_id, ALIGN_DOWN((__address) arg.phys_base, FRAME_SIZE), 126 ALIGN_DOWN((__address) arg.virt_base, PAGE_SIZE), (count_t) arg.pages, 127 (bool) arg.writable); 194 copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t)); 195 return (__native) ddi_enable_iospace((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size); 128 196 } -
generic/src/syscall/syscall.c
r9c1ecf9 rf52e54da 94 94 sys_ipc_wait_for_call, 95 95 sys_ipc_hangup, 96 sys_map_physmem 96 sys_map_physmem, 97 sys_enable_iospace 97 98 };
Note:
See TracChangeset
for help on using the changeset viewer.