hw: simplify result of Kernel::access_thread_regs

ref #1101
This commit is contained in:
Martin Stein 2014-03-16 11:41:51 +01:00 committed by Norman Feske
parent 1eeba3ed73
commit 06ea6cd462
2 changed files with 13 additions and 15 deletions

View File

@ -177,13 +177,11 @@ namespace Kernel
* \param read_values base of value buffer for read operations
* \param write_values base of value buffer for write operations
*
* \retval 0 all operations done
* \retval >0 amount of undone operations
* \retval -1 failed to start processing operations
* \return amount of undone operations according to the execution order
*
* Operations are processed in order of the appearance of the register
* names in the callers UTCB. If reads = 0, read_values is of no relevance.
* If writes = 0, write_values is of no relevance.
* Operations are executed in order of the appearance of the register names
* in the callers UTCB. If reads = 0, read_values is of no relevance. If
* writes = 0, write_values is of no relevance.
*
* Expected structure at the callers UTCB base:
*
@ -200,7 +198,7 @@ namespace Kernel
* ... ...
* (writes - 1) * sizeof(addr_t): write value #writes
*/
inline int access_thread_regs(unsigned const thread_id,
inline unsigned access_thread_regs(unsigned const thread_id,
unsigned const reads,
unsigned const writes,
addr_t * const read_values,

View File

@ -553,9 +553,11 @@ unsigned Thread_event::signal_context_id() const
void Thread::_call_access_thread_regs()
{
/* check permissions */
unsigned const reads = user_arg_2();
unsigned const writes = user_arg_3();
if (!_core()) {
PWRN("not entitled to access thread regs");
user_arg_0(-1);
user_arg_0(reads + writes);
return;
}
/* get targeted thread */
@ -563,12 +565,10 @@ void Thread::_call_access_thread_regs()
Thread * const t = Thread::pool()->object(thread_id);
if (!t) {
PWRN("unknown thread");
user_arg_0(-1);
user_arg_0(reads + writes);
return;
}
/* execute read operations */
unsigned const reads = user_arg_2();
unsigned const writes = user_arg_3();
addr_t * const utcb = (addr_t *)_utcb_phys->base();
addr_t * const read_ids = &utcb[0];
addr_t * const read_values = (addr_t *)user_arg_4();