Changeset b74959bd in mainline
- Timestamp:
- 2007-11-20T21:33:32Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8498915
- Parents:
- 3209923
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/sysipc.h
r3209923 rb74959bd 48 48 unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data); 49 49 unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, 50 unative_t arg1, unative_t arg2 );51 unative_t sys_ipc_answer (unative_t callid, ipc_data_t *data);50 unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); 51 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data); 52 52 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, 53 53 int nonblocking); -
kernel/generic/include/syscall/syscall.h
r3209923 rb74959bd 53 53 SYS_IPC_CALL_ASYNC_SLOW, 54 54 SYS_IPC_ANSWER_FAST, 55 SYS_IPC_ANSWER ,55 SYS_IPC_ANSWER_SLOW, 56 56 SYS_IPC_FORWARD_FAST, 57 57 SYS_IPC_WAIT, -
kernel/generic/src/ipc/sysipc.c
r3209923 rb74959bd 593 593 * @param arg1 Service-defined return value. 594 594 * @param arg2 Service-defined return value. 595 * @param arg3 Service-defined return value. 596 * @param arg4 Service-defined return value. 595 597 * 596 598 * @return Return 0 on success, otherwise return an error code. 597 599 */ 598 600 unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, 599 unative_t arg1, unative_t arg2 )601 unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4) 600 602 { 601 603 call_t *call; … … 620 622 IPC_SET_ARG1(call->data, arg1); 621 623 IPC_SET_ARG2(call->data, arg2); 624 IPC_SET_ARG3(call->data, arg3); 625 IPC_SET_ARG4(call->data, arg4); 622 626 rc = answer_preprocess(call, saveddata ? &saved_data : NULL); 623 627 … … 633 637 * @return Return 0 on success, otherwise return an error code. 634 638 */ 635 unative_t sys_ipc_answer (unative_t callid, ipc_data_t *data)639 unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data) 636 640 { 637 641 call_t *call; -
kernel/generic/src/syscall/syscall.c
r3209923 rb74959bd 138 138 (syshandler_t) sys_ipc_call_async_slow, 139 139 (syshandler_t) sys_ipc_answer_fast, 140 (syshandler_t) sys_ipc_answer ,140 (syshandler_t) sys_ipc_answer_slow, 141 141 (syshandler_t) sys_ipc_forward_fast, 142 142 (syshandler_t) sys_ipc_wait_for_call, -
uspace/app/tester/ipc/answer.c
r3209923 rb74959bd 47 47 } 48 48 if (!cnt) 49 return ;49 return NULL; 50 50 printf("Choose message:\n"); 51 51 do { … … 70 70 errn = ENOENT; 71 71 printf("Answering %P\n", callids[i]); 72 ipc_answer_ fast(callids[i], errn, 0, 0);72 ipc_answer_0(callids[i], errn); 73 73 callids[i] = 0; 74 74 -
uspace/app/tester/ipc/register.c
r3209923 rb74959bd 30 30 #include <unistd.h> 31 31 #include <async.h> 32 #include <errno.h> 32 33 #include "../tester.h" 33 34 … … 41 42 42 43 printf("Connected phone: %P, accepting\n", icall->in_phone_hash); 43 ipc_answer_ fast(iid, 0, 0, 0);44 ipc_answer_0(iid, EOK); 44 45 for (i = 0; i < 1024; i++) 45 46 if (!connections[i]) { … … 56 57 break; 57 58 default: 58 printf("Received message from %P: %X\n", phonehash,callid); 59 printf("Received message from %P: %X\n", phonehash, 60 callid); 59 61 for (i = 0; i < 1024; i++) 60 62 if (!callids[i]) { … … 64 66 continue; 65 67 } 66 ipc_answer_ fast(callid, retval, 0, 0);68 ipc_answer_0(callid, retval); 67 69 } 68 70 } -
uspace/app/tester/ipc/send_async.c
r3209923 rb74959bd 39 39 { 40 40 int phoneid; 41 int res;42 41 static int msgid = 1; 43 42 char c; -
uspace/lib/libc/generic/async.c
r3209923 rb74959bd 76 76 * { 77 77 * if (want_refuse) { 78 * ipc_answer_ fast(icallid, ELIMIT, 0, 0);78 * ipc_answer_0(icallid, ELIMIT); 79 79 * return; 80 80 * } 81 * ipc_answer_ fast(icallid, EOK, 0, 0);81 * ipc_answer_0(icallid, EOK); 82 82 * 83 83 * callid = async_get_call(&call); 84 84 * handle_call(callid, call); 85 * ipc_answer_ fast(callid, 1, 2, 3);85 * ipc_answer_2(callid, 1, 2, 3); 86 86 * 87 87 * callid = async_get_call(&call); … … 396 396 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call) 397 397 { 398 ipc_answer_ fast(callid, ENOENT, 0, 0);398 ipc_answer_0(callid, ENOENT); 399 399 } 400 400 … … 441 441 if (msg->callid == FIBRIL_connection->close_callid) 442 442 close_answered = 1; 443 ipc_answer_ fast(msg->callid, EHANGUP, 0, 0);443 ipc_answer_0(msg->callid, EHANGUP); 444 444 free(msg); 445 445 } 446 446 if (FIBRIL_connection->close_callid) 447 ipc_answer_ fast(FIBRIL_connection->close_callid, 0, 0, 0);447 ipc_answer_0(FIBRIL_connection->close_callid, EOK); 448 448 449 449 return 0; … … 476 476 if (!conn) { 477 477 if (callid) 478 ipc_answer_ fast(callid, ENOMEM, 0, 0);478 ipc_answer_0(callid, ENOMEM); 479 479 return NULL; 480 480 } … … 492 492 free(conn); 493 493 if (callid) 494 ipc_answer_ fast(callid, ENOMEM, 0, 0);494 ipc_answer_0(callid, ENOMEM); 495 495 return NULL; 496 496 } … … 537 537 538 538 /* Unknown call from unknown phone - hang it up */ 539 ipc_answer_ fast(callid, EHANGUP, 0, 0);539 ipc_answer_0(callid, EHANGUP); 540 540 } 541 541 -
uspace/lib/libc/generic/ipc.c
r3209923 rb74959bd 376 376 /** Answer a received call - fast version. 377 377 * 378 * The fast answer makes use of passing retval and first twoarguments in379 * registers. If you need to return more, use the ipc_answer () instead.378 * The fast answer makes use of passing retval and first four arguments in 379 * registers. If you need to return more, use the ipc_answer_slow() instead. 380 380 * 381 381 * @param callid Hash of the call being answered. … … 383 383 * @param arg1 First return argument. 384 384 * @param arg2 Second return argument. 385 * @param arg3 Third return argument. 386 * @param arg4 Fourth return argument. 385 387 * 386 388 * @return Zero on success or a value from @ref errno.h on failure. 387 389 */ 388 390 ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, 389 ipcarg_t arg2) 390 { 391 return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); 392 } 393 394 /** Answer a received call - full version. 391 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4) 392 { 393 return __SYSCALL6(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2, arg3, 394 arg4); 395 } 396 397 /** Answer a received call - slow full version. 395 398 * 396 399 * @param callid Hash of the call being answered. 397 * @param call Call structure with the answer. 398 * Must be already initialized by the responder. 400 * @param retval Return value. 401 * @param arg1 First return argument. 402 * @param arg2 Second return argument. 403 * @param arg3 Third return argument. 404 * @param arg4 Fourth return argument. 405 * @param arg5 Fifth return argument. 399 406 * 400 407 * @return Zero on success or a value from @ref errno.h on failure. 401 408 */ 402 ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call) 403 { 404 return __SYSCALL2(SYS_IPC_ANSWER, callid, (sysarg_t) call); 409 ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, 410 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5) 411 { 412 ipc_call_t data; 413 414 IPC_SET_RETVAL(data, retval); 415 IPC_SET_ARG1(data, arg1); 416 IPC_SET_ARG2(data, arg2); 417 IPC_SET_ARG3(data, arg3); 418 IPC_SET_ARG4(data, arg4); 419 IPC_SET_ARG5(data, arg5); 420 421 return __SYSCALL2(SYS_IPC_ANSWER_SLOW, callid, (sysarg_t) &data); 405 422 } 406 423 … … 659 676 * @param callid Storage where the hash of the IPC_M_DATA_SEND call will 660 677 * be stored. 661 * @param call Storage where the incoming call will be stored.662 678 * @param dst Storage where the suggested destination address will 663 679 * be stored. May be NULL. … … 667 683 * @return Non-zero on success, zero on failure. 668 684 */ 669 int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, 670 size_t *size) 671 { 685 int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size) 686 { 687 ipc_call_t data; 688 672 689 assert(callid); 673 assert(call); 674 675 *callid = async_get_call(call); 676 if (IPC_GET_METHOD(*call) != IPC_M_DATA_SEND) 690 691 *callid = async_get_call(&data); 692 if (IPC_GET_METHOD(data) != IPC_M_DATA_SEND) 677 693 return 0; 678 694 if (dst) 679 *dst = (void *) IPC_GET_ARG1( *call);695 *dst = (void *) IPC_GET_ARG1(data); 680 696 if (size) 681 *size = (size_t) IPC_GET_ARG3( *call);697 *size = (size_t) IPC_GET_ARG3(data); 682 698 return 1; 683 699 } … … 689 705 * 690 706 * @param callid Hash of the IPC_M_DATA_SEND call to answer. 691 * @param call Call structure with the request.692 707 * @param dst Final destination address for the IPC_M_DATA_SEND call. 693 708 * @param size Final size for the IPC_M_DATA_SEND call. … … 695 710 * @return Zero on success or a value from @ref errno.h on failure. 696 711 */ 697 ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, void *dst, 698 size_t size) 699 { 700 IPC_SET_RETVAL(*call, EOK); 701 IPC_SET_ARG1(*call, (ipcarg_t) dst); 702 IPC_SET_ARG3(*call, (ipcarg_t) size); 703 return ipc_answer(callid, call); 712 ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size) 713 { 714 return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); 704 715 } 705 716 -
uspace/lib/libc/include/ipc/ipc.h
r3209923 rb74959bd 191 191 extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data); 192 192 193 #define ipc_answer_fast_0(callid, retval) \ 194 ipc_answer_fast((callid), (retval), 0, 0) 195 #define ipc_answer_fast_1(callid, retval, arg1) \ 196 ipc_answer_fast((callid), (retval), (arg1), 0) 193 /* 194 * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow(). 195 * They are in the form of ipc_answer_m(), where m is the number of return 196 * arguments. The macros decide between the fast and the slow version according 197 * to m. 198 */ 199 #define ipc_answer_0(callid, retval) \ 200 ipc_answer_fast((callid), (retval), 0, 0, 0, 0) 201 #define ipc_answer_1(callid, retval, arg1) \ 202 ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0) 203 #define ipc_answer_2(callid, retval, arg1, arg2) \ 204 ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0) 205 #define ipc_answer_3(callid, retval, arg1, arg2, arg3) \ 206 ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0) 207 #define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \ 208 ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4)) 209 #define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \ 210 ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5)) 211 197 212 extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, 198 ipcarg_t arg1, ipcarg_t arg2); 199 extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call); 213 ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4); 214 extern ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, 215 ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5); 200 216 201 217 /* … … 245 261 ipcarg_t arg1); 246 262 extern int ipc_data_send(int phoneid, void *src, size_t size); 247 extern int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, 248 size_t *size); 249 extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, 250 void *dst, size_t size); 263 extern int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size); 264 extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size); 251 265 252 266 #endif -
uspace/srv/console/console.c
r3209923 rb74959bd 278 278 for (j = 0; j < conn->screenbuffer.size_y; j++) 279 279 for (i = 0; i < conn->screenbuffer.size_x; i++) { 280 field = get_field_at(&conn->screenbuffer, i, 281 j); 280 field = get_field_at(&conn->screenbuffer, i, j); 282 281 if (!style_same(*style, field->style)) 283 282 set_style(&field->style); … … 350 349 if (conn->keyrequest_counter > 0) { 351 350 conn->keyrequest_counter--; 352 ipc_answer_ fast(fifo_pop(conn->keyrequests), 0,353 c , 0);351 ipc_answer_1(fifo_pop(conn->keyrequests), EOK, 352 c); 354 353 break; 355 354 } … … 362 361 retval = ENOENT; 363 362 } 364 ipc_answer_ fast(callid, retval, 0, 0);363 ipc_answer_0(callid, retval); 365 364 } 366 365 } … … 376 375 377 376 if ((consnum = find_free_connection()) == -1) { 378 ipc_answer_ fast(iid, ELIMIT, 0, 0);377 ipc_answer_0(iid, ELIMIT); 379 378 return; 380 379 } … … 388 387 389 388 /* Accept the connection */ 390 ipc_answer_ fast(iid, 0, 0, 0);389 ipc_answer_0(iid, EOK); 391 390 392 391 while (1) { … … 404 403 while (conn->keyrequest_counter > 0) { 405 404 conn->keyrequest_counter--; 406 ipc_answer_ fast(fifo_pop(conn->keyrequests),407 ENOENT , 0, 0);405 ipc_answer_0(fifo_pop(conn->keyrequests), 406 ENOENT); 408 407 break; 409 408 } … … 465 464 * requests => fail. 466 465 */ 467 ipc_answer_ fast(callid, ELIMIT, 0, 0);466 ipc_answer_0(callid, ELIMIT); 468 467 } 469 468 continue; … … 472 471 break; 473 472 } 474 ipc_answer_ fast(callid, 0, arg1, arg2);473 ipc_answer_2(callid, EOK, arg1, arg2); 475 474 } 476 475 } -
uspace/srv/devmap/devmap.c
r3209923 rb74959bd 114 114 115 115 if (item == &devices_list) { 116 printf("D evMap: no device named %s.\n", name);116 printf("DEVMAP: no device named %s.\n", name); 117 117 return NULL; 118 118 } … … 190 190 191 191 if (IPC_GET_METHOD(icall) != DEVMAP_DRIVER_REGISTER) { 192 ipc_answer_ fast(iid, EREFUSED, 0, 0);192 ipc_answer_0(iid, EREFUSED); 193 193 return; 194 194 } … … 196 196 if (NULL == 197 197 (driver = (devmap_driver_t *)malloc(sizeof(devmap_driver_t)))) { 198 ipc_answer_ fast(iid, ENOMEM, 0, 0);198 ipc_answer_0(iid, ENOMEM); 199 199 return; 200 200 } … … 203 203 * Get driver name 204 204 */ 205 if (!ipc_data_receive(&callid, &call,NULL, &name_size)) {206 printf("Unexpected request : %u.\n", IPC_GET_METHOD(call));205 if (!ipc_data_receive(&callid, NULL, &name_size)) { 206 printf("Unexpected request.\n"); 207 207 free(driver); 208 ipc_answer_ fast(callid, EREFUSED, 0, 0);209 ipc_answer_ fast(iid, EREFUSED, 0, 0);208 ipc_answer_0(callid, EREFUSED); 209 ipc_answer_0(iid, EREFUSED); 210 210 return; 211 211 } … … 215 215 DEVMAP_NAME_MAXLEN); 216 216 free(driver); 217 ipc_answer_ fast(callid, EINVAL, 0, 0);218 ipc_answer_ fast(iid, EREFUSED, 0, 0);217 ipc_answer_0(callid, EINVAL); 218 ipc_answer_0(iid, EREFUSED); 219 219 return; 220 220 } … … 226 226 printf("Cannot allocate space for driver name.\n"); 227 227 free(driver); 228 ipc_answer_ fast(callid, ENOMEM, 0, 0);229 ipc_answer_ fast(iid, EREFUSED, 0, 0);228 ipc_answer_0(callid, ENOMEM); 229 ipc_answer_0(iid, EREFUSED); 230 230 return; 231 231 } … … 234 234 * Send confirmation to sender and get data into buffer. 235 235 */ 236 if (EOK != ipc_data_deliver(callid, &call,driver->name, name_size)) {236 if (EOK != ipc_data_deliver(callid, driver->name, name_size)) { 237 237 printf("Cannot read driver name.\n"); 238 238 free(driver->name); 239 239 free(driver); 240 ipc_answer_ fast(iid, EREFUSED, 0, 0);240 ipc_answer_0(iid, EREFUSED); 241 241 return; 242 242 } … … 251 251 /* 252 252 * Initialize list of asociated devices 253 253 */ 254 254 list_initialize(&(driver->devices)); 255 255 … … 260 260 261 261 if (IPC_M_CONNECT_TO_ME != IPC_GET_METHOD(call)) { 262 printf("D evMap: Unexpected method: %u.\n",262 printf("DEVMAP: Unexpected method: %u.\n", 263 263 IPC_GET_METHOD(call)); 264 ipc_answer_ fast(callid, ENOTSUP, 0, 0);264 ipc_answer_0(callid, ENOTSUP); 265 265 266 266 free(driver->name); 267 267 free(driver); 268 ipc_answer_ fast(iid, ENOTSUP, 0, 0);268 ipc_answer_0(iid, ENOTSUP); 269 269 return; 270 270 } … … 272 272 driver->phone = IPC_GET_ARG3(call); 273 273 274 ipc_answer_ fast(callid, EOK, 0, 0);274 ipc_answer_0(callid, EOK); 275 275 276 276 list_initialize(&(driver->drivers)); … … 288 288 futex_up(&drivers_list_futex); 289 289 290 ipc_answer_ fast(iid, EOK, 0, 0);290 ipc_answer_0(iid, EOK); 291 291 printf("Driver registered.\n"); 292 292 … … 295 295 } 296 296 297 /** Unregister device driver, unregister all its devices and free driver structure.298 * 297 /** Unregister device driver, unregister all its devices and free driver 298 * structure. 299 299 */ 300 300 static int devmap_driver_unregister(devmap_driver_t *driver) … … 348 348 */ 349 349 static void devmap_device_register(ipc_callid_t iid, ipc_call_t *icall, 350 350 devmap_driver_t *driver) 351 351 { 352 352 ipc_callid_t callid; 353 ipc_call_t call;354 353 size_t size; 355 354 devmap_device_t *device; … … 357 356 if (NULL == driver) { 358 357 printf("Invalid driver registration.\n"); 359 ipc_answer_ fast(iid, EREFUSED, 0, 0);358 ipc_answer_0(iid, EREFUSED); 360 359 return; 361 360 } … … 365 364 (device = (devmap_device_t *)malloc(sizeof(devmap_device_t)))) { 366 365 printf("Cannot allocate new device.\n"); 367 ipc_answer_ fast(iid, ENOMEM, 0, 0);366 ipc_answer_0(iid, ENOMEM); 368 367 return; 369 368 } 370 369 371 370 /* Get device name */ 372 if (!ipc_data_receive(&callid, &call,NULL, &size)) {371 if (!ipc_data_receive(&callid, NULL, &size)) { 373 372 free(device); 374 373 printf("Cannot read device name.\n"); 375 ipc_answer_ fast(iid, EREFUSED, 0, 0);374 ipc_answer_0(iid, EREFUSED); 376 375 return; 377 376 } … … 380 379 printf("Too long device name: %u.\n", size); 381 380 free(device); 382 ipc_answer_ fast(callid, EINVAL, 0, 0);383 ipc_answer_ fast(iid, EREFUSED, 0, 0);381 ipc_answer_0(callid, EINVAL); 382 ipc_answer_0(iid, EREFUSED); 384 383 return; 385 384 } … … 391 390 printf("Cannot read device name.\n"); 392 391 free(device); 393 ipc_answer_ fast(callid, ENOMEM, 0, 0);394 ipc_answer_ fast(iid, EREFUSED, 0, 0);395 return; 396 } 397 398 ipc_data_deliver(callid, &call,device->name, size);392 ipc_answer_0(callid, ENOMEM); 393 ipc_answer_0(iid, EREFUSED); 394 return; 395 } 396 397 ipc_data_deliver(callid, device->name, size); 399 398 device->name[size] = 0; 400 399 … … 410 409 free(device->name); 411 410 free(device); 412 ipc_answer_ fast(iid, EEXISTS, 0, 0);411 ipc_answer_0(iid, EEXISTS); 413 412 return; 414 413 } … … 420 419 421 420 /* Insert device into list of all devices */ 422 list_append(& (device->devices), &devices_list);421 list_append(&device->devices, &devices_list); 423 422 424 423 /* Insert device into list of devices that belog to one driver */ 425 futex_down(& (device->driver->devices_futex));426 427 list_append(& (device->driver_devices), &(device->driver->devices));428 429 futex_up(& (device->driver->devices_futex));424 futex_down(&device->driver->devices_futex); 425 426 list_append(&device->driver_devices, &device->driver->devices); 427 428 futex_up(&device->driver->devices_futex); 430 429 futex_up(&devices_list_futex); 431 430 432 431 printf("Device '%s' registered.\n", device->name); 433 ipc_answer_ fast(iid, EOK, device->handle, 0);432 ipc_answer_1(iid, EOK, device->handle); 434 433 435 434 return; … … 440 439 */ 441 440 static int devmap_device_unregister(ipc_callid_t iid, ipc_call_t *icall, 442 441 devmap_driver_t *driver) 443 442 { 444 443 /* TODO */ … … 465 464 466 465 if (NULL == dev) { 467 printf("D evMap: No registered device with handle %d.\n",466 printf("DEVMAP: No registered device with handle %d.\n", 468 467 handle); 469 ipc_answer_ fast(callid, ENOENT, 0, 0);468 ipc_answer_0(callid, ENOENT); 470 469 return; 471 470 } … … 487 486 const devmap_device_t *dev; 488 487 ipc_callid_t callid; 489 ipc_call_t call;490 488 ipcarg_t retval; 491 489 … … 495 493 * read the name itself until the buffer is allocated). 496 494 */ 497 if (!ipc_data_receive(&callid, &call,NULL, &name_size)) {498 ipc_answer_ fast(callid, EREFUSED, 0, 0);499 ipc_answer_ fast(iid, EREFUSED, 0, 0);495 if (!ipc_data_receive(&callid, NULL, &name_size)) { 496 ipc_answer_0(callid, EREFUSED); 497 ipc_answer_0(iid, EREFUSED); 500 498 return; 501 499 } 502 500 503 501 if (name_size > DEVMAP_NAME_MAXLEN) { 504 ipc_answer_ fast(callid, EINVAL, 0, 0);505 ipc_answer_ fast(iid, EREFUSED, 0, 0);502 ipc_answer_0(callid, EINVAL); 503 ipc_answer_0(iid, EREFUSED); 506 504 return; 507 505 } … … 511 509 */ 512 510 if (NULL == (name = (char *)malloc(name_size))) { 513 ipc_answer_ fast(callid, ENOMEM, 0, 0);514 ipc_answer_ fast(iid, EREFUSED, 0, 0);511 ipc_answer_0(callid, ENOMEM); 512 ipc_answer_0(iid, EREFUSED); 515 513 return; 516 514 } … … 519 517 * Send confirmation to sender and get data into buffer. 520 518 */ 521 if (EOK != (retval = ipc_data_deliver(callid, &call, name, 522 name_size))) { 523 ipc_answer_fast(iid, EREFUSED, 0, 0); 519 if (EOK != (retval = ipc_data_deliver(callid, name, name_size))) { 520 ipc_answer_0(iid, EREFUSED); 524 521 return; 525 522 } … … 534 531 */ 535 532 if (NULL == dev) { 536 printf("D evMap: device %s has not been registered.\n", name);537 ipc_answer_ fast(iid, ENOENT, 0, 0);538 return; 539 } 540 541 printf("D evMap: device %s has handler %d.\n", name, dev->handle);533 printf("DEVMAP: device %s has not been registered.\n", name); 534 ipc_answer_0(iid, ENOENT); 535 return; 536 } 537 538 printf("DEVMAP: device %s has handler %d.\n", name, dev->handle); 542 539 543 ipc_answer_ fast(iid, EOK, dev->handle, 0);540 ipc_answer_1(iid, EOK, dev->handle); 544 541 545 542 return; … … 560 557 */ 561 558 if (NULL == device) { 562 ipc_answer_ fast(iid, ENOENT, 0, 0);559 ipc_answer_0(iid, ENOENT); 563 560 return; 564 561 } 565 562 566 ipc_answer_ fast(iid, EOK, 0, 0);563 ipc_answer_0(iid, EOK); 567 564 568 565 name_size = strlen(device->name); … … 570 567 571 568 /* FIXME: 572 we have no channel from D evMapto client ->569 we have no channel from DEVMAP to client -> 573 570 sending must be initiated by client 574 571 … … 595 592 devmap_driver_t *driver = NULL; 596 593 597 ipc_answer_ fast(iid, EOK, 0, 0);594 ipc_answer_0(iid, EOK); 598 595 599 596 devmap_driver_register(&driver); 600 597 601 598 if (NULL == driver) { 602 printf("D evMap: driver registration failed.\n");599 printf("DEVMAP: driver registration failed.\n"); 603 600 return; 604 601 } … … 609 606 switch (IPC_GET_METHOD(call)) { 610 607 case IPC_M_PHONE_HUNGUP: 611 printf("D evMap: connection hung up.\n");608 printf("DEVMAP: connection hung up.\n"); 612 609 cont = false; 613 610 continue; /* Exit thread */ 614 611 case DEVMAP_DRIVER_UNREGISTER: 615 printf("D evMap: unregister driver.\n");612 printf("DEVMAP: unregister driver.\n"); 616 613 if (NULL == driver) { 617 printf("D evMap: driver was not registered!\n");618 ipc_answer_ fast(callid, ENOENT, 0, 0);614 printf("DEVMAP: driver was not registered!\n"); 615 ipc_answer_0(callid, ENOENT); 619 616 } else { 620 ipc_answer_ fast(callid, EOK, 0, 0);617 ipc_answer_0(callid, EOK); 621 618 } 622 619 break; … … 637 634 default: 638 635 if (!(callid & IPC_CALLID_NOTIFICATION)) { 639 ipc_answer_ fast(callid, ENOENT, 0, 0);636 ipc_answer_0(callid, ENOENT); 640 637 } 641 638 } … … 643 640 644 641 if (NULL != driver) { 645 646 647 642 /* 643 * Unregister the device driver and all its devices. 644 */ 648 645 devmap_driver_unregister(driver); 649 646 driver = NULL; … … 662 659 bool cont = true; 663 660 664 ipc_answer_ fast(iid, EOK, 0, 0); /* Accept connection */661 ipc_answer_0(iid, EOK); /* Accept connection */ 665 662 666 663 while (cont) { … … 669 666 switch (IPC_GET_METHOD(call)) { 670 667 case IPC_M_PHONE_HUNGUP: 671 printf("D evMap: connection hung up.\n");668 printf("DEVMAP: connection hung up.\n"); 672 669 cont = false; 673 670 continue; /* Exit thread */ … … 675 672 case DEVMAP_DEVICE_CONNECT_ME_TO: 676 673 /* Connect client to selected device */ 677 printf("D evMap: connect to device %d.\n",674 printf("DEVMAP: connect to device %d.\n", 678 675 IPC_GET_ARG1(call)); 679 676 devmap_forward(callid, &call); … … 690 687 default: 691 688 if (!(callid & IPC_CALLID_NOTIFICATION)) { 692 ipc_answer_ fast(callid, ENOENT, 0, 0);689 ipc_answer_0(callid, ENOENT); 693 690 } 694 691 } … … 703 700 { 704 701 705 printf("D evMap: new connection.\n");702 printf("DEVMAP: new connection.\n"); 706 703 707 704 /* Select interface */ … … 714 711 break; 715 712 default: 716 ipc_answer_ fast(iid, ENOENT, 0, 0); /* No such interface */717 printf("D evMap: Unknown interface %u.\n",713 ipc_answer_0(iid, ENOENT); /* No such interface */ 714 printf("DEVMAP: Unknown interface %u.\n", 718 715 (ipcarg_t)(IPC_GET_ARG1(*icall))); 719 716 } … … 721 718 /* Cleanup */ 722 719 723 printf("D evMap: connection closed.\n");720 printf("DEVMAP: connection closed.\n"); 724 721 return; 725 722 } … … 732 729 ipcarg_t phonead; 733 730 734 printf("D evMap: HelenOS device mapper.\n");731 printf("DEVMAP: HelenOS device mapper.\n"); 735 732 736 733 if (devmap_init() != 0) { 737 printf("Error while initializing D evMapservice.\n");734 printf("Error while initializing DEVMAP service.\n"); 738 735 return -1; 739 736 } -
uspace/srv/fb/ega.c
r3209923 rb74959bd 83 83 int i; 84 84 85 for (i = 0; i < scr_width *scr_height; i++) {85 for (i = 0; i < scr_width * scr_height; i++) { 86 86 scr_addr[i * 2] = ' '; 87 87 scr_addr[i * 2 + 1] = style; … … 126 126 if (rows > 0) { 127 127 memcpy(scr_addr, ((char *) scr_addr) + rows * scr_width * 2, 128 128 scr_width * scr_height * 2 - rows * scr_width * 2); 129 129 for (i = 0; i < rows * scr_width; i++) 130 130 (((short *) scr_addr) + scr_width * scr_height - rows * 131 131 scr_width)[i] = ((style << 8) + ' '); 132 132 } else if (rows < 0) { 133 133 memcpy(((char *)scr_addr) - rows * scr_width * 2, scr_addr, 134 134 scr_width * scr_height * 2 + rows * scr_width * 2); 135 135 for (i = 0; i < -rows * scr_width; i++) 136 136 ((short *)scr_addr)[i] = ((style << 8 ) + ' '); … … 153 153 scr_addr[i * 2] = data[i].character; 154 154 scr_addr[i * 2 + 1] = EGA_STYLE(data[i].style.fg_color, 155 155 data[i].style.bg_color); 156 156 } 157 157 } … … 161 161 int i; 162 162 163 for (i =0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++)163 for (i = 0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++) 164 164 ; 165 165 if (i == MAX_SAVED_SCREENS) … … 176 176 if (saved_screens[i].data) 177 177 memcpy(scr_addr, saved_screens[i].data, 2 * scr_width * 178 178 scr_height); 179 179 else 180 180 return EINVAL; … … 196 196 197 197 if (client_connected) { 198 ipc_answer_ fast(iid, ELIMIT, 0,0);198 ipc_answer_0(iid, ELIMIT); 199 199 return; 200 200 } 201 201 client_connected = 1; 202 ipc_answer_ fast(iid, 0, 0, 0); /* Accept connection */202 ipc_answer_0(iid, EOK); /* Accept connection */ 203 203 204 204 while (1) { … … 207 207 case IPC_M_PHONE_HUNGUP: 208 208 client_connected = 0; 209 ipc_answer_ fast(callid, 0, 0, 0);209 ipc_answer_0(callid, EOK); 210 210 return; /* Exit thread */ 211 211 case IPC_M_AS_AREA_SEND: … … 213 213 intersize = IPC_GET_ARG2(call); 214 214 if (intersize >= scr_width * scr_height * 215 216 receive_comm_area(callid, &call, (void *)217 215 sizeof(*interbuf)) { 216 receive_comm_area(callid, &call, 217 (void *) &interbuf); 218 218 continue; 219 219 } … … 229 229 break; 230 230 case FB_GET_CSIZE: 231 ipc_answer_ fast(callid, 0, scr_height, scr_width);231 ipc_answer_2(callid, EOK, scr_height, scr_width); 232 232 continue; 233 233 case FB_CLEAR: … … 301 301 retval = ENOENT; 302 302 } 303 ipc_answer_ fast(callid, retval, 0, 0);303 ipc_answer_0(callid, retval); 304 304 } 305 305 } … … 319 319 320 320 physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >> 321 321 PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); 322 322 323 323 async_set_client_connection(ega_client_connection); -
uspace/srv/fb/fb.c
r3209923 rb74959bd 166 166 { 167 167 *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | 168 168 RED(rgb, 8); 169 169 } 170 170 … … 174 174 int color = *(uint32_t *)(src); 175 175 return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | 176 176 ((color >> 16) & 0xff); 177 177 } 178 178 … … 209 209 /* 5-bit, 5-bits, 5-bits */ 210 210 *((uint16_t *)(dst)) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | 211 211 BLUE(rgb, 5); 212 212 } 213 213 … … 218 218 int color = *(uint16_t *)(src); 219 219 return (((color >> 10) & 0x1f) << (16 + 3)) | 220 220 (((color >> 5) & 0x1f) << (8 + 3)) | ((color & 0x1f) << 3); 221 221 } 222 222 … … 227 227 /* 5-bit, 6-bits, 5-bits */ 228 228 *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | 229 229 BLUE(rgb, 5); 230 230 } 231 231 … … 236 236 int color = *(uint16_t *)(src); 237 237 return (((color >> 11) & 0x1f) << (16 + 3)) | 238 238 (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); 239 239 } 240 240 … … 252 252 int color = *(uint8_t *)src; 253 253 return (((color >> 5) & 0x7) << (16 + 5)) | 254 254 (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); 255 255 } 256 256 … … 270 270 if (! (vport->paused && vport->dbdata)) 271 271 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], 272 272 COLOR(color)); 273 273 274 274 if (vport->dbdata) { … … 292 292 putpixel_mem(char *mem, unsigned int x, unsigned int y, int color) 293 293 { 294 (*screen.rgb2scr)(&mem[POINTPOS(x, y)], COLOR(color));294 (*screen.rgb2scr)(&mem[POINTPOS(x, y)], COLOR(color)); 295 295 } 296 296 … … 303 303 304 304 if (!tmpline) 305 tmpline = malloc(screen.scanline *screen.pixelbytes);305 tmpline = malloc(screen.scanline * screen.pixelbytes); 306 306 307 307 /* Clear first line */ … … 316 316 for (y = sy;y < sy+height; y++) 317 317 memcpy(&screen.fbaddress[POINTPOS(sx,y)], tmpline, 318 318 screen.pixelbytes * width); 319 319 } 320 320 if (vport->dbdata) { … … 322 322 int rline = (y + vport->dboffset) % vport->height; 323 323 int rpos = (rline * vport->width + sx) * 324 324 screen.pixelbytes; 325 325 memcpy(&vport->dbdata[rpos], tmpline, 326 326 screen.pixelbytes * width); 327 327 } 328 328 } … … 335 335 { 336 336 draw_rectangle(vport, 0, 0, vport->width, vport->height, 337 337 vport->style.bg_color); 338 338 } 339 339 … … 351 351 for (y = vport->y; y < vport->y+vport->height - lines; y++) 352 352 memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], 353 354 353 &screen.fbaddress[POINTPOS(vport->x,y + lines)], 354 screen.pixelbytes * vport->width); 355 355 draw_rectangle(vport, 0, vport->height - lines, vport->width, 356 356 lines, vport->style.bg_color); 357 357 } else if (lines < 0) { 358 358 lines = -lines; 359 for (y = vport->y + vport->height-1; y >= vport->y + lines; 360 y--) 359 for (y = vport->y + vport->height-1; y >= vport->y + lines; y--) 361 360 memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], 362 363 361 &screen.fbaddress[POINTPOS(vport->x,y - lines)], 362 screen.pixelbytes * vport->width); 364 363 draw_rectangle(vport, 0, 0, vport->width, lines, 365 364 vport->style.bg_color); 366 365 } 367 366 } … … 381 380 382 381 memcpy(&screen.fbaddress[POINTPOS(dstx,dsty)], 383 &vport->dbdata[srcoff], 384 vport->width*screen.pixelbytes); 382 &vport->dbdata[srcoff], vport->width * screen.pixelbytes); 385 383 } 386 384 } … … 393 391 if (lines > 0) { 394 392 draw_rectangle(vport, 0, 0, vport->width, lines, 395 393 vport->style.bg_color); 396 394 vport->dboffset += lines; 397 395 vport->dboffset %= vport->height; 398 396 } else if (lines < 0) { 399 397 lines = -lines; 400 draw_rectangle(vport, 0, vport->height-lines, 401 vport->width, lines, 402 vport->style.bg_color); 398 draw_rectangle(vport, 0, vport->height-lines, vport->width, 399 lines, vport->style.bg_color); 403 400 404 401 if (vport->dboffset < lines) … … 442 439 */ 443 440 static void 444 draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, 445 unsigned int sy,style_t style, int transparent)441 draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, unsigned int sy, 442 style_t style, int transparent) 446 443 { 447 444 int i; … … 453 450 for (i = 0; i < 8; i++) { 454 451 if (glline & (1 << (7 - i))) 455 putpixel(vport, sx + i, sy + y, 456 style.fg_color); 452 putpixel(vport, sx + i, sy + y, style.fg_color); 457 453 else if (!transparent) 458 putpixel(vport, sx + i, sy + y, 459 style.bg_color); 454 putpixel(vport, sx + i, sy + y, style.bg_color); 460 455 } 461 456 } … … 472 467 for (y = 0; y < FONT_SCANLINES; y++) 473 468 invert_pixel(vport, col * COL_WIDTH + x, row * 474 469 FONT_SCANLINES + y); 475 470 } 476 471 … … 631 626 632 627 draw_glyph(vport, c, col * COL_WIDTH, row * FONT_SCANLINES, style, 633 628 transparent); 634 629 635 630 vport->cur_col = col; … … 660 655 for (i = 0; i < vport->cols * vport->rows; i++) { 661 656 if (data[i].character == ' ' && style_same(data[i].style, 662 657 vport->style)) 663 658 continue; 664 659 col = i % vport->cols; 665 660 row = i / vport->cols; 666 661 draw_glyph(vport, data[i].character, col * COL_WIDTH, row * 667 FONT_SCANLINES,data[i].style,668 style_same(data[i].style,vport->style));662 FONT_SCANLINES, data[i].style, style_same(data[i].style, 663 vport->style)); 669 664 } 670 665 cursor_print(vport); … … 712 707 713 708 ppm_draw(shm, size, 0, 0, pmap->width, pmap->height, 714 709 (putpixel_cb_t)putpixel_pixmap, (void *)pm); 715 710 716 711 return pm; … … 758 753 void *dest = as_get_mappable_page(IPC_GET_ARG2(*call)); 759 754 shm_size = IPC_GET_ARG2(*call); 760 if (!ipc_answer_ fast(callid, 0, (sysarg_t) dest, 0))755 if (!ipc_answer_1(callid, EOK, (sysarg_t) dest)) 761 756 shm = dest; 762 757 else … … 806 801 807 802 ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), 808 IPC_GET_ARG2(*call), vport->width - x,809 vport->height - y,(putpixel_cb_t)putpixel, vport);803 IPC_GET_ARG2(*call), vport->width - x, vport->height - y, 804 (putpixel_cb_t)putpixel, vport); 810 805 break; 811 806 case FB_DRAW_TEXT_DATA: … … 815 810 } 816 811 if (intersize < vport->cols * vport->rows * 817 812 sizeof(*interbuffer)) { 818 813 retval = EINVAL; 819 814 break; … … 826 821 827 822 if (handled) 828 ipc_answer_ fast(callid, retval, 0, 0);823 ipc_answer_0(callid, retval); 829 824 return handled; 830 825 } … … 852 847 for (y = 0; y < realheight; y++) { 853 848 tmp = (vport->y + y) * screen.scanline + 854 849 vport->x * screen.pixelbytes; 855 850 memcpy(pmap->data + srcrowsize * y, screen.fbaddress + tmp, 856 851 realrowsize); 857 852 } 858 853 } … … 913 908 for (y = 0; y < realheight; y++) { 914 909 tmp = (vport->y + y) * screen.scanline + 915 910 vport->x * screen.pixelbytes; 916 911 memcpy(screen.fbaddress + tmp, pmap->data + y * srcrowsize, 917 912 realrowsize); 918 913 } 919 914 return 0; … … 934 929 for (i = 0; i < MAX_ANIMATIONS; i++) { 935 930 if (!animations[i].animlen || !animations[i].initialized || 936 931 !animations[i].enabled) 937 932 continue; 938 933 draw_pixmap(animations[i].vp, 939 934 animations[i].pixmaps[animations[i].pos]); 940 935 animations[i].pos = (animations[i].pos + 1) % 941 936 animations[i].animlen; 942 937 } 943 938 } … … 963 958 if (pointer_vport == -1) { 964 959 pointer_vport = viewport_create(pointer_x, pointer_y, 965 960 pointer_width, pointer_height); 966 961 if (pointer_vport < 0) 967 962 return; … … 975 970 else 976 971 copy_vp_to_pixmap(&viewports[pointer_vport], 977 972 &pixmaps[pointer_pixmap]); 978 973 979 974 /* Draw cursor */ … … 982 977 bytepos = i * ((pointer_width - 1) / 8 + 1) + j / 8; 983 978 visibility = pointer_mask_bits[bytepos] & 984 979 (1 << (j % 8)); 985 980 if (visibility) { 986 color = pointer_bits[bytepos] & (1 << (j % 8))987 981 color = pointer_bits[bytepos] & 982 (1 << (j % 8)) ? 0 : 0xffffff; 988 983 if (pointer_x + j < screen.xres && pointer_y + 989 984 i < screen.yres) 990 985 putpixel(&viewports[0], pointer_x + j, 991 986 pointer_y + i, color); 992 987 } 993 988 } … … 1107 1102 } 1108 1103 if (handled) 1109 ipc_answer_ fast(callid, retval, 0, 0);1104 ipc_answer_0(callid, retval); 1110 1105 return handled; 1111 1106 } … … 1158 1153 1159 1154 if (handled) 1160 ipc_answer_ fast(callid, retval, 0, 0);1155 ipc_answer_0(callid, retval); 1161 1156 return handled; 1162 1157 … … 1180 1175 1181 1176 if (client_connected) { 1182 ipc_answer_ fast(iid, ELIMIT, 0,0);1177 ipc_answer_0(iid, ELIMIT); 1183 1178 return; 1184 1179 } 1185 1180 client_connected = 1; 1186 ipc_answer_ fast(iid, 0, 0, 0); /* Accept connection */1181 ipc_answer_0(iid, EOK); /* Accept connection */ 1187 1182 1188 1183 while (1) { … … 1223 1218 break; 1224 1219 } 1225 ipc_answer_ fast(callid, 0, 0, 0);1220 ipc_answer_0(callid, EOK); 1226 1221 1227 1222 draw_char(vport, c, row, col, vport->style, 1228 1223 IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR); 1229 1224 continue; /* msg already answered */ 1230 1225 case FB_CLEAR: … … 1253 1248 break; 1254 1249 case FB_GET_CSIZE: 1255 ipc_answer_ fast(callid, 0, vport->rows, vport->cols);1250 ipc_answer_2(callid, EOK, vport->rows, vport->cols); 1256 1251 continue; 1257 1252 case FB_SCROLL: … … 1275 1270 break; 1276 1271 } 1277 if (! 1272 if (!viewports[i].initialized ) { 1278 1273 retval = EADDRNOTAVAIL; 1279 1274 break; … … 1281 1276 viewports[i].dboffset = 0; 1282 1277 if (IPC_GET_ARG2(call) == 1 && !viewports[i].dbdata) 1283 viewports[i].dbdata = malloc(screen.pixelbytes1284 * viewports[i].width*1285 1278 viewports[i].dbdata = 1279 malloc(screen.pixelbytes * 1280 viewports[i].width * viewports[i].height); 1286 1281 else if (IPC_GET_ARG2(call) == 0 && 1287 1282 viewports[i].dbdata) { 1288 1283 free(viewports[i].dbdata); 1289 1284 viewports[i].dbdata = NULL; … … 1309 1304 case FB_VIEWPORT_CREATE: 1310 1305 retval = viewport_create(IPC_GET_ARG1(call) >> 16, 1311 1312 1313 1306 IPC_GET_ARG1(call) & 0xffff, 1307 IPC_GET_ARG2(call) >> 16, 1308 IPC_GET_ARG2(call) & 0xffff); 1314 1309 break; 1315 1310 case FB_VIEWPORT_DELETE: … … 1336 1331 break; 1337 1332 case FB_GET_RESOLUTION: 1338 ipc_answer_ fast(callid, 0, screen.xres,screen.yres);1333 ipc_answer_2(callid, EOK, screen.xres, screen.yres); 1339 1334 continue; 1340 1335 case FB_POINTER_MOVE: … … 1346 1341 retval = ENOENT; 1347 1342 } 1348 ipc_answer_ fast(callid,retval, 0, 0);1343 ipc_answer_0(callid, retval); 1349 1344 } 1350 1345 } … … 1376 1371 1377 1372 physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >> 1378 1373 PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); 1379 1374 1380 1375 if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual, 1381 1376 fb_invert_colors)) 1382 1377 return 0; 1383 1378 -
uspace/srv/fb/main.c
r3209923 rb74959bd 45 45 46 46 dest = as_get_mappable_page(IPC_GET_ARG2(*call)); 47 if (ipc_answer_ fast(callid, 0, (sysarg_t) dest, 0) == 0) {47 if (ipc_answer_1(callid, EOK, (sysarg_t) dest) == 0) { 48 48 if (*area) 49 49 as_area_destroy(*area); -
uspace/srv/fb/sysio.c
r3209923 rb74959bd 118 118 119 119 if (client_connected) { 120 ipc_answer_ fast(iid, ELIMIT, 0,0);120 ipc_answer_0(iid, ELIMIT); 121 121 return; 122 122 } 123 123 124 124 client_connected = 1; 125 ipc_answer_ fast(iid, 0, 0, 0); /* Accept connection */125 ipc_answer_0(iid, EOK); /* Accept connection */ 126 126 while (1) { 127 127 callid = async_get_call(&call); 128 128 switch (IPC_GET_METHOD(call)) { 129 case IPC_M_PHONE_HUNGUP: 130 client_connected = 0; 131 ipc_answer_fast(callid, 0, 0, 0); 132 return; /* Exit thread */ 133 case FB_PUTCHAR: 134 c = IPC_GET_ARG1(call); 135 newrow = IPC_GET_ARG2(call); 136 newcol = IPC_GET_ARG3(call); 137 if ((lastcol != newcol) || (lastrow != newrow)) 138 curs_goto(newrow, newcol); 139 lastcol = newcol + 1; 140 lastrow = newrow; 141 sysput(c); 142 retval = 0; 129 case IPC_M_PHONE_HUNGUP: 130 client_connected = 0; 131 ipc_answer_0(callid, EOK); 132 return; /* Exit thread */ 133 case FB_PUTCHAR: 134 c = IPC_GET_ARG1(call); 135 newrow = IPC_GET_ARG2(call); 136 newcol = IPC_GET_ARG3(call); 137 if ((lastcol != newcol) || (lastrow != newrow)) 138 curs_goto(newrow, newcol); 139 lastcol = newcol + 1; 140 lastrow = newrow; 141 sysput(c); 142 retval = 0; 143 break; 144 case FB_CURSOR_GOTO: 145 newrow = IPC_GET_ARG1(call); 146 newcol = IPC_GET_ARG2(call); 147 curs_goto(newrow, newcol); 148 lastrow = newrow; 149 lastcol = newcol; 150 retval = 0; 151 break; 152 case FB_GET_CSIZE: 153 ipc_answer_2(callid, EOK, HEIGHT, WIDTH); 154 continue; 155 case FB_CLEAR: 156 clrscr(); 157 retval = 0; 158 break; 159 case FB_SET_STYLE: 160 fgcolor = IPC_GET_ARG1(call); 161 bgcolor = IPC_GET_ARG2(call); 162 if (fgcolor < bgcolor) 163 set_style(0); 164 else 165 set_style(7); 166 retval = 0; 167 break; 168 case FB_SCROLL: 169 i = IPC_GET_ARG1(call); 170 if ((i > HEIGHT) || (i < -HEIGHT)) { 171 retval = EINVAL; 143 172 break; 144 case FB_CURSOR_GOTO: 145 newrow = IPC_GET_ARG1(call); 146 newcol = IPC_GET_ARG2(call); 147 curs_goto(newrow, newcol); 148 lastrow = newrow; 149 lastcol = newcol; 150 retval = 0; 151 break; 152 case FB_GET_CSIZE: 153 ipc_answer_fast(callid, 0, HEIGHT, WIDTH); 154 continue; 155 case FB_CLEAR: 156 clrscr(); 157 retval = 0; 158 break; 159 case FB_SET_STYLE: 160 fgcolor = IPC_GET_ARG1(call); 161 bgcolor = IPC_GET_ARG2(call); 162 if (fgcolor < bgcolor) 163 set_style(0); 164 else 165 set_style(7); 166 retval = 0; 167 break; 168 case FB_SCROLL: 169 i = IPC_GET_ARG1(call); 170 if ((i > HEIGHT) || (i < -HEIGHT)) { 171 retval = EINVAL; 172 break; 173 } 174 scroll(i); 175 curs_goto(lastrow, lastcol); 176 retval = 0; 177 break; 178 default: 179 retval = ENOENT; 173 } 174 scroll(i); 175 curs_goto(lastrow, lastcol); 176 retval = 0; 177 break; 178 default: 179 retval = ENOENT; 180 180 } 181 181 182 ipc_answer_ fast(callid, retval, 0, 0);182 ipc_answer_0(callid, retval); 183 183 } 184 184 } -
uspace/srv/fs/fat/fat.c
r3209923 rb74959bd 94 94 * created by IPC_M_CONNECT_TO_ME. 95 95 */ 96 ipc_answer_ fast_0(iid, EOK);96 ipc_answer_0(iid, EOK); 97 97 } 98 98 … … 105 105 switch (IPC_GET_METHOD(call)) { 106 106 default: 107 ipc_answer_ fast_0(callid, ENOTSUP);107 ipc_answer_0(callid, ENOTSUP); 108 108 break; 109 109 } -
uspace/srv/kbd/generic/kbd.c
r3209923 rb74959bd 69 69 70 70 if (cons_connected && phone2cons != -1) { 71 /* recode to ASCII - one interrupt can produce more than one code so result is stored in fifo */ 71 /* 72 * recode to ASCII - one interrupt can produce more than one 73 * code so result is stored in fifo 74 */ 72 75 while (!keybuffer_empty(&keybuffer)) { 73 76 if (!keybuffer_pop(&keybuffer, (int *)&chr)) … … 86 89 87 90 if (cons_connected) { 88 ipc_answer_ fast(iid, ELIMIT, 0, 0);91 ipc_answer_0(iid, ELIMIT); 89 92 return; 90 93 } 91 94 cons_connected = 1; 92 ipc_answer_ fast(iid, 0, 0, 0);95 ipc_answer_0(iid, EOK); 93 96 94 97 while (1) { … … 99 102 ipc_hangup(phone2cons); 100 103 phone2cons = -1; 101 ipc_answer_ fast(callid, 0,0,0);104 ipc_answer_0(callid, EOK); 102 105 return; 103 106 case IPC_M_CONNECT_TO_ME: … … 112 115 retval = EINVAL; 113 116 } 114 ipc_answer_ fast(callid, retval, 0, 0);117 ipc_answer_0(callid, retval); 115 118 } 116 119 } -
uspace/srv/ns/ns.c
r3209923 rb74959bd 93 93 ph_addr = (void *) sysinfo_value(name); 94 94 if (!ph_addr) { 95 ipc_answer_ fast_0(callid, ENOENT);95 ipc_answer_0(callid, ENOENT); 96 96 return; 97 97 } … … 100 100 AS_AREA_READ | AS_AREA_CACHEABLE); 101 101 } 102 ipc_answer_ fast(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);102 ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ); 103 103 } 104 104 … … 129 129 break; 130 130 default: 131 ipc_answer_ fast_0(callid, ENOENT);131 ipc_answer_0(callid, ENOENT); 132 132 } 133 133 continue; … … 154 154 } 155 155 if (!(callid & IPC_CALLID_NOTIFICATION)) { 156 ipc_answer_ fast_0(callid, retval);156 ipc_answer_0(callid, retval); 157 157 } 158 158 } -
uspace/srv/pci/pci.c
r3209923 rb74959bd 67 67 ipc_call_t call; 68 68 ipc_callid_t callid; 69 ipcarg_t retval = ENOTSUP; 69 70 70 71 callid = ipc_wait_for_call(&call); 71 72 switch(IPC_GET_METHOD(call)) { 72 73 case IPC_M_CONNECT_ME_TO: 73 IPC_SET_RETVAL(call, 0);74 retval = EOK; 74 75 break; 75 76 } 76 if (! (callid & IPC_CALLID_NOTIFICATION)) { 77 ipc_answer(callid, &call); 78 } 79 printf("%s: received call from %lX\n", NAME, call.in_phone_hash); 77 ipc_answer_0(callid, retval); 78 printf("%s: received call from %lX\n", NAME, 79 call.in_phone_hash); 80 80 } 81 81 -
uspace/srv/rd/rd.c
r3209923 rb74959bd 91 91 * This is the answer to the call that opened the connection. 92 92 */ 93 ipc_answer_ fast(iid, EHANGUP, 0, 0);93 ipc_answer_0(iid, EHANGUP); 94 94 return; 95 95 } else { … … 98 98 * Return supported block size as ARG1. 99 99 */ 100 ipc_answer_ fast(iid, EOK, BLOCK_SIZE, 0);100 ipc_answer_1(iid, EOK, BLOCK_SIZE); 101 101 } 102 102 … … 111 111 * block. 112 112 */ 113 ipc_answer_ fast(callid, EOK, (uintptr_t) fs_va, 0);113 ipc_answer_1(callid, EOK, (uintptr_t) fs_va); 114 114 } else { 115 115 /* … … 117 117 * Close the connection. 118 118 */ 119 ipc_answer_ fast(callid, EHANGUP, 0, 0);119 ipc_answer_0(callid, EHANGUP); 120 120 return; 121 121 } … … 126 126 * Close the connection. 127 127 */ 128 ipc_answer_ fast(callid, EHANGUP, 0, 0);128 ipc_answer_0(callid, EHANGUP); 129 129 return; 130 130 } … … 138 138 * Answer the message and exit the fibril. 139 139 */ 140 ipc_answer_ fast(callid, EOK, 0, 0);140 ipc_answer_0(callid, EOK); 141 141 return; 142 142 case RD_READ_BLOCK: … … 178 178 break; 179 179 } 180 ipc_answer_ fast(callid, retval, 0, 0);180 ipc_answer_0(callid, retval); 181 181 } 182 182 } -
uspace/srv/vfs/vfs.c
r3209923 rb74959bd 60 60 * This call needs to be answered. 61 61 */ 62 ipc_answer_ fast_0(iid, EOK);62 ipc_answer_0(iid, EOK); 63 63 64 64 /* … … 104 104 case VFS_RENAME: 105 105 default: 106 ipc_answer_ fast_0(callid, ENOTSUP);106 ipc_answer_0(callid, ENOTSUP); 107 107 break; 108 108 } -
uspace/srv/vfs/vfs_mount.c
r3209923 rb74959bd 85 85 */ 86 86 ipc_callid_t callid; 87 ipc_call_t call;88 87 size_t size; 89 if (!ipc_data_receive(&callid, &call,NULL, &size)) {90 ipc_answer_ fast_0(callid, EINVAL);91 ipc_answer_ fast_0(rid, EINVAL);88 if (!ipc_data_receive(&callid, NULL, &size)) { 89 ipc_answer_0(callid, EINVAL); 90 ipc_answer_0(rid, EINVAL); 92 91 return; 93 92 } … … 100 99 if ((size < FS_NAME_MAXLEN + 1) || 101 100 (size > FS_NAME_MAXLEN + MAX_PATH_LEN)) { 102 ipc_answer_ fast_0(callid, EINVAL);103 ipc_answer_ fast_0(rid, EINVAL);101 ipc_answer_0(callid, EINVAL); 102 ipc_answer_0(rid, EINVAL); 104 103 return; 105 104 } … … 111 110 buf = malloc(size); 112 111 if (!buf) { 113 ipc_answer_ fast_0(callid, ENOMEM);114 ipc_answer_ fast_0(rid, ENOMEM);112 ipc_answer_0(callid, ENOMEM); 113 ipc_answer_0(rid, ENOMEM); 115 114 return; 116 115 } … … 119 118 * Deliver the data. 120 119 */ 121 (void) ipc_data_deliver(callid, &call,buf, size);120 (void) ipc_data_deliver(callid, buf, size); 122 121 123 122 char fs_name[FS_NAME_MAXLEN + 1]; … … 132 131 if (!fs_handle) { 133 132 free(buf); 134 ipc_answer_ fast_0(rid, ENOENT);133 ipc_answer_0(rid, ENOENT); 135 134 return; 136 135 } … … 147 146 if (rc != EOK) { 148 147 free(buf); 149 ipc_answer_ fast_0(rid, rc);148 ipc_answer_0(rid, rc); 150 149 return; 151 150 } … … 153 152 if (!mr_node) { 154 153 free(buf); 155 ipc_answer_ fast_0(rid, ENOMEM);154 ipc_answer_0(rid, ENOMEM); 156 155 return; 157 156 } … … 177 176 vfs_node_put(mr_node); /* failed -> drop reference */ 178 177 free(buf); 179 ipc_answer_ fast_0(rid, rc);178 ipc_answer_0(rid, rc); 180 179 return; 181 180 } … … 186 185 vfs_node_put(mr_node); /* failed -> drop reference */ 187 186 free(buf); 188 ipc_answer_ fast_0(rid, ENOMEM);187 ipc_answer_0(rid, ENOMEM); 189 188 return; 190 189 } … … 207 206 futex_up(&rootfs_futex); 208 207 free(buf); 209 ipc_answer_ fast_0(rid, EOK);208 ipc_answer_0(rid, EOK); 210 209 return; 211 210 } else { … … 217 216 free(buf); 218 217 vfs_node_put(mr_node); /* failed -> drop reference */ 219 ipc_answer_ fast_0(rid, ENOENT);218 ipc_answer_0(rid, ENOENT); 220 219 return; 221 220 } … … 255 254 256 255 if (rc2 == EOK) 257 ipc_answer_ fast_0(rid, rc1);256 ipc_answer_0(rid, rc1); 258 257 else if (rc1 == EOK) 259 ipc_answer_ fast_0(rid, rc2);258 ipc_answer_0(rid, rc2); 260 259 else 261 ipc_answer_ fast_0(rid, rc1);260 ipc_answer_0(rid, rc1); 262 261 } 263 262 -
uspace/srv/vfs/vfs_open.c
r3209923 rb74959bd 47 47 { 48 48 if (!vfs_files_init()) { 49 ipc_answer_ fast_0(rid, ENOMEM);49 ipc_answer_0(rid, ENOMEM); 50 50 return; 51 51 } … … 61 61 62 62 ipc_callid_t callid; 63 ipc_call_t call;64 63 65 if (!ipc_data_receive(&callid, &call,NULL, &size)) {66 ipc_answer_ fast_0(callid, EINVAL);67 ipc_answer_ fast_0(rid, EINVAL);64 if (!ipc_data_receive(&callid, NULL, &size)) { 65 ipc_answer_0(callid, EINVAL); 66 ipc_answer_0(rid, EINVAL); 68 67 return; 69 68 } … … 78 77 79 78 if (!path) { 80 ipc_answer_ fast_0(callid, ENOMEM);81 ipc_answer_ fast_0(rid, ENOMEM);79 ipc_answer_0(callid, ENOMEM); 80 ipc_answer_0(rid, ENOMEM); 82 81 return; 83 82 } 84 83 85 84 int rc; 86 if ((rc = ipc_data_deliver(callid, &call,path, size))) {87 ipc_answer_ fast_0(rid, rc);85 if ((rc = ipc_data_deliver(callid, path, size))) { 86 ipc_answer_0(rid, rc); 88 87 free(path); 89 88 return; … … 104 103 if (rc) { 105 104 futex_up(&unlink_futex); 106 ipc_answer_ fast_0(rid, rc);105 ipc_answer_0(rid, rc); 107 106 free(path); 108 107 return; … … 124 123 if (fd < 0) { 125 124 vfs_node_put(node); 126 ipc_answer_ fast_0(rid, fd);125 ipc_answer_0(rid, fd); 127 126 return; 128 127 } … … 143 142 * Success! Return the new file descriptor to the client. 144 143 */ 145 ipc_answer_ fast_1(rid, EOK, fd);144 ipc_answer_1(rid, EOK, fd); 146 145 } 147 146 -
uspace/srv/vfs/vfs_register.c
r3209923 rb74959bd 156 156 * VFS info structure from the client FS. 157 157 */ 158 if (!ipc_data_receive(&callid, &call,NULL, &size)) {158 if (!ipc_data_receive(&callid, NULL, &size)) { 159 159 /* 160 160 * The client doesn't obey the same protocol as we do. 161 161 */ 162 162 dprintf("Receiving of VFS info failed.\n"); 163 ipc_answer_ fast_0(callid, EINVAL);164 ipc_answer_ fast_0(rid, EINVAL);163 ipc_answer_0(callid, EINVAL); 164 ipc_answer_0(rid, EINVAL); 165 165 return; 166 166 } … … 178 178 */ 179 179 dprintf("Received VFS info has bad size.\n"); 180 ipc_answer_ fast_0(callid, EINVAL);181 ipc_answer_ fast_0(rid, EINVAL);180 ipc_answer_0(callid, EINVAL); 181 ipc_answer_0(rid, EINVAL); 182 182 return; 183 183 } … … 190 190 if (!fs_info) { 191 191 dprintf("Could not allocate memory for FS info.\n"); 192 ipc_answer_ fast_0(callid, ENOMEM);193 ipc_answer_ fast_0(rid, ENOMEM);192 ipc_answer_0(callid, ENOMEM); 193 ipc_answer_0(rid, ENOMEM); 194 194 return; 195 195 } 196 196 link_initialize(&fs_info->fs_link); 197 197 198 rc = ipc_data_deliver(callid, & call, &fs_info->vfs_info, size);198 rc = ipc_data_deliver(callid, &fs_info->vfs_info, size); 199 199 if (rc != EOK) { 200 200 dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n", 201 201 rc); 202 202 free(fs_info); 203 ipc_answer_ fast_0(callid, rc);204 ipc_answer_ fast_0(rid, rc);203 ipc_answer_0(callid, rc); 204 ipc_answer_0(rid, rc); 205 205 return; 206 206 } … … 210 210 if (!vfs_info_sane(&fs_info->vfs_info)) { 211 211 free(fs_info); 212 ipc_answer_ fast_0(callid, EINVAL);213 ipc_answer_ fast_0(rid, EINVAL);212 ipc_answer_0(callid, EINVAL); 213 ipc_answer_0(rid, EINVAL); 214 214 return; 215 215 } … … 227 227 futex_up(&fs_head_futex); 228 228 free(fs_info); 229 ipc_answer_ fast_0(callid, EEXISTS);230 ipc_answer_ fast_0(rid, EEXISTS);229 ipc_answer_0(callid, EEXISTS); 230 ipc_answer_0(rid, EEXISTS); 231 231 return; 232 232 } … … 249 249 futex_up(&fs_head_futex); 250 250 free(fs_info); 251 ipc_answer_ fast_0(callid, EINVAL);252 ipc_answer_ fast_0(rid, EINVAL);251 ipc_answer_0(callid, EINVAL); 252 ipc_answer_0(rid, EINVAL); 253 253 return; 254 254 } 255 255 fs_info->phone = IPC_GET_ARG3(call); 256 ipc_answer_ fast_0(callid, EOK);256 ipc_answer_0(callid, EOK); 257 257 258 258 dprintf("Callback connection to FS created.\n"); … … 268 268 ipc_hangup(fs_info->phone); 269 269 free(fs_info); 270 ipc_answer_ fast_0(callid, EINVAL);271 ipc_answer_ fast_0(rid, EINVAL);270 ipc_answer_0(callid, EINVAL); 271 ipc_answer_0(rid, EINVAL); 272 272 return; 273 273 } … … 283 283 ipc_hangup(fs_info->phone); 284 284 free(fs_info); 285 ipc_answer_ fast_0(callid, EINVAL);286 ipc_answer_ fast_0(rid, EINVAL);285 ipc_answer_0(callid, EINVAL); 286 ipc_answer_0(rid, EINVAL); 287 287 return; 288 288 } … … 291 291 * Commit to read-only sharing the PLB with the client. 292 292 */ 293 ipc_answer_ fast(callid, EOK, (ipcarg_t) plb,293 ipc_answer_2(callid, EOK, (ipcarg_t) plb, 294 294 (ipcarg_t) (AS_AREA_READ | AS_AREA_CACHEABLE)); 295 295 … … 302 302 */ 303 303 fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); 304 ipc_answer_ fast_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);304 ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); 305 305 306 306 futex_up(&fs_head_futex);
Note:
See TracChangeset
for help on using the changeset viewer.