From 261aa2b9b790868a16a6cee0f19c73221ddc81d5 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 22 Jun 2010 16:41:25 -0500 Subject: Program exception handling and emulated instruction for mfsprg3. --- src/lib/syscall_task.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/syscall_task.C b/src/lib/syscall_task.C index d07ea3f19..405e4f202 100644 --- a/src/lib/syscall_task.C +++ b/src/lib/syscall_task.C @@ -1,6 +1,7 @@ #include #include #include +#include using namespace Systemcalls; @@ -23,5 +24,11 @@ void task_end() tid_t task_gettid() { - return (tid_t)_syscall0(TASK_GETTID); + // Even though we have a syscall for GETTID, we can implement this as a + // direct access to SPRG3. On processor that do not support unprivilaged + // access to this SPR, we implement it as an emulated instruction in the + // exception handler. + + return TaskManager::getCurrentTask()->tid; + //return (tid_t)_syscall0(TASK_GETTID); } -- cgit v1.2.1