From 06ea6cd46241c2f2b8488a980f9fb898331a214e Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Sun, 16 Mar 2014 11:41:51 +0100 Subject: [PATCH] hw: simplify result of Kernel::access_thread_regs ref #1101 --- base-hw/src/core/kernel/core_interface.h | 20 +++++++++----------- base-hw/src/core/kernel/thread.cc | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/base-hw/src/core/kernel/core_interface.h b/base-hw/src/core/kernel/core_interface.h index ea8c78444..026cd6f7f 100644 --- a/base-hw/src/core/kernel/core_interface.h +++ b/base-hw/src/core/kernel/core_interface.h @@ -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,11 +198,11 @@ namespace Kernel * ... ... * (writes - 1) * sizeof(addr_t): write value #writes */ - inline int access_thread_regs(unsigned const thread_id, - unsigned const reads, - unsigned const writes, - addr_t * const read_values, - addr_t * const write_values) + inline unsigned access_thread_regs(unsigned const thread_id, + unsigned const reads, + unsigned const writes, + addr_t * const read_values, + addr_t * const write_values) { return call(call_id_access_thread_regs(), thread_id, reads, writes, (Call_arg)read_values, (Call_arg)write_values); diff --git a/base-hw/src/core/kernel/thread.cc b/base-hw/src/core/kernel/thread.cc index a9360f30e..b16b4ad88 100644 --- a/base-hw/src/core/kernel/thread.cc +++ b/base-hw/src/core/kernel/thread.cc @@ -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();