obj: object header is no longer allocated automatically

This commit is contained in:
2023-05-06 19:48:14 +01:00
parent 79c30e5393
commit f52ca2f1e2
13 changed files with 97 additions and 66 deletions

View File

@@ -53,6 +53,8 @@ enum sched_mode {
};
struct task {
struct object t_base;
struct task *t_parent;
unsigned int t_id;
enum task_state t_state;
@@ -66,6 +68,8 @@ struct task {
};
struct thread {
struct object thr_base;
enum thread_state tr_state;
enum thread_flags tr_flags;
struct task *tr_parent;
@@ -131,8 +135,8 @@ static inline void rq_unlock(struct runqueue *rq, unsigned long flags)
extern struct runqueue *cpu_rq(unsigned int cpu);
extern struct task *task_alloc(void);
static inline struct task *task_ref(struct task *task) { return (struct task *)object_data(object_ref(object_header(task))); }
static inline void task_deref(struct task *task) { object_deref(object_header(task)); }
static inline struct task *task_ref(struct task *task) { return OBJECT_CAST(struct task, t_base, object_ref(&task->t_base)); }
static inline void task_deref(struct task *task) { object_deref(&task->t_base); }
extern struct task *task_from_pid(unsigned int pid);
extern struct task *kernel_task(void);
extern struct task *idle_task(void);
@@ -150,12 +154,12 @@ extern void end_charge_period(void);
static inline void task_lock_irqsave(struct task *task, unsigned long *flags)
{
object_lock(object_header(task), flags);
object_lock(&task->t_base, flags);
}
static inline void task_unlock_irqrestore(struct task *task, unsigned long flags)
{
object_unlock(object_header(task), flags);
object_unlock(&task->t_base, flags);
}
extern struct thread *thread_alloc(void);