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

View File

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