kernel: use a union for kobject data values

Rather than stuffing various values in a uintptr_t based on
type using casts, use a union for this instead.

No functional difference, but the semantics of the data member
are now much clearer to the casual observer since it is now
formally defined by this union.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-03-11 06:37:42 -07:00 committed by Andrew Boie
commit f2734ab022
8 changed files with 46 additions and 16 deletions

View file

@ -71,10 +71,10 @@ class KobjectInstance:
self.data = thread_counter
thread_counter = thread_counter + 1
elif self.type_obj.name == "sys_mutex":
self.data = "(uintptr_t)(&kernel_mutexes[%d])" % sys_mutex_counter
self.data = "&kernel_mutexes[%d]" % sys_mutex_counter
sys_mutex_counter += 1
elif self.type_obj.name == "k_futex":
self.data = "(uintptr_t)(&futex_data[%d])" % futex_counter
self.data = "&futex_data[%d]" % futex_counter
futex_counter += 1
else:
self.data = 0