Changeset 8d6c1f1 in mainline for kernel/generic
- Timestamp:
- 2011-06-07T21:31:35Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75608143
- Parents:
- ff4f073 (diff), eb522e8 (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:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ddi/irq.h
rff4f073 r8d6c1f1 77 77 */ 78 78 CMD_PIO_WRITE_A_32, 79 79 80 /** Read 1 byte from the memory space. */ 81 CMD_MEM_READ_8, 82 /** Read 2 bytes from the memory space. */ 83 CMD_MEM_READ_16, 84 /** Read 4 bytes from the memory space. */ 85 CMD_MEM_READ_32, 86 87 /** Write 1 byte to the memory space. */ 88 CMD_MEM_WRITE_8, 89 /** Write 2 bytes to the memory space. */ 90 CMD_MEM_WRITE_16, 91 /** Write 4 bytes to the memory space. */ 92 CMD_MEM_WRITE_32, 93 94 /** Write 1 byte from the source argument to the memory space. */ 95 CMD_MEM_WRITE_A_8, 96 /** Write 2 bytes from the source argument to the memory space. */ 97 CMD_MEM_WRITE_A_16, 98 /** Write 4 bytes from the source argument to the memory space. */ 99 CMD_MEM_WRITE_A_32, 100 80 101 /** 81 102 * Perform a bit masking on the source argument … … 203 224 /** Notification configuration structure. */ 204 225 ipc_notif_cfg_t notif_cfg; 226 227 as_t *driver_as; 205 228 } irq_t; 206 229 -
kernel/generic/include/mm/page.h
rff4f073 r8d6c1f1 37 37 38 38 #include <typedefs.h> 39 #include <proc/task.h> 39 40 #include <mm/as.h> 40 41 #include <arch/mm/page.h> … … 65 66 extern uintptr_t hw_map(uintptr_t, size_t); 66 67 68 extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *); 69 67 70 #endif 68 71 -
kernel/generic/include/proc/thread.h
rff4f073 r8d6c1f1 258 258 extern sysarg_t sys_thread_get_id(thread_id_t *); 259 259 extern sysarg_t sys_thread_usleep(uint32_t); 260 extern sysarg_t sys_thread_udelay(uint32_t); 260 261 261 262 #endif -
kernel/generic/include/syscall/syscall.h
rff4f073 r8d6c1f1 44 44 SYS_THREAD_GET_ID, 45 45 SYS_THREAD_USLEEP, 46 SYS_THREAD_UDELAY, 46 47 47 48 SYS_TASK_GET_ID, … … 60 61 SYS_AS_AREA_DESTROY, 61 62 SYS_AS_GET_UNMAPPED_AREA, 63 64 SYS_PAGE_FIND_MAPPING, 62 65 63 66 SYS_IPC_CALL_SYNC_FAST, -
kernel/generic/src/ipc/irq.c
rff4f073 r8d6c1f1 174 174 irq->notif_cfg.code = code; 175 175 irq->notif_cfg.counter = 0; 176 irq->driver_as = AS; 176 177 177 178 /* … … 364 365 return IRQ_DECLINE; 365 366 367 #define CMD_MEM_READ(target) \ 368 do { \ 369 void *va = code->cmds[i].addr; \ 370 if (AS != irq->driver_as) \ 371 as_switch(AS, irq->driver_as); \ 372 memcpy_from_uspace(&target, va, (sizeof(target))); \ 373 if (dstarg) \ 374 scratch[dstarg] = target; \ 375 } while(0) 376 377 #define CMD_MEM_WRITE(val) \ 378 do { \ 379 void *va = code->cmds[i].addr; \ 380 if (AS != irq->driver_as) \ 381 as_switch(AS, irq->driver_as); \ 382 memcpy_to_uspace(va, &val, sizeof(val)); \ 383 } while (0) 384 385 as_t *current_as = AS; 366 386 size_t i; 367 387 for (i = 0; i < code->cmdcount; i++) { … … 422 442 } 423 443 break; 444 case CMD_MEM_READ_8: { 445 uint8_t val; 446 CMD_MEM_READ(val); 447 break; 448 } 449 case CMD_MEM_READ_16: { 450 uint16_t val; 451 CMD_MEM_READ(val); 452 break; 453 } 454 case CMD_MEM_READ_32: { 455 uint32_t val; 456 CMD_MEM_READ(val); 457 break; 458 } 459 case CMD_MEM_WRITE_8: { 460 uint8_t val = code->cmds[i].value; 461 CMD_MEM_WRITE(val); 462 break; 463 } 464 case CMD_MEM_WRITE_16: { 465 uint16_t val = code->cmds[i].value; 466 CMD_MEM_WRITE(val); 467 break; 468 } 469 case CMD_MEM_WRITE_32: { 470 uint32_t val = code->cmds[i].value; 471 CMD_MEM_WRITE(val); 472 break; 473 } 474 case CMD_MEM_WRITE_A_8: 475 if (srcarg) { 476 uint8_t val = scratch[srcarg]; 477 CMD_MEM_WRITE(val); 478 } 479 break; 480 case CMD_MEM_WRITE_A_16: 481 if (srcarg) { 482 uint16_t val = scratch[srcarg]; 483 CMD_MEM_WRITE(val); 484 } 485 break; 486 case CMD_MEM_WRITE_A_32: 487 if (srcarg) { 488 uint32_t val = scratch[srcarg]; 489 CMD_MEM_WRITE(val); 490 } 491 break; 424 492 case CMD_BTEST: 425 493 if ((srcarg) && (dstarg)) { … … 435 503 break; 436 504 case CMD_ACCEPT: 505 if (AS != current_as) 506 as_switch(AS, current_as); 437 507 return IRQ_ACCEPT; 438 508 case CMD_DECLINE: 439 509 default: 510 if (AS != current_as) 511 as_switch(AS, current_as); 440 512 return IRQ_DECLINE; 441 513 } 442 514 } 515 if (AS != current_as) 516 as_switch(AS, current_as); 443 517 444 518 return IRQ_DECLINE; -
kernel/generic/src/mm/page.c
rff4f073 r8d6c1f1 60 60 61 61 #include <mm/page.h> 62 #include <genarch/mm/page_ht.h> 63 #include <genarch/mm/page_pt.h> 62 64 #include <arch/mm/page.h> 63 65 #include <arch/mm/asid.h> … … 70 72 #include <debug.h> 71 73 #include <arch.h> 74 #include <syscall/copy.h> 75 #include <errno.h> 72 76 73 77 /** Virtual operations for page subsystem. */ … … 172 176 } 173 177 178 /** Syscall wrapper for getting mapping of a virtual page. 179 * 180 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node 181 * contains correct values. 182 * @retval ENOENT Virtual address has no mapping. 183 */ 184 sysarg_t sys_page_find_mapping(uintptr_t virt_address, 185 uintptr_t *uspace_frame) 186 { 187 mutex_lock(&AS->lock); 188 189 pte_t *pte = page_mapping_find(AS, virt_address, false); 190 if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) { 191 mutex_unlock(&AS->lock); 192 193 return (sysarg_t) ENOENT; 194 } 195 196 uintptr_t phys_address = PTE_GET_FRAME(pte); 197 198 mutex_unlock(&AS->lock); 199 200 int rc = copy_to_uspace(uspace_frame, 201 &phys_address, sizeof(phys_address)); 202 if (rc != EOK) { 203 return (sysarg_t) rc; 204 } 205 206 return EOK; 207 } 208 174 209 /** @} 175 210 */ -
kernel/generic/src/proc/thread.c
rff4f073 r8d6c1f1 55 55 #include <time/clock.h> 56 56 #include <time/timeout.h> 57 #include <time/delay.h> 57 58 #include <config.h> 58 59 #include <arch/interrupt.h> … … 912 913 } 913 914 915 sysarg_t sys_thread_udelay(uint32_t usec) 916 { 917 delay(usec); 918 return 0; 919 } 920 914 921 /** @} 915 922 */ -
kernel/generic/src/syscall/syscall.c
rff4f073 r8d6c1f1 41 41 #include <proc/program.h> 42 42 #include <mm/as.h> 43 #include <mm/page.h> 43 44 #include <print.h> 44 45 #include <arch.h> … … 126 127 (syshandler_t) sys_thread_get_id, 127 128 (syshandler_t) sys_thread_usleep, 129 (syshandler_t) sys_thread_udelay, 128 130 129 131 (syshandler_t) sys_task_get_id, … … 144 146 (syshandler_t) sys_as_area_destroy, 145 147 (syshandler_t) sys_as_get_unmapped_area, 148 149 /* Page mapping related syscalls. */ 150 (syshandler_t) sys_page_find_mapping, 146 151 147 152 /* IPC related syscalls. */
Note:
See TracChangeset
for help on using the changeset viewer.