From 77f55232fdb5241bd530f5f2aec1857807a0bc7a Mon Sep 17 00:00:00 2001
From: Martin Stein <martin.stein@genode-labs.com>
Date: Fri, 15 Nov 2013 17:13:15 +0100
Subject: [PATCH] hw: remove Kernel::get_thread

ref #953
---
 base-hw/include/kernel/interface.h | 63 +++++++++++-------------------
 base-hw/src/core/kernel/thread.cc  | 23 -----------
 base-hw/src/core/kernel/thread.h   |  1 -
 3 files changed, 23 insertions(+), 64 deletions(-)

diff --git a/base-hw/include/kernel/interface.h b/base-hw/include/kernel/interface.h
index 39d7e6e4d9..90ba15bdb0 100644
--- a/base-hw/include/kernel/interface.h
+++ b/base-hw/include/kernel/interface.h
@@ -43,30 +43,29 @@ namespace Kernel
 			START_THREAD         = 2,
 			PAUSE_THREAD         = 3,
 			RESUME_THREAD        = 4,
-			GET_THREAD           = 5,
-			CURRENT_THREAD_ID    = 6,
-			YIELD_THREAD         = 7,
-			ACCESS_THREAD_REGS   = 8,
-			ROUTE_THREAD_EVENT   = 9,
-			UPDATE_PD            = 10,
-			UPDATE_REGION        = 11,
-			NEW_PD               = 12,
-			KILL_PD              = 13,
-			REQUEST_AND_WAIT     = 14,
-			REPLY                = 15,
-			WAIT_FOR_REQUEST     = 16,
-			NEW_SIGNAL_RECEIVER  = 17,
-			NEW_SIGNAL_CONTEXT   = 18,
-			KILL_SIGNAL_CONTEXT  = 19,
-			KILL_SIGNAL_RECEIVER = 20,
-			SUBMIT_SIGNAL        = 21,
-			AWAIT_SIGNAL         = 22,
-			SIGNAL_PENDING       = 23,
-			ACK_SIGNAL           = 24,
-			NEW_VM               = 25,
-			RUN_VM               = 26,
-			PAUSE_VM             = 27,
-			PRINT_CHAR           = 28,
+			CURRENT_THREAD_ID    = 5,
+			YIELD_THREAD         = 6,
+			ACCESS_THREAD_REGS   = 7,
+			ROUTE_THREAD_EVENT   = 8,
+			UPDATE_PD            = 9,
+			UPDATE_REGION        = 10,
+			NEW_PD               = 11,
+			KILL_PD              = 12,
+			REQUEST_AND_WAIT     = 13,
+			REPLY                = 14,
+			WAIT_FOR_REQUEST     = 15,
+			NEW_SIGNAL_RECEIVER  = 16,
+			NEW_SIGNAL_CONTEXT   = 17,
+			KILL_SIGNAL_CONTEXT  = 18,
+			KILL_SIGNAL_RECEIVER = 19,
+			SUBMIT_SIGNAL        = 20,
+			AWAIT_SIGNAL         = 21,
+			SIGNAL_PENDING       = 22,
+			ACK_SIGNAL           = 23,
+			NEW_VM               = 24,
+			RUN_VM               = 25,
+			PAUSE_VM             = 26,
+			PRINT_CHAR           = 27,
 		};
 	};
 
@@ -309,22 +308,6 @@ namespace Kernel
 	}
 
 
-	/**
-	 * Get platform thread by the kernel name of a thread
-	 *
-	 * \param id  kernel name of the thread or 0 if the caller targets itself
-	 *
-	 * \retval  0  thread doesn't exist or has no platform thread
-	 * \retval >0  core local address of platform thread
-	 *
-	 * Restricted to core threads.
-	 */
-	inline Platform_thread * get_thread(unsigned const id)
-	{
-		return (Platform_thread *)call(Call_id::GET_THREAD, id);
-	}
-
-
 	/**
 	 * Set or unset the handler of an event a kernel thread-object triggers
 	 *
diff --git a/base-hw/src/core/kernel/thread.cc b/base-hw/src/core/kernel/thread.cc
index e7db9fff66..068cf45c15 100644
--- a/base-hw/src/core/kernel/thread.cc
+++ b/base-hw/src/core/kernel/thread.cc
@@ -471,28 +471,6 @@ void Thread::_call_yield_thread()
 void Thread::_call_current_thread_id() { user_arg_0((Call_ret)id()); }
 
 
-void Thread::_call_get_thread()
-{
-	/* check permissions */
-	if (!_core()) {
-		PERR("not entitled to read address of platform thread");
-		user_arg_0(0);
-		return;
-	}
-	/* lookup thread */
-	unsigned const id = user_arg_1();
-	Thread * t;
-	if (id) {
-		t = Thread::pool()->object(id);
-		if (!t) {
-			PERR("unknown thread");
-			user_arg_0(0);
-		}
-	} else { t = this; }
-	user_arg_0((Call_ret)t->platform_thread());
-}
-
-
 void Thread::_call_wait_for_request()
 {
 	void * buf_base;
@@ -911,7 +889,6 @@ void Thread::_call()
 	case Call_id::START_THREAD:         _call_start_thread(); return;
 	case Call_id::PAUSE_THREAD:         _call_pause_thread(); return;
 	case Call_id::RESUME_THREAD:        _call_resume_thread(); return;
-	case Call_id::GET_THREAD:           _call_get_thread(); return;
 	case Call_id::CURRENT_THREAD_ID:    _call_current_thread_id(); return;
 	case Call_id::YIELD_THREAD:         _call_yield_thread(); return;
 	case Call_id::REQUEST_AND_WAIT:     _call_request_and_wait(); return;
diff --git a/base-hw/src/core/kernel/thread.h b/base-hw/src/core/kernel/thread.h
index 908af0f939..50bab30fa8 100644
--- a/base-hw/src/core/kernel/thread.h
+++ b/base-hw/src/core/kernel/thread.h
@@ -197,7 +197,6 @@ class Kernel::Thread
 		void _call_resume_thread();
 		void _call_yield_thread();
 		void _call_current_thread_id();
-		void _call_get_thread();
 		void _call_wait_for_request();
 		void _call_request_and_wait();
 		void _call_reply();