aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/thread.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kern/thread.c b/kern/thread.c
index a8211491..7db1f3d2 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1425,6 +1425,12 @@ kern_return_t thread_get_state(
{
kern_return_t ret;
+#if defined(__i386__) || defined(__x86_64__)
+ if (flavor == i386_DEBUG_STATE && thread == current_thread())
+ /* This state can be obtained directly for the curren thread. */
+ return thread_getstatus(thread, flavor, old_state, old_state_count);
+#endif
+
if (thread == THREAD_NULL || thread == current_thread()) {
return KERN_INVALID_ARGUMENT;
}
@@ -1449,6 +1455,12 @@ kern_return_t thread_set_state(
{
kern_return_t ret;
+#if defined(__i386__) || defined(__x86_64__)
+ if (flavor == i386_DEBUG_STATE && thread == current_thread())
+ /* This state can be set directly for the curren thread. */
+ return thread_setstatus(thread, flavor, new_state, new_state_count);
+#endif
+
if (thread == THREAD_NULL || thread == current_thread()) {
return KERN_INVALID_ARGUMENT;
}