Hi everybody,
I am currently playing with flexpages. I have written simple client/server application which sends data to each other using flexpages. I have written a simple IDL file for the server interface. The first version was the following :
library test_server { interface worker { int send_data([in] flexpage page, [out, max_is(4096)] char reply[]); }; };
The client sends data through the flexpage, and the server replies using string ipc. This way the DICE generated code compiles without error, and my application works. Then I wanted the server to reply also through a flexpage, but another one than the page provided by the client application. So I modify my IDL this way :
library test_server { interface worker { int send_data([in] flexpage page, [out, in] flexpage reply); }; };
I use [out, in] because this way the client can first assign the snd_base before sending the request. After modifying my client lib and the component function accordingly, I get a compile error in a DICE generated file : /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c: In function `test_server_worker_wait_any': /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: `_dice_tmp_offset' undeclared (first use in this function) /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: (Each undeclared identifier is reported only once /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: for each function it appears in.) /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c: In function `test_server_worker_reply_and_wait': /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:172: error: `_dice_tmp_offset' undeclared (first use in this function)
What I see in the generated file :
filter_server_worker_wait_any (...) { ... if (l4_ipc_fpage_received(_dice_result)) { _dice_tmp_offset = 0; while ((_dice_msg_buffer->_word._word[0][_dice_tmp_offset++] != 0) && (_dice_msg_buffer->_word._word[0][_dice_tmp_offset++] != 0)) /* empty */; /* skip zero fpage */ _dice_tmp_offset += 2; _dice_opcode = _dice_msg_buffer->_word._word[0]; } else _dice_opcode = _dice_msg_buffer->_word._word[0]; return _dice_opcode; }
The _dice_tmp_offset is not declared, the second error (line 172) is about the same thing (it is exactly the same code in reply_and_wait()). So I have tried to declare _dice_tmp_offset as an unsigned int, then I have : /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c: In function `filter_server_worker_wait_any': /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c:92: error: subscripted value is neither array nor pointer /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c:92: error: subscripted value is neither array nor pointer
(The line 92 is the one with while(...)). Indeed after looking the code I find it really strange, as _word[0] is a register.... More _dice_tmp_offset is incremented by two after the while loop and never used after... I really don't understand this code...
If I only set the reply flexpage as [in], I have the same behavior...
Am I doing something wrong ? Could it be a bug in DICE ? Is it permitted to use one in-flexpage and one out-flexpage for the same function ? Is there something special to do ?
Thanks,
Clermont, Nicolas wrote on 08/01/2007 02:49 PM this:
Hi everybody,
I am currently playing with flexpages. I have written simple client/server application which sends data to each other using flexpages. I have written a simple IDL file for the server interface. The first version was the following :
library test_server { interface worker { int send_data([in] flexpage page, [out, max_is(4096)] char reply[]); }; };
The client sends data through the flexpage, and the server replies using string ipc. This way the DICE generated code compiles without error, and my application works. Then I wanted the server to reply also through a flexpage, but another one than the page provided by the client application. So I modify my IDL this way :
library test_server { interface worker { int send_data([in] flexpage page, [out, in] flexpage reply); }; };
I use [out, in] because this way the client can first assign the snd_base before sending the request.
Note, that the "reply" parameter will be sent as a flexpage to the server, that is, the page described by "reply" will be mapped. If you just want to tell the server the send-base it should use, write smething like this:
int send_data([in] flexpage page, [in] unsigned long send_base, [out] flexpage *reply);
After modifying my client lib and the component function accordingly, I get a compile error in a DICE generated file : /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c: In function `test_server_worker_wait_any': /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: `_dice_tmp_offset' undeclared (first use in this function) /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: (Each undeclared identifier is reported only once /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:91: error: for each function it appears in.) /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c: In function `test_server_worker_reply_and_wait': /home/nico/build-tudos/pkg/test_server/idl/OBJ-x86-l4v2/test_server_worker-s erver.c:172: error: `_dice_tmp_offset' undeclared (first use in this function)
What I see in the generated file :
filter_server_worker_wait_any (...) { ... if (l4_ipc_fpage_received(_dice_result)) { _dice_tmp_offset = 0; while ((_dice_msg_buffer->_word._word[0][_dice_tmp_offset++] != 0) && (_dice_msg_buffer->_word._word[0][_dice_tmp_offset++] != 0)) /* empty */; /* skip zero fpage */ _dice_tmp_offset += 2; _dice_opcode = _dice_msg_buffer->_word._word[0]; } else _dice_opcode = _dice_msg_buffer->_word._word[0]; return _dice_opcode; }
The _dice_tmp_offset is not declared, the second error (line 172) is about the same thing (it is exactly the same code in reply_and_wait()). So I have tried to declare _dice_tmp_offset as an unsigned int, then I have : /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c: In function `filter_server_worker_wait_any': /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c:92: error: subscripted value is neither array nor pointer /home/clermont/build-tudos/pkg/filter_server/idl/OBJ-x86-l4v2/filter_server_ worker-server.c:92: error: subscripted value is neither array nor pointer
(The line 92 is the one with while(...)). Indeed after looking the code I find it really strange, as _word[0] is a register.... More _dice_tmp_offset is incremented by two after the while loop and never used after... I really don't understand this code...
If I only set the reply flexpage as [in], I have the same behavior...
Am I doing something wrong ?
No.
Could it be a bug in DICE ?
Yes. Fix attached. Should be in public repository tomorrow.
Is it permitted to use one in-flexpage and one out-flexpage for the same function ?
Yes.
Is there something special to do ?
If you want to receive a flexpage from the server, you will have to set the IPC flexpage receive window in the client. The Dice generated code uses the rcv_fpage member in the CORBA_Environment parameter of the *_call functions to do this. Thus, you have to set this member appropriately. Per default this member is set to L4_WHOLE_ADDRESS_SPACE (dice_default_environment).
Thanks for the bug-report, Ron.
l4-hackers@os.inf.tu-dresden.de