[kernel] Remove thread_data pointer from TCB
The TCB is always stored at a constant offset within the thread object. So instead of carrying an extra pointer, just implement thread::from_tcb to get the thread.
This commit is contained in:
@@ -27,8 +27,6 @@ struct TCB
|
||||
|
||||
uint32_t time_left;
|
||||
uint64_t last_ran;
|
||||
|
||||
thread *thread_data;
|
||||
};
|
||||
|
||||
using tcb_list = kutil::linked_list<TCB>;
|
||||
@@ -47,6 +45,9 @@ public:
|
||||
none = 0x00
|
||||
};
|
||||
|
||||
/// Get the pointer to the thread object containing this TCB
|
||||
static thread * from_tcb(TCB *tcb);
|
||||
|
||||
/// Get the `ready` state of the thread.
|
||||
/// \returns True if the thread is ready to execute.
|
||||
inline bool ready() const { return has_state(state::ready); }
|
||||
|
||||
Reference in New Issue
Block a user