[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:
2020-07-19 17:01:15 -07:00
parent ef5c333030
commit c3abe035c8
5 changed files with 20 additions and 12 deletions

View File

@@ -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); }