bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 gnumach] Enable MACH_HOST and fix non-addressable bitfields


From: Damien Zammit
Subject: [PATCH v2 gnumach] Enable MACH_HOST and fix non-addressable bitfields
Date: Sun, 11 Feb 2024 12:00:29 +0000

This is only enabled when NCPUS > 1.
Enables some older code paths that allows userspace
to manage cpu resources via processor set RPCs.

Size of struct task is preserved while making 4 bitfields
addressable as 4 single byte fields.

---
 configfrag.ac |  8 ++++++--
 kern/task.h   | 10 +++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/configfrag.ac b/configfrag.ac
index f9285c9d..b8b41261 100644
--- a/configfrag.ac
+++ b/configfrag.ac
@@ -70,8 +70,12 @@ AC_DEFINE([MACH_DEBUG], [1], [MACH_DEBUG])
 # Fixed priority threads.
 AC_DEFINE([MACH_FIXPRI], [1], [MACH_FIXPRI])
 
-# Mach host (resource alloc.).
-AC_DEFINE([MACH_HOST], [0], [MACH_HOST])
+# Mach host (cpu resource alloc.).
+[if [ $mach_ncpus -gt 1 ]; then]
+  AC_DEFINE([MACH_HOST], [1], [MACH_HOST])
+[else]
+  AC_DEFINE([MACH_HOST], [0], [MACH_HOST])
+[fi]
 
 # IPC debugging calls.
 AC_DEFINE([MACH_IPC_DEBUG], [1], [MACH_IPC_DEBUG])
diff --git a/kern/task.h b/kern/task.h
index dec3a530..27970620 100644
--- a/kern/task.h
+++ b/kern/task.h
@@ -61,11 +61,11 @@ struct task {
        decl_simple_lock_data(,lock)    /* Task's lock */
        int             ref_count;      /* Number of references to me */
 
-       /* Flags */
-       unsigned int    active:1,       /* Task has not been terminated */
-       /* boolean_t */ may_assign:1,   /* can assigned pset be changed? */
-                       assign_active:1,        /* waiting for may_assign */
-                       essential:1;    /* Is this task essential for the 
system? */
+       /* Addressable flags */
+       unsigned char   active;         /* Task has not been terminated */
+       unsigned char   may_assign;     /* can assigned pset be changed? */
+       unsigned char   assign_active;  /* waiting for may_assign */
+       unsigned char   essential;      /* Is this task essential for the 
system? */
 
        /* Miscellaneous */
        vm_map_t        map;            /* Address space description */
-- 
2.43.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]