Changeset 0cc4313 in mainline


Ignore:
Timestamp:
2007-11-22T15:50:24Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d40a8ff
Parents:
8498915
Message:

Modify the async framework to make use of all six syscall arguments.
Supply user-friendly macros as in previous cases.

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/screen.c

    r8498915 r0cc4313  
    9696void clear_screen(void)
    9797{
    98         async_msg(con_phone, CONSOLE_CLEAR, 0);
    99         moveto(0,0);
     98        async_msg_0(con_phone, CONSOLE_CLEAR);
     99        moveto(0, 0);
    100100}
    101101
     
    108108
    109109        resume_normal();
    110         async_msg(con_phone, CONSOLE_CLEAR, 0);
     110        async_msg_0(con_phone, CONSOLE_CLEAR);
    111111        curscore = -1;
    112112        memset((char *)curscreen, 0, sizeof(curscreen));
     
    120120{
    121121        con_phone = get_fd_phone(1);
    122         async_msg(con_phone, CONSOLE_CURSOR_VISIBILITY, 0);
     122        async_msg_1(con_phone, CONSOLE_CURSOR_VISIBILITY, 0);
    123123        resume_normal();
    124124        scr_clear();
     
    132132static void fflush(void)
    133133{
    134         async_msg(con_phone, CONSOLE_FLUSH, 0);
     134        async_msg_0(con_phone, CONSOLE_FLUSH);
    135135}
    136136
     
    139139static int get_display_size(winsize_t *ws)
    140140{
    141         return async_req_2(con_phone, CONSOLE_GETSIZE, 0, 0, &ws->ws_row, &ws->ws_col);
     141        return async_req_0_2(con_phone, CONSOLE_GETSIZE, &ws->ws_row,
     142            &ws->ws_col);
    142143}
    143144
  • uspace/lib/libc/generic/async.c

    r8498915 r0cc4313  
    102102#include <sys/time.h>
    103103#include <arch/barrier.h>
     104#include <bool.h>
    104105
    105106atomic_t async_futex = FUTEX_INITIALIZER;
     
    176177 * disabled.
    177178 */
    178 __thread int in_interrupt_handler;
     179__thread int _in_interrupt_handler;
    179180
    180181static void default_client_connection(ipc_callid_t callid, ipc_call_t *call);
     
    190191 */
    191192static async_client_conn_t interrupt_received = default_interrupt_received;
     193
     194/*
     195 * Getter for _in_interrupt_handler. We need to export the value of this thread
     196 * local variable to other modules, but the binutils 2.18 linkers die on an
     197 * attempt to export this symbol in the header file. For now, consider this as a
     198 * workaround.
     199 */
     200bool in_interrupt_handler(void)
     201{
     202        return _in_interrupt_handler;
     203}
    192204
    193205#define CONN_HASH_TABLE_CHAINS  32
     
    518530        /* Unrouted call - do some default behaviour */
    519531        if ((callid & IPC_CALLID_NOTIFICATION)) {
    520                 in_interrupt_handler = 1;
     532                _in_interrupt_handler = 1;
    521533                (*interrupt_received)(callid, call);
    522                 in_interrupt_handler = 0;
     534                _in_interrupt_handler = 0;
    523535                return;
    524536        }               
     
    717729 * @param arg1          Service-defined payload argument.
    718730 * @param arg2          Service-defined payload argument.
     731 * @param arg3          Service-defined payload argument.
     732 * @param arg4          Service-defined payload argument.
    719733 * @param dataptr       If non-NULL, storage where the reply data will be
    720734 *                      stored.
     
    722736 * @return              Hash of the sent message.
    723737 */
    724 aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    725     ipc_call_t *dataptr)
     738aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     739    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
    726740{
    727741        amsg_t *msg;
    728742
    729         if (in_interrupt_handler) {
     743        if (_in_interrupt_handler) {
    730744                printf("Cannot send asynchronous request in interrupt "
    731745                    "handler.\n");
     
    740754        msg->wdata.active = 1;
    741755                               
    742         ipc_call_async_2(phoneid, method, arg1, arg2, msg, reply_received, 1);
     756        ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, msg,
     757            reply_received, 1);
    743758
    744759        return (aid_t) msg;
     
    755770 * @param arg2          Service-defined payload argument.
    756771 * @param arg3          Service-defined payload argument.
     772 * @param arg4          Service-defined payload argument.
     773 * @param arg5          Service-defined payload argument.
    757774 * @param dataptr       If non-NULL, storage where the reply data will be
    758775 *                      stored.
     
    760777 * @return              Hash of the sent message.
    761778 */
    762 aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    763     ipcarg_t arg3, ipc_call_t *dataptr)
     779aid_t async_send_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     780    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
     781    ipc_call_t *dataptr)
    764782{
    765783        amsg_t *msg;
    766784
    767         if (in_interrupt_handler) {
     785        if (_in_interrupt_handler) {
    768786                printf("Cannot send asynchronous request in interrupt "
    769787                    "handler.\n");
     
    777795        /* We may sleep in next method, but it will use its own mechanism */
    778796        msg->wdata.active = 1;
    779                                
    780         ipc_call_async_3(phoneid, method, arg1, arg2, arg3, msg, reply_received,
    781             1);
     797
     798        ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, msg,
     799            reply_received, 1);
    782800
    783801        return (aid_t) msg;
     
    867885        amsg_t *msg;
    868886       
    869         if (in_interrupt_handler) {
     887        if (_in_interrupt_handler) {
    870888                printf("Cannot call async_usleep in interrupt handler.\n");
    871889                _exit(1);
     
    909927}
    910928
    911 /* Primitive functions for simple communication */
    912 void async_msg_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
    913                  ipcarg_t arg2, ipcarg_t arg3)
    914 {
    915         ipc_call_async_3(phoneid, method, arg1, arg2, arg3, NULL, NULL,
    916             !in_interrupt_handler);
    917 }
    918 
    919 void async_msg_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2)
    920 {
    921         ipc_call_async_2(phoneid, method, arg1, arg2, NULL, NULL,
    922             !in_interrupt_handler);
     929/** Pseudo-synchronous message sending - fast version.
     930 *
     931 * Send message asynchronously and return only after the reply arrives.
     932 *
     933 * This function can only transfer 4 register payload arguments. For
     934 * transferring more arguments, see the slower async_req_slow().
     935 *
     936 * @param phoneid       Hash of the phone through which to make the call.
     937 * @param method        Method of the call.
     938 * @param arg1          Service-defined payload argument.
     939 * @param arg2          Service-defined payload argument.
     940 * @param arg3          Service-defined payload argument.
     941 * @param arg4          Service-defined payload argument.
     942 * @param r1            If non-NULL, storage for the 1st reply argument.
     943 * @param r2            If non-NULL, storage for the 2nd reply argument.
     944 * @param r3            If non-NULL, storage for the 3rd reply argument.
     945 * @param r4            If non-NULL, storage for the 4th reply argument.
     946 * @param r5            If non-NULL, storage for the 5th reply argument.
     947 * @return              Return code of the reply or a negative error code.
     948 */
     949ipcarg_t async_req_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     950    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t *r1, ipcarg_t *r2,
     951    ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5)
     952{
     953        ipc_call_t result;
     954        ipcarg_t rc;
     955
     956        aid_t eid = async_send_4(phoneid, method, arg1, arg2, arg3, arg4,
     957            &result);
     958        async_wait_for(eid, &rc);
     959        if (r1)
     960                *r1 = IPC_GET_ARG1(result);
     961        if (r2)
     962                *r2 = IPC_GET_ARG2(result);
     963        if (r3)
     964                *r3 = IPC_GET_ARG3(result);
     965        if (r4)
     966                *r4 = IPC_GET_ARG4(result);
     967        if (r5)
     968                *r5 = IPC_GET_ARG5(result);
     969        return rc;
     970}
     971
     972/** Pseudo-synchronous message sending - slow version.
     973 *
     974 * Send message asynchronously and return only after the reply arrives.
     975 *
     976 * @param phoneid       Hash of the phone through which to make the call.
     977 * @param method        Method of the call.
     978 * @param arg1          Service-defined payload argument.
     979 * @param arg2          Service-defined payload argument.
     980 * @param arg3          Service-defined payload argument.
     981 * @param arg4          Service-defined payload argument.
     982 * @param arg5          Service-defined payload argument.
     983 * @param r1            If non-NULL, storage for the 1st reply argument.
     984 * @param r2            If non-NULL, storage for the 2nd reply argument.
     985 * @param r3            If non-NULL, storage for the 3rd reply argument.
     986 * @param r4            If non-NULL, storage for the 4th reply argument.
     987 * @param r5            If non-NULL, storage for the 5th reply argument.
     988 * @return              Return code of the reply or a negative error code.
     989 */
     990ipcarg_t async_req_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     991    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *r1,
     992    ipcarg_t *r2, ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5)
     993{
     994        ipc_call_t result;
     995        ipcarg_t rc;
     996
     997        aid_t eid = async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5,
     998            &result);
     999        async_wait_for(eid, &rc);
     1000        if (r1)
     1001                *r1 = IPC_GET_ARG1(result);
     1002        if (r2)
     1003                *r2 = IPC_GET_ARG2(result);
     1004        if (r3)
     1005                *r3 = IPC_GET_ARG3(result);
     1006        if (r4)
     1007                *r4 = IPC_GET_ARG4(result);
     1008        if (r5)
     1009                *r5 = IPC_GET_ARG5(result);
     1010        return rc;
    9231011}
    9241012
  • uspace/lib/libc/generic/io/stream.c

    r8498915 r0cc4313  
    7171
    7272        while (i < count) {
    73                 if (async_req_2(streams[0].phone, CONSOLE_GETCHAR, 0, 0, &r0,
     73                if (async_req_0_2(streams[0].phone, CONSOLE_GETCHAR, &r0,
    7474                    &r1) < 0) {
    7575                        return -1;
     
    8585
    8686        for (i = 0; i < count; i++)
    87                 async_msg(streams[1].phone, CONSOLE_PUTCHAR,
     87                async_msg_1(streams[1].phone, CONSOLE_PUTCHAR,
    8888                    ((const char *) buf)[i]);
    8989       
  • uspace/lib/libc/include/async.h

    r8498915 r0cc4313  
    4040#include <sys/time.h>
    4141#include <atomic.h>
     42#include <bool.h>
    4243
    4344typedef ipc_callid_t aid_t;
     
    5556}
    5657
    57 aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
     58/*
     59 * User-friendly wrappers for async_send_fast() and async_send_slow(). The
     60 * macros are in the form async_send_m(), where m denotes the number of payload
     61 * arguments.  Each macros chooses between the fast and the slow version based
     62 * on m.
     63 */
     64
     65#define async_send_0(phoneid, method, dataptr) \
     66    async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
     67#define async_send_1(phoneid, method, arg1, dataptr) \
     68    async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
     69#define async_send_2(phoneid, method, arg1, arg2, dataptr) \
     70    async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
     71#define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr) \
     72    async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
     73#define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr) \
     74    async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     75        (dataptr))
     76#define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
     77    async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     78        (arg5), (dataptr))
     79 
     80extern aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     81    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr);
     82extern aid_t async_send_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     83    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
    5884    ipc_call_t *dataptr);
    59 aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    60     ipcarg_t arg3, ipc_call_t *dataptr);
    61 void async_wait_for(aid_t amsgid, ipcarg_t *result);
    62 int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout);
    63 
    64 /** Pseudo-synchronous message sending
    65  *
    66  * Send message through IPC, wait in the event loop, until it is received
    67  *
    68  * @return Return code of message
    69  */
    70 static inline ipcarg_t async_req_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
    71     ipcarg_t arg2, ipcarg_t *r1, ipcarg_t *r2)
    72 {
    73         ipc_call_t result;
    74         ipcarg_t rc;
    75 
    76         aid_t eid = async_send_2(phoneid, method, arg1, arg2, &result);
    77         async_wait_for(eid, &rc);
    78         if (r1)
    79                 *r1 = IPC_GET_ARG1(result);
    80         if (r2)
    81                 *r2 = IPC_GET_ARG2(result);
    82         return rc;
    83 }
    84 #define async_req(phoneid, method, arg1, r1) \
    85     async_req_2(phoneid, method, arg1, 0, r1, 0)
    86 
    87 static inline ipcarg_t async_req_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
    88     ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *r1, ipcarg_t *r2, ipcarg_t *r3)
    89 {
    90         ipc_call_t result;
    91         ipcarg_t rc;
    92 
    93         aid_t eid = async_send_3(phoneid, method, arg1, arg2, arg3, &result);
    94         async_wait_for(eid, &rc);
    95         if (r1)
    96                 *r1 = IPC_GET_ARG1(result);
    97         if (r2)
    98                 *r2 = IPC_GET_ARG2(result);
    99         if (r3)
    100                 *r3 = IPC_GET_ARG3(result);
    101         return rc;
    102 }
    103 
     85extern void async_wait_for(aid_t amsgid, ipcarg_t *result);
     86extern int async_wait_timeout(aid_t amsgid, ipcarg_t *retval,
     87    suseconds_t timeout);
    10488
    10589fid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid,
     
    10892void async_create_manager(void);
    10993void async_destroy_manager(void);
    110 void async_set_client_connection(async_client_conn_t conn);
    111 void async_set_interrupt_received(async_client_conn_t conn);
    11294int _async_init(void);
    11395
    114 
    115 /* Primitve functions for IPC communication */
    116 void async_msg_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    117     ipcarg_t arg3);
    118 void async_msg_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2);
    119 #define async_msg(ph, m, a1) async_msg_2(ph, m, a1, 0)
     96extern void async_set_client_connection(async_client_conn_t conn);
     97extern void async_set_interrupt_received(async_client_conn_t conn);
     98
     99/* Wrappers for simple communication */
     100#define async_msg_0(phone, method) \
     101    ipc_call_async_0((phone), (method), NULL, NULL, !in_interrupt_handler())
     102#define async_msg_1(phone, method, arg1) \
     103    ipc_call_async_1((phone), (method), (arg1), NULL, NULL, \
     104        !in_interrupt_handler())
     105#define async_msg_2(phone, method, arg1, arg2) \
     106    ipc_call_async_2((phone), (method), (arg1), (arg2), NULL, NULL, \
     107        !in_interrupt_handler())
     108#define async_msg_3(phone, method, arg1, arg2, arg3) \
     109    ipc_call_async_3((phone), (method), (arg1), (arg2), (arg3), NULL, NULL, \
     110        !in_interrupt_handler())
     111#define async_msg_4(phone, method, arg1, arg2, arg3, arg4) \
     112    ipc_call_async_4((phone), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
     113        NULL, !in_interrupt_handler())
     114#define async_msg_5(phone, method, arg1, arg2, arg3, arg4, arg5) \
     115    ipc_call_async_5((phone), (method), (arg1), (arg2), (arg3), (arg4), \
     116        (arg5), NULL, NULL, !in_interrupt_handler())
     117
     118/*
     119 * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
     120 * are in the form async_req_m_n(), where m is the number of payload arguments
     121 * and n is the number of return arguments. The macros decidce between the fast
     122 * and slow verion based on m.
     123 */
     124#define async_req_0_0(phoneid, method) \
     125    async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
     126        NULL)
     127#define async_req_0_1(phoneid, method, r1) \
     128    async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), NULL, NULL, NULL, \
     129        NULL)
     130#define async_req_0_2(phoneid, method, r1, r2) \
     131    async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), NULL, NULL, \
     132        NULL)
     133#define async_req_0_3(phoneid, method, r1, r2, r3) \
     134    async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), NULL, \
     135        NULL)
     136#define async_req_0_4(phoneid, method, r1, r2, r3, r4) \
     137    async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
     138        NULL)
     139#define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5) \
     140    async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
     141        (r5))
     142#define async_req_1_0(phoneid, method, arg1) \
     143    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, NULL, NULL, NULL, \
     144        NULL, NULL)
     145#define async_req_1_1(phoneid, method, arg1, rc1) \
     146    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), NULL, NULL, \
     147        NULL, NULL)
     148#define async_req_1_2(phoneid, method, arg1, rc1, rc2) \
     149    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), NULL, \
     150        NULL, NULL)
     151#define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3) \
     152    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
     153        NULL, NULL)
     154#define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4) \
     155    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
     156        (rc4), NULL)
     157#define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5) \
     158    async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
     159        (rc4), (rc5))
     160#define async_req_2_0(phoneid, method, arg1, arg2) \
     161    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL, NULL, \
     162        NULL, NULL, NULL)
     163#define async_req_2_1(phoneid, method, arg1, arg2, rc1) \
     164    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), NULL, \
     165        NULL, NULL, NULL)
     166#define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2) \
     167    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     168        NULL, NULL, NULL)
     169#define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3) \
     170    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     171        (rc3), NULL, NULL)
     172#define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4) \
     173    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     174        (rc3), (rc4), NULL)
     175#define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
     176    async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     177        (rc3), (rc4), (rc5))
     178#define async_req_3_0(phoneid, method, arg1, arg2, arg3) \
     179    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, NULL, NULL, \
     180        NULL, NULL, NULL)
     181#define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1) \
     182    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     183        NULL, NULL, NULL, NULL)
     184#define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2) \
     185    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     186        (rc2), NULL, NULL, NULL)
     187#define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3) \
     188    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     189        (rc2), (rc3), NULL, NULL)
     190#define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
     191    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     192        (rc2), (rc3), (rc4), NULL)
     193#define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
     194    rc5) \
     195        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     196            (rc2), (rc3), (rc4), (rc5))
     197#define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
     198    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
     199        NULL, NULL, NULL, NULL)
     200#define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1) \
     201    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     202        NULL, NULL, NULL, NULL)
     203#define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2) \
     204    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     205        (rc2), NULL, NULL, NULL)
     206#define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
     207    async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     208        (rc2), (rc3), NULL, NULL)
     209#define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     210    rc4) \
     211        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     212            (rc1), (rc2), (rc3), (rc4), NULL)
     213#define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     214    rc4, rc5) \
     215        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     216            (rc1), (rc2), (rc3), (rc4), (rc5))
     217#define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
     218    async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     219        (arg5), NULL, NULL, NULL, NULL, NULL)
     220#define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1) \
     221    async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     222        (arg5), (rc1), NULL, NULL, NULL, NULL)
     223#define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
     224    async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     225        (arg5), (rc1), (rc2), NULL, NULL, NULL)
     226#define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     227    rc3) \
     228        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     229            (arg5), (rc1), (rc2), (rc3), NULL, NULL)
     230#define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     231    rc3, rc4) \
     232        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     233            (arg5), (rc1), (rc2), (rc3), (rc4), NULL)
     234#define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     235    rc3, rc4, rc5) \
     236        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     237            (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
     238
     239extern ipcarg_t async_req_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     240    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t *r1, ipcarg_t *r2,
     241    ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5);
     242extern ipcarg_t async_req_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     243    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *r1,
     244    ipcarg_t *r2, ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5);
    120245
    121246static inline void async_serialize_start(void)
     
    129254}
    130255
     256extern bool in_interrupt_handler(void);
     257
    131258extern atomic_t async_futex;
     259
    132260#endif
    133261
  • uspace/srv/console/console.c

    r8498915 r0cc4313  
    106106static void clrscr(void)
    107107{
    108         async_msg(fb_info.phone, FB_CLEAR, 0);
     108        async_msg_0(fb_info.phone, FB_CLEAR);
    109109}
    110110
    111111static void curs_visibility(int v)
    112112{
    113         async_msg(fb_info.phone, FB_CURSOR_VISIBILITY, v);
     113        async_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, v);
    114114}
    115115
     
    177177                scr->top_line = (scr->top_line + 1) % scr->size_y;
    178178                if (console == active_console)
    179                         async_msg(fb_info.phone, FB_SCROLL, 1);
     179                        async_msg_1(fb_info.phone, FB_SCROLL, 1);
    180180        }
    181181       
     
    197197       
    198198        /* Save screen */
    199         newpmap = async_req(fb_info.phone, FB_VP2PIXMAP, 0, NULL);
     199        newpmap = async_req_0_0(fb_info.phone, FB_VP2PIXMAP);
    200200        if (newpmap < 0)
    201201                return -1;
     
    205205                async_msg_2(fb_info.phone, FB_VP_DRAW_PIXMAP, 0, oldpixmap);
    206206                /* Drop old pixmap */
    207                 async_msg(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
     207                async_msg_1(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
    208208        }
    209209       
     
    267267                        }
    268268                /* This call can preempt, but we are already at the end */
    269                 rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL,
    270                     NULL);             
     269                rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA);           
    271270        }
    272271       
     
    416415                        /* Send message to fb */
    417416                        if (consnum == active_console) {
    418                                 async_msg(fb_info.phone, FB_CLEAR, 0);
     417                                async_msg_0(fb_info.phone, FB_CLEAR);
    419418                        }
    420419                       
     
    435434                case CONSOLE_FLUSH:
    436435                        if (consnum == active_console)
    437                                 async_req_2(fb_info.phone, FB_FLUSH, 0, 0,
    438                                     NULL, NULL);               
     436                                async_req_0_0(fb_info.phone, FB_FLUSH);
    439437                        break;
    440438                case CONSOLE_SET_STYLE:
     
    509507        gcons_init(fb_info.phone);
    510508        /* Synchronize, the gcons can have something in queue */
    511         async_req(fb_info.phone, FB_FLUSH, 0, NULL);
     509        async_req_0_0(fb_info.phone, FB_FLUSH);
    512510        /* Enable double buffering */
    513511        async_msg_2(fb_info.phone, FB_VIEWPORT_DB, (sysarg_t) -1, 1);
    514512       
    515         async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &fb_info.rows,
     513        async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows,
    516514            &fb_info.cols);
    517515        set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
     
    540538            PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
    541539        if (!interbuffer) {
    542                 if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND,
    543                     (ipcarg_t) interbuffer, 0, AS_AREA_READ, NULL, NULL,
    544                     NULL) != 0) {
     540                if (async_req_3_0(fb_info.phone, IPC_M_AS_AREA_SEND,
     541                    (ipcarg_t) interbuffer, 0, AS_AREA_READ) != 0) {
    545542                        munmap(interbuffer,
    546543                            sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
  • uspace/srv/console/gcons.c

    r8498915 r0cc4313  
    8282static void vp_switch(int vp)
    8383{
    84         async_msg(fbphone,FB_VIEWPORT_SWITCH, vp);
     84        async_msg_1(fbphone,FB_VIEWPORT_SWITCH, vp);
    8585}
    8686
    8787/** Create view port */
    88 static int vp_create(unsigned int x, unsigned int y,
    89                      unsigned int width, unsigned int height)
    90 {
    91         return async_req_2(fbphone, FB_VIEWPORT_CREATE,
    92                            (x << 16) | y, (width << 16) | height, NULL, NULL);
     88static int vp_create(unsigned int x, unsigned int y, unsigned int width,
     89    unsigned int height)
     90{
     91        return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
     92            (width << 16) | height);
    9393}
    9494
    9595static void clear(void)
    9696{
    97         async_msg(fbphone, FB_CLEAR, 0);
     97        async_msg_0(fbphone, FB_CLEAR);
    9898}
    9999
     
    119119        if (ic_pixmaps[state] != -1)
    120120                async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
    121                         ic_pixmaps[state]);
     121                    ic_pixmaps[state]);
    122122
    123123        if (state != CONS_DISCONNECTED && state != CONS_KERNEL &&
     
    141141                        redraw_state(i);
    142142                if (animation != -1)
    143                         async_msg(fbphone, FB_ANIM_START, animation);
     143                        async_msg_1(fbphone, FB_ANIM_START, animation);
    144144        } else {
    145145                if (console_state[active_console] == CONS_DISCONNECTED_SEL)
     
    225225
    226226        if (animation != -1)
    227                 async_msg(fbphone, FB_ANIM_STOP, animation);
     227                async_msg_1(fbphone, FB_ANIM_STOP, animation);
    228228
    229229        active_console = KERNEL_CONSOLE; /* Set to kernel console */
     
    317317        /* Create area */
    318318        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
    319                 MAP_ANONYMOUS, 0, 0);
     319            MAP_ANONYMOUS, 0, 0);
    320320        if (shm == MAP_FAILED)
    321321                return;
     
    323323        memcpy(shm, logo, size);
    324324        /* Send area */
    325         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
    326                 NULL);
     325        rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
    327326        if (rc)
    328327                goto exit;
    329         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
    330                 PROTO_READ, NULL, NULL, NULL);
     328        rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     329            PROTO_READ);
    331330        if (rc)
    332331                goto drop;
     
    335334drop:
    336335        /* Drop area */
    337         async_msg(fbphone, FB_DROP_SHM, 0);
     336        async_msg_0(fbphone, FB_DROP_SHM);
    338337exit:       
    339338        /* Remove area */
     
    357356        clear();
    358357        draw_pixmap(_binary_helenos_ppm_start,
    359                 (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
     358            (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
    360359        draw_pixmap(_binary_nameic_ppm_start,
    361                 (size_t) &_binary_nameic_ppm_size, 5, 17);
    362 
    363         for (i = 0;i < CONSOLE_COUNT; i++)
     360            (size_t) &_binary_nameic_ppm_size, 5, 17);
     361
     362        for (i = 0; i < CONSOLE_COUNT; i++)
    364363                redraw_state(i);
    365364        vp_switch(console_vp);
     
    380379        /* Create area */
    381380        shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
    382                 MAP_ANONYMOUS, 0, 0);
     381            MAP_ANONYMOUS, 0, 0);
    383382        if (shm == MAP_FAILED)
    384383                return -1;
     
    386385        memcpy(shm, data, size);
    387386        /* Send area */
    388         rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
    389                 NULL);
     387        rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
    390388        if (rc)
    391389                goto exit;
    392         rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
    393                 PROTO_READ, NULL, NULL, NULL);
     390        rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
     391            PROTO_READ);
    394392        if (rc)
    395393                goto drop;
    396394
    397395        /* Obtain pixmap */
    398         rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL);
     396        rc = async_req_0_0(fbphone, FB_SHM2PIXMAP);
    399397        if (rc < 0)
    400398                goto drop;
     
    402400drop:
    403401        /* Drop area */
    404         async_msg(fbphone, FB_DROP_SHM, 0);
     402        async_msg_0(fbphone, FB_DROP_SHM);
    405403exit:       
    406404        /* Remove area */
     
    424422        int pm;
    425423
    426         an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
    427                 NULL);
     424        an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]);
    428425        if (an < 0)
    429426                return;
    430427
    431428        pm = make_pixmap(_binary_anim_1_ppm_start,
    432                 (int) &_binary_anim_1_ppm_size);
     429            (int) &_binary_anim_1_ppm_size);
    433430        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    434431
    435432        pm = make_pixmap(_binary_anim_2_ppm_start,
    436                 (int) &_binary_anim_2_ppm_size);
     433            (int) &_binary_anim_2_ppm_size);
    437434        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    438435
    439436        pm = make_pixmap(_binary_anim_3_ppm_start,
    440                 (int) &_binary_anim_3_ppm_size);
     437            (int) &_binary_anim_3_ppm_size);
    441438        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    442439
    443440        pm = make_pixmap(_binary_anim_4_ppm_start,
    444                 (int) &_binary_anim_4_ppm_size);
     441            (int) &_binary_anim_4_ppm_size);
    445442        async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
    446443
    447         async_msg(fbphone, FB_ANIM_START, an);
     444        async_msg_1(fbphone, FB_ANIM_START, an);
    448445
    449446        animation = an;
     
    468465        fbphone = phone;
    469466
    470         rc = async_req_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres);
     467        rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
    471468        if (rc)
    472469                return;
     
    478475        /* Align width & height to character size */
    479476        console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
    480                 ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
    481                 ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
     477            ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
     478            ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
    482479        if (console_vp < 0)
    483480                return;
     
    487484        for (i = 0; i < CONSOLE_COUNT; i++) {
    488485                cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN +
    489                         i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
    490                         STATUS_WIDTH, STATUS_HEIGHT);
     486                    i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
     487                    STATUS_WIDTH, STATUS_HEIGHT);
    491488                if (cstatus_vp[i] < 0)
    492489                        return;
     
    497494        /* Initialize icons */
    498495        ic_pixmaps[CONS_SELECTED] =
    499                 make_pixmap(_binary_cons_selected_ppm_start,
    500                 (int) &_binary_cons_selected_ppm_size);
     496            make_pixmap(_binary_cons_selected_ppm_start,
     497            (int) &_binary_cons_selected_ppm_size);
    501498        ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
    502                 (int) &_binary_cons_idle_ppm_size);
     499            (int) &_binary_cons_idle_ppm_size);
    503500        ic_pixmaps[CONS_HAS_DATA] =
    504                 make_pixmap(_binary_cons_has_data_ppm_start,
    505                 (int) &_binary_cons_has_data_ppm_size);
     501            make_pixmap(_binary_cons_has_data_ppm_start,
     502            (int) &_binary_cons_has_data_ppm_size);
    506503        ic_pixmaps[CONS_DISCONNECTED] =
    507                 make_pixmap(_binary_cons_idle_ppm_start,
    508                 (int) &_binary_cons_idle_ppm_size);
     504            make_pixmap(_binary_cons_idle_ppm_start,
     505            (int) &_binary_cons_idle_ppm_size);
    509506        ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
    510                 (int) &_binary_cons_kernel_ppm_size);
     507            (int) &_binary_cons_kernel_ppm_size);
    511508        ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
    512509       
  • uspace/srv/kbd/arch/ia32/src/mouse.c

    r8498915 r0cc4313  
    9595                        if (buf.u.val.leftbtn ^ leftbtn) {
    9696                                leftbtn = buf.u.val.leftbtn;
    97                                 async_msg(phoneid, KBD_MS_LEFT, leftbtn);
     97                                async_msg_1(phoneid, KBD_MS_LEFT, leftbtn);
    9898                        }
    9999                        if (buf.u.val.rightbtn & rightbtn) {
    100100                                rightbtn = buf.u.val.middlebtn;
    101                                 async_msg(phoneid, KBD_MS_RIGHT, rightbtn);
     101                                async_msg_1(phoneid, KBD_MS_RIGHT, rightbtn);
    102102                        }
    103103                        if (buf.u.val.rightbtn & rightbtn) {
    104104                                middlebtn = buf.u.val.middlebtn;
    105                                 async_msg(phoneid, KBD_MS_MIDDLE, middlebtn);
     105                                async_msg_1(phoneid, KBD_MS_MIDDLE, middlebtn);
    106106                        }
    107107                        x = bit9toint(buf.u.val.xsign, buf.u.val.x);
    108108                        y = bit9toint(buf.u.val.ysign, buf.u.val.y);
    109109                        if (x || y)
    110                                 async_msg_2(phoneid, KBD_MS_MOVE, (ipcarg_t)x, (ipcarg_t)(-y));
     110                                async_msg_2(phoneid, KBD_MS_MOVE, (ipcarg_t)x,
     111                                    (ipcarg_t)(-y));
    111112                }
    112113        }
  • uspace/srv/kbd/generic/kbd.c

    r8498915 r0cc4313  
    7777                                break;
    7878
    79                         async_msg(phone2cons, KBD_PUSHCHAR, chr);
     79                        async_msg_1(phone2cons, KBD_PUSHCHAR, chr);
    8080                }
    8181        }
Note: See TracChangeset for help on using the changeset viewer.