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

@@ -6,6 +6,8 @@
#include <socks/cpu.h>
#include <socks/libc/stdio.h>
#define TASK_CAST(p) OBJECT_C_CAST(struct task, t_base, &task_type, p)
static struct object_type task_type = {
.ob_name = "task",
.ob_size = sizeof(struct task),
@@ -144,7 +146,7 @@ struct task *task_alloc(void)
return NULL;
}
struct task *t = object_data(task_obj);
struct task *t = TASK_CAST(task_obj);
memset(t, 0x00, sizeof *t);
return t;
}

View File

@@ -3,6 +3,8 @@
#include <socks/cpu.h>
#include <socks/machine/thread.h>
#define THREAD_CAST(p) OBJECT_C_CAST(struct thread, thr_base, &thread_type, p)
static struct object_type thread_type = {
.ob_name = "thread",
.ob_size = sizeof(struct thread),
@@ -20,7 +22,7 @@ struct thread *thread_alloc(void)
return NULL;
}
struct thread *t = object_data(thread_obj);
struct thread *t = THREAD_CAST(thread_obj);
memset(t, 0x00, sizeof *t);
return t;
}