From 3cbc65ac29de0a86cf0a8dbe9c7ab6c399016435 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 25 Sep 2015 18:22:13 -0500 Subject: [PATCH] XThread Get/Set Last Error --- src/xenia/kernel/xthread.cc | 10 ++++++++++ src/xenia/kernel/xthread.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index 5b28865c6..261d7913f 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -107,6 +107,16 @@ uint32_t XThread::GetCurrentThreadId() { return thread->guest_object()->thread_id; } +uint32_t XThread::GetLastError() { + XThread* thread = XThread::GetCurrentThread(); + return thread->last_error(); +} + +void XThread::SetLastError(uint32_t error_code) { + XThread* thread = XThread::GetCurrentThread(); + thread->set_last_error(error_code); +} + uint32_t XThread::last_error() { return guest_object()->last_error; } void XThread::set_last_error(uint32_t error_code) { diff --git a/src/xenia/kernel/xthread.h b/src/xenia/kernel/xthread.h index d6e6af0d9..130f088bc 100644 --- a/src/xenia/kernel/xthread.h +++ b/src/xenia/kernel/xthread.h @@ -122,6 +122,9 @@ class XThread : public XObject { static uint32_t GetCurrentThreadHandle(); static uint32_t GetCurrentThreadId(); + static uint32_t GetLastError(); + static void SetLastError(uint32_t error_code); + const CreationParams* creation_params() const { return &creation_params_; } uint32_t tls_ptr() const { return tls_address_; } uint32_t pcr_ptr() const { return pcr_address_; }