Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 79ae36dd in mainline for uspace/lib/c/generic/udebug.c


Ignore:
Timestamp:
2011-06-08T19:01:55Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/udebug.c

    r764d71e r79ae36dd  
    3535#include <udebug.h>
    3636#include <sys/types.h>
     37#include <kernel/ipc/ipc_methods.h>
    3738#include <async.h>
    3839
    39 int udebug_begin(int phoneid)
     40int udebug_begin(async_sess_t *sess)
    4041{
    41         return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
     42        async_exch_t *exch = async_exchange_begin(sess);
     43        return async_req_1_0(exch, IPC_M_DEBUG, UDEBUG_M_BEGIN);
    4244}
    4345
    44 int udebug_end(int phoneid)
     46int udebug_end(async_sess_t *sess)
    4547{
    46         return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_END);
     48        async_exch_t *exch = async_exchange_begin(sess);
     49        return async_req_1_0(exch, IPC_M_DEBUG, UDEBUG_M_END);
    4750}
    4851
    49 int udebug_set_evmask(int phoneid, udebug_evmask_t mask)
     52int udebug_set_evmask(async_sess_t *sess, udebug_evmask_t mask)
    5053{
    51         return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_SET_EVMASK,
    52                 mask);
     54        async_exch_t *exch = async_exchange_begin(sess);
     55        return async_req_2_0(exch, IPC_M_DEBUG, UDEBUG_M_SET_EVMASK, mask);
    5356}
    5457
    55 int udebug_thread_read(int phoneid, void *buffer, size_t n,
    56         size_t *copied, size_t *needed)
     58int udebug_thread_read(async_sess_t *sess, void *buffer, size_t n,
     59    size_t *copied, size_t *needed)
    5760{
    5861        sysarg_t a_copied, a_needed;
    59         int rc;
    60 
    61         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
    62                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
    63 
    64         *copied = (size_t)a_copied;
    65         *needed = (size_t)a_needed;
    66 
     62       
     63        async_exch_t *exch = async_exchange_begin(sess);
     64        int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_THREAD_READ,
     65            (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
     66       
     67        *copied = (size_t) a_copied;
     68        *needed = (size_t) a_needed;
     69       
    6770        return rc;
    6871}
    6972
    70 int udebug_name_read(int phoneid, void *buffer, size_t n,
    71         size_t *copied, size_t *needed)
     73int udebug_name_read(async_sess_t *sess, void *buffer, size_t n,
     74    size_t *copied, size_t *needed)
    7275{
    7376        sysarg_t a_copied, a_needed;
    74         int rc;
    75 
    76         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_NAME_READ,
    77                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
    78 
    79         *copied = (size_t)a_copied;
    80         *needed = (size_t)a_needed;
    81 
     77       
     78        async_exch_t *exch = async_exchange_begin(sess);
     79        int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_NAME_READ,
     80            (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
     81       
     82        *copied = (size_t) a_copied;
     83        *needed = (size_t) a_needed;
     84       
    8285        return rc;
    8386}
    8487
    85 int udebug_areas_read(int phoneid, void *buffer, size_t n,
    86         size_t *copied, size_t *needed)
     88int udebug_areas_read(async_sess_t *sess, void *buffer, size_t n,
     89    size_t *copied, size_t *needed)
    8790{
    8891        sysarg_t a_copied, a_needed;
    89         int rc;
    90 
    91         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_AREAS_READ,
    92                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
    93 
    94         *copied = (size_t)a_copied;
    95         *needed = (size_t)a_needed;
    96 
     92       
     93        async_exch_t *exch = async_exchange_begin(sess);
     94        int rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_AREAS_READ,
     95            (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
     96       
     97        *copied = (size_t) a_copied;
     98        *needed = (size_t) a_needed;
     99       
    97100        return rc;
    98101}
    99102
    100 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n)
     103int udebug_mem_read(async_sess_t *sess, void *buffer, uintptr_t addr, size_t n)
    101104{
    102         return async_req_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
    103             (sysarg_t)buffer, addr, n);
     105        async_exch_t *exch = async_exchange_begin(sess);
     106        return async_req_4_0(exch, IPC_M_DEBUG, UDEBUG_M_MEM_READ,
     107            (sysarg_t) buffer, addr, n);
    104108}
    105109
    106 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer)
     110int udebug_args_read(async_sess_t *sess, thash_t tid, sysarg_t *buffer)
    107111{
    108         return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
    109             tid, (sysarg_t)buffer);
     112        async_exch_t *exch = async_exchange_begin(sess);
     113        return async_req_3_0(exch, IPC_M_DEBUG, UDEBUG_M_ARGS_READ,
     114            tid, (sysarg_t) buffer);
    110115}
    111116
    112 int udebug_regs_read(int phoneid, thash_t tid, void *buffer)
     117int udebug_regs_read(async_sess_t *sess, thash_t tid, void *buffer)
    113118{
    114         return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,
    115             tid, (sysarg_t)buffer);
     119        async_exch_t *exch = async_exchange_begin(sess);
     120        return async_req_3_0(exch, IPC_M_DEBUG, UDEBUG_M_REGS_READ,
     121            tid, (sysarg_t) buffer);
    116122}
    117123
    118 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
     124int udebug_go(async_sess_t *sess, thash_t tid, udebug_event_t *ev_type,
    119125    sysarg_t *val0, sysarg_t *val1)
    120126{
    121127        sysarg_t a_ev_type;
    122         int rc;
    123 
    124         rc =  async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
     128       
     129        async_exch_t *exch = async_exchange_begin(sess);
     130        int rc = async_req_2_3(exch, IPC_M_DEBUG, UDEBUG_M_GO,
    125131            tid, &a_ev_type, val0, val1);
    126 
     132       
    127133        *ev_type = a_ev_type;
    128134        return rc;
    129135}
    130136
    131 int udebug_stop(int phoneid, thash_t tid)
     137int udebug_stop(async_sess_t *sess, thash_t tid)
    132138{
    133         return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_STOP,
    134             tid);
     139        async_exch_t *exch = async_exchange_begin(sess);
     140        return async_req_2_0(exch, IPC_M_DEBUG, UDEBUG_M_STOP, tid);
    135141}
    136142
Note: See TracChangeset for help on using the changeset viewer.