base-hw: reply to IPC without awaiting the next

Fix #544
This commit is contained in:
Martin Stein 2012-11-30 10:33:57 +01:00 committed by Norman Feske
parent 46a6cb680a
commit 8037277447
4 changed files with 25 additions and 30 deletions

View File

@ -48,7 +48,7 @@ namespace Kernel
/* interprocess communication */ /* interprocess communication */
REQUEST_AND_WAIT = 8, REQUEST_AND_WAIT = 8,
REPLY_AND_WAIT = 9, REPLY = 9,
WAIT_FOR_REQUEST = 10, WAIT_FOR_REQUEST = 10,
/* management of resource protection-domains */ /* management of resource protection-domains */
@ -310,14 +310,17 @@ namespace Kernel
/** /**
* Send reply of the last received request and wait for next request * Reply to last IPC request
* *
* \param size reply-message size (beginning with the callers UTCB base) * \param size reply size (beginning with the callers UTCB base)
* \param await_request if the call shall await and fetch next request
* *
* \return size of received request (beginning with the callers UTCB base) * \return request size (beginning with the callers UTCB base)
* if await_request was set
*/ */
inline unsigned long reply_and_wait(unsigned long const size) inline unsigned long reply(unsigned long const size,
{ return (unsigned long)syscall(REPLY_AND_WAIT, size); } bool const await_request) {
return (unsigned long)syscall(REPLY, size, await_request); }
/** /**

View File

@ -194,11 +194,7 @@ void Ipc_server::_wait()
} }
void Ipc_server::_reply() void Ipc_server::_reply() { Kernel::reply(_write_offset, 0); }
{
kernel_log() << __PRETTY_FUNCTION__ << ": Unexpected call\n";
while (1) ;
}
void Ipc_server::_reply_wait() void Ipc_server::_reply_wait()
@ -212,7 +208,7 @@ void Ipc_server::_reply_wait()
/* send reply and receive next request */ /* send reply and receive next request */
copy_msgbuf_to_utcb(_snd_msg, _write_offset, copy_msgbuf_to_utcb(_snd_msg, _write_offset,
Ipc_ostream::_dst.local_name()); Ipc_ostream::_dst.local_name());
copy_utcb_to_msgbuf(_rcv_msg, Kernel::reply_and_wait(_write_offset)); copy_utcb_to_msgbuf(_rcv_msg, Kernel::reply(_write_offset, 1));
/* update server state */ /* update server state */
_prepare_next_reply_wait(); _prepare_next_reply_wait();

View File

@ -114,7 +114,7 @@ void Ipc_pager::wait_for_fault()
/* resume faulter, send ack to RM and get the next message */ /* resume faulter, send ack to RM and get the next message */
Kernel::resume_thread(msg->pager_object->badge()); Kernel::resume_thread(msg->pager_object->badge());
s = Kernel::reply_and_wait(0); s = Kernel::reply(0, 1);
continue; } continue; }
default: { default: {

View File

@ -531,25 +531,19 @@ namespace Kernel
} }
/** /**
* Reply last request if there's any and await next request * Reply to last request if there's any
* *
* \param reply_base base of the reply payload * \param reply_base base of the reply payload
* \param reply_size size of the reply payload * \param reply_size size of the reply payload
* \param inbuf_base base of the request buffer
* \param inbuf_size size of the request buffer
*/ */
inline void send_reply_await_request(void * const reply_base, inline void send_reply(void * const reply_base,
size_t const reply_size, size_t const reply_size)
void * const inbuf_base,
size_t const inbuf_size)
{ {
/* reply to the last request if we have to */ /* reply to the last request if we have to */
if (_state == PREPARE_REPLY) { if (_state == PREPARE_REPLY) {
_inbuf.origin->_receive_reply(reply_base, reply_size); _inbuf.origin->_receive_reply(reply_base, reply_size);
_state = INACTIVE; _state = INACTIVE;
} }
/* await next request */
await_request(inbuf_base, inbuf_size);
} }
/** /**
@ -1232,13 +1226,15 @@ namespace Kernel
} }
/** /**
* Reply to the last request and await the next one * Reply to the last request
*/ */
void reply_and_wait(size_t const size) void reply(size_t const size, bool const await_request)
{ {
Ipc_node::send_reply_await_request(phys_utcb()->base(), size, Ipc_node::send_reply(phys_utcb()->base(), size);
phys_utcb()->base(), if (await_request)
phys_utcb()->size()); Ipc_node::await_request(phys_utcb()->base(),
phys_utcb()->size());
else user_arg_0(0);
} }
/** /**
@ -1828,8 +1824,8 @@ namespace Kernel
/** /**
* Do specific syscall for 'user', for details see 'syscall.h' * Do specific syscall for 'user', for details see 'syscall.h'
*/ */
void do_reply_and_wait(Thread * const user) void do_reply(Thread * const user) {
{ user->reply_and_wait((size_t)user->user_arg_1()); } user->reply((size_t)user->user_arg_1(), (bool)user->user_arg_2()); }
/** /**
@ -2075,7 +2071,7 @@ namespace Kernel
/* 6 */ do_current_thread_id, /* 6 */ do_current_thread_id,
/* 7 */ do_yield_thread, /* 7 */ do_yield_thread,
/* 8 */ do_request_and_wait, /* 8 */ do_request_and_wait,
/* 9 */ do_reply_and_wait, /* 9 */ do_reply,
/* 10 */ do_wait_for_request, /* 10 */ do_wait_for_request,
/* 11 */ do_set_pager, /* 11 */ do_set_pager,
/* 12 */ do_update_pd, /* 12 */ do_update_pd,