--- Gnu-Mach/kern/thread.c 2020/09/02 04:52:05 1.1.1.7 +++ Gnu-Mach/kern/thread.c 2020/09/02 04:54:10 1.1.1.8 @@ -342,7 +342,7 @@ void thread_init(void) /* thread_template.sched_stamp (later) */ thread_template.recover = (vm_offset_t) 0; - thread_template.vm_privilege = FALSE; + thread_template.vm_privilege = 0; thread_template.user_stop_count = 1; @@ -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; } @@ -2221,11 +2233,11 @@ thread_wire( thread_lock(thread); if (wired) { - thread->vm_privilege = TRUE; + thread->vm_privilege = 1; stack_privilege(thread); } else { - thread->vm_privilege = FALSE; + thread->vm_privilege = 0; /*XXX stack_unprivilege(thread); */ thread->stack_privilege = 0; }