1.1 --- a/dispatch.c Thu Dec 05 23:42:47 2019 +0100
1.2 +++ b/dispatch.c Sun Dec 15 19:01:38 2019 +0100
1.3 @@ -68,7 +68,7 @@
1.4
1.5 void write_dispatcher_cases(struct signature *sig, FILE *fp, struct interface *iface)
1.6 {
1.7 - char *opcode, *opname, *protocol, *prefix;
1.8 + char *opcode, *opname, *protocol, *prefix, *s;
1.9
1.10 if (sig == NULL)
1.11 return;
1.12 @@ -77,9 +77,16 @@
1.13 opcode = get_opcode_identifier(NULL, opname);
1.14 prefix = get_operation_wrapper_prefix(sig->attributes);
1.15
1.16 + /* Generate a reply if appropriate. */
1.17 +
1.18 + if (have_attribute(sig->attributes, "completion"))
1.19 + s = dispatch_function_wrapper_case;
1.20 + else
1.21 + s = dispatch_function_reply_wrapper_case;
1.22 +
1.23 /* Generate the case and invocation. */
1.24
1.25 - fprintf(fp, dispatch_function_wrapper_case, opcode, prefix, opname);
1.26 + fprintf(fp, s, opcode, prefix, opname);
1.27
1.28 /* Generate the other cases. */
1.29
2.1 --- a/server.c Thu Dec 05 23:42:47 2019 +0100
2.2 +++ b/server.c Sun Dec 15 19:01:38 2019 +0100
2.3 @@ -150,6 +150,10 @@
2.4
2.5 write_accessor_declaration(input_words, output_words, opname, fp);
2.6
2.7 + /* Handle superfluous message structures. */
2.8 +
2.9 + write_superfluous_message_cast(fp, input_words, input_items, output_words, output_items);
2.10 +
2.11 /* Unpack each word and item from the message into variables. */
2.12
2.13 write_input_initialisation(param, fp, opname, input_words, input_items);
2.14 @@ -196,6 +200,10 @@
2.15
2.16 write_accessor_declaration(input_words, 0, opname, fp);
2.17
2.18 + /* Handle superfluous message structures. */
2.19 +
2.20 + write_superfluous_message_cast(fp, input_words, input_items, 0, 0);
2.21 +
2.22 /* Unpack each word and item from the message into variables. */
2.23
2.24 write_input_initialisation(param, fp, opname, input_words, input_items);
2.25 @@ -252,6 +260,15 @@
2.26 free(opname);
2.27 }
2.28
2.29 +/* Generate a cast for superfluous message structures. */
2.30 +
2.31 +void write_superfluous_message_cast(FILE *fp, int input_words, int input_items,
2.32 + int output_words, int output_items)
2.33 +{
2.34 + if (!input_words && !input_items && !output_words && !output_items)
2.35 + fputs(server_function_body_unused_message, fp);
2.36 +}
2.37 +
2.38 /* Generate the initialisation of input words and items. */
2.39
2.40 void write_input_initialisation(struct parameter *param, FILE *fp,
3.1 --- a/server.h Thu Dec 05 23:42:47 2019 +0100
3.2 +++ b/server.h Sun Dec 15 19:01:38 2019 +0100
3.3 @@ -69,6 +69,9 @@
3.4
3.5 /* Common function body code generation. */
3.6
3.7 +void write_superfluous_message_cast(FILE *fp, int input_words, int input_items,
3.8 + int output_words, int output_items);
3.9 +
3.10 void write_input_initialisation(struct parameter *param, FILE *fp,
3.11 const char *opname, int input_words,
3.12 int input_items);
4.1 --- a/templates.h Thu Dec 05 23:42:47 2019 +0100
4.2 +++ b/templates.h Sun Dec 15 19:01:38 2019 +0100
4.3 @@ -89,6 +89,7 @@
4.4 #define compound_dispatch_epilogue \
4.5 " default:\n" \
4.6 " ipc_message_send_error(msg, -L4_EBADPROTO);\n" \
4.7 +" ipc_message_reply(msg);\n" \
4.8 " break;\n" \
4.9 " }\n"
4.10
4.11 @@ -151,13 +152,15 @@
4.12 #define server_function_body_prologue \
4.13 " long err;\n"
4.14
4.15 +#define server_function_body_unused_message \
4.16 +"\n (void) msg;\n"
4.17 +
4.18 #define server_function_body_call \
4.19 " if (err)\n" \
4.20 " return err;\n"
4.21
4.22 #define server_function_body_epilogue \
4.23 -"\n ipc_message_reply(msg);\n\n" \
4.24 - " return l4_error(msg->tag);\n"
4.25 +"\n return L4_EOK;\n"
4.26
4.27 #define server_completion_function_signature_prologue \
4.28 "\nlong complete_%s(l4_cap_idx_t _endp"
4.29 @@ -171,13 +174,14 @@
4.30
4.31 #define server_initiation_function_body_epilogue \
4.32 "\n ipc_message_prepare(msg);\n\n" \
4.33 - " return l4_error(msg->tag);\n"
4.34 + " return L4_EOK;\n"
4.35
4.36 /* Server dispatch function templates. */
4.37
4.38 #define server_function_dispatcher_body_epilogue \
4.39 " default:\n" \
4.40 " ipc_message_send_error(msg, -L4_EBADPROTO);\n" \
4.41 +" ipc_message_reply(msg);\n" \
4.42 " break;\n" \
4.43 " }\n"
4.44
4.45 @@ -281,6 +285,12 @@
4.46 " ipc_message_send_error(msg, %s_%s(msg, _self));\n" \
4.47 " break;\n\n"
4.48
4.49 +#define dispatch_function_reply_wrapper_case \
4.50 +" case %s:\n" \
4.51 +" ipc_message_send_error(msg, %s_%s(msg, _self));\n" \
4.52 +" ipc_message_reply(msg);\n" \
4.53 +" break;\n\n"
4.54 +
4.55 /* Tokens. */
4.56
4.57 #define BEGIN_FUNCTION "\n{\n"