X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FInterfaces%2FUDI%2Fchannels.c;h=a3894bb7391a1e864ec43441eb0cd511063e1410;hb=4e407e69bd660e9a32644281733192193ee6e8c8;hp=993308b63d0fc2c67989915196757996ef9cbeb3;hpb=e2ff5722101ae7dbb10f51f1477eac625fa30c1e;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Interfaces/UDI/channels.c b/KernelLand/Modules/Interfaces/UDI/channels.c index 993308b6..a3894bb7 100644 --- a/KernelLand/Modules/Interfaces/UDI/channels.c +++ b/KernelLand/Modules/Interfaces/UDI/channels.c @@ -15,6 +15,11 @@ * TODO: This should actually lock the GCB, not the channel */ #define LOCK_CHANNELS 0 +/* + * TRACE_ENDPOINTS + * - Emit a log message with names/indexes of both endpoints + */ +#define TRACE_ENDPOINTS 1 #define MAX_SPAWN_IDX 6 @@ -75,8 +80,6 @@ struct sUDI_ChannelSide *UDI_int_ChannelGetSide(udi_channel_t channel, bool othe if( other_side ) side_idx = 1 - side_idx; - LOG("side_idx = %i, other_side=%b", side_idx, other_side); - return &ch->Side[side_idx]; } @@ -112,6 +115,7 @@ int UDI_BindChannel(udi_channel_t channel, bool other_side, tUDI_DriverInstance if( context ) { // Use provided context pointer + LOG("context = provided %p", context); } else if( ops->chan_context_size ) { @@ -119,16 +123,18 @@ int UDI_BindChannel(udi_channel_t channel, bool other_side, tUDI_DriverInstance ASSERTCR( ops->chan_context_size, >=, sizeof(udi_child_chan_context_t), 4 ); else ASSERTCR( ops->chan_context_size, >=, sizeof(udi_chan_context_t), 4 ); - context = malloc( ops->chan_context_size ); + context = calloc( 1, ops->chan_context_size ); ((udi_chan_context_t*)context)->rdata = rgn->InitContext; if( is_child_bind ) ((udi_child_chan_context_t*)context)->child_ID = child_ID; + LOG("context = allocated %p", context); // TODO: The driver may change the channel context, but this must be freed by the environment UDI_int_ChannelGetSide(channel, other_side)->AllocatedContext = context; } else { context = rgn->InitContext; + LOG("context = region %p", context); } UDI_BindChannel_Raw(channel, other_side, inst, region, ops->meta_ops_num, context, ops->ops_vector); @@ -194,6 +200,13 @@ const void *UDI_int_ChannelPrepForCall(udi_cb_t *gcb, tUDI_MetaLang *metalang, u } } + #if TRACE_ENDPOINTS + struct sUDI_ChannelSide *thisside = UDI_int_ChannelGetSide(gcb->channel, false); + Log("%s:%i -> %s:%i", + (thisside->Instance ? thisside->Instance->Module->ModuleName : "MA"), thisside->RegionIdx, + (newside->Instance ? newside->Instance->Module->ModuleName : "MA"), newside->RegionIdx); + #endif + gcb->channel = (udi_channel_t)&newside->BackPtr; gcb->context = newside->Context; if( !newside->Ops ) {