From c94a786c1ec58c06c9342a060f7945f0fbb7399b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 1 Feb 2023 16:14:19 +0100 Subject: [PATCH] Use EXT() macro instead of extend_get() --- src/emu/nanos6/connect.c | 10 +++++----- src/emu/nanos6/event.c | 20 ++++++++++---------- src/emu/ovni/connect.c | 10 +++++----- src/emu/ovni/event.c | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/emu/nanos6/connect.c b/src/emu/nanos6/connect.c index 84902a1..37867b2 100644 --- a/src/emu/nanos6/connect.c +++ b/src/emu/nanos6/connect.c @@ -30,7 +30,7 @@ static const int *cpu_type = th_type; static int connect_thread_mux(struct emu *emu, struct thread *thread) { - struct nanos6_thread *th = extend_get(&thread->ext, '6'); + struct nanos6_thread *th = EXT(thread, '6'); for (int i = 0; i < CH_MAX; i++) { /* TODO: Let the thread take the select channel @@ -82,7 +82,7 @@ connect_thread_mux(struct emu *emu, struct thread *thread) static int connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv) { - struct nanos6_thread *th = extend_get(&thread->ext, '6'); + struct nanos6_thread *th = EXT(thread, '6'); for (int i = 0; i < CH_MAX; i++) { struct chan *out = th->ch_out[i]; long type = th_type[i]; @@ -100,7 +100,7 @@ static int add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) { for (struct thread *t = emu->system.threads; t; t = t->gnext) { - struct nanos6_thread *th = extend_get(&t->ext, '6'); + struct nanos6_thread *th = EXT(t, '6'); /* Choose input thread channel based on tracking mode */ struct chan *inp = NULL; @@ -123,7 +123,7 @@ add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) static int connect_cpu_mux(struct emu *emu, struct cpu *scpu) { - struct nanos6_cpu *cpu = extend_get(&scpu->ext, '6'); + struct nanos6_cpu *cpu = EXT(scpu, '6'); for (int i = 0; i < CH_MAX; i++) { struct mux *mux = &cpu->mux[i]; struct chan *out = &cpu->ch[i]; @@ -185,7 +185,7 @@ connect_threads(struct emu *emu) static int connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv) { - struct nanos6_cpu *cpu = extend_get(&scpu->ext, '6'); + struct nanos6_cpu *cpu = EXT(scpu, '6'); for (int i = 0; i < CH_MAX; i++) { struct chan *out = &cpu->ch[i]; long type = cpu_type[i]; diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index 3f89d86..dc29327 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -94,7 +94,7 @@ simple(struct emu *emu) int action = entry[1]; int st = entry[2]; - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); struct chan *ch = &th->ch[chind]; if (action == PUSH) { @@ -114,7 +114,7 @@ simple(struct emu *emu) static int chan_task_stopped(struct emu *emu) { - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); struct value null = value_null(); if (chan_set(&th->ch[CH_TASKID], null) != 0) { @@ -141,7 +141,7 @@ chan_task_stopped(struct emu *emu) static int chan_task_running(struct emu *emu, struct task *task) { - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); struct proc *proc = emu->proc; if (task->id == 0) { @@ -176,7 +176,7 @@ static int chan_task_switch(struct emu *emu, struct task *prev, struct task *next) { - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); if (!prev || !next) { err("cannot switch to or from a NULL task"); @@ -230,8 +230,8 @@ update_task_state(struct emu *emu) uint32_t task_id = emu->ev->payload->u32[0]; - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); - struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); + struct nanos6_proc *proc = EXT(emu->proc, '6'); struct task_info *info = &proc->task_info; struct task_stack *stack = &th->task_stack; @@ -337,7 +337,7 @@ enforce_task_rules(struct emu *emu, char tr, struct task *next) return -1; } - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); struct value ss; if (chan_read(&th->ch[CH_SUBSYSTEM], &ss) != 0) { err("chan_read failed"); @@ -356,7 +356,7 @@ enforce_task_rules(struct emu *emu, char tr, struct task *next) static int update_task(struct emu *emu) { - struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); + struct nanos6_thread *th = EXT(emu->thread, '6'); struct task_stack *stack = &th->task_stack; struct task *prev = task_get_running(stack); @@ -399,7 +399,7 @@ create_task(struct emu *emu) uint32_t task_id = emu->ev->payload->u32[0]; uint32_t type_id = emu->ev->payload->u32[1]; - struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); + struct nanos6_proc *proc = EXT(emu->proc, '6'); struct task_info *info = &proc->task_info; if (task_create(info, type_id, task_id) != 0) { @@ -461,7 +461,7 @@ pre_type(struct emu *emu) const char *label = (const char *) data; - struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); + struct nanos6_proc *proc = EXT(emu->proc, '6'); struct task_info *info = &proc->task_info; if (task_type_create(info, typeid, label) != 0) { diff --git a/src/emu/ovni/connect.c b/src/emu/ovni/connect.c index 166ae13..6dce39e 100644 --- a/src/emu/ovni/connect.c +++ b/src/emu/ovni/connect.c @@ -10,7 +10,7 @@ static const int *cpu_type = th_type; static int connect_thread_mux(struct emu *emu, struct thread *thread) { - struct ovni_thread *th = extend_get(&thread->ext, 'O'); + struct ovni_thread *th = EXT(thread, 'O'); for (int i = 0; i < CH_MAX; i++) { struct chan *inp = &th->ch[i]; struct chan *sel = &thread->chan[TH_CHAN_STATE]; @@ -33,7 +33,7 @@ connect_thread_mux(struct emu *emu, struct thread *thread) static int connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv) { - struct ovni_thread *th = extend_get(&thread->ext, 'O'); + struct ovni_thread *th = EXT(thread, 'O'); for (int i = 0; i < CH_MAX; i++) { struct chan *out = th->ch_out[i]; long type = th_type[i]; @@ -51,7 +51,7 @@ static int add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) { for (struct thread *t = emu->system.threads; t; t = t->gnext) { - struct ovni_thread *th = extend_get(&t->ext, 'O'); + struct ovni_thread *th = EXT(t, 'O'); struct chan *inp = &th->ch_run[i]; if (mux_add_input(mux, value_int64(t->gindex), inp) != 0) { err("mux_add_input failed"); @@ -65,7 +65,7 @@ add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) static int connect_cpu_mux(struct emu *emu, struct cpu *scpu) { - struct ovni_cpu *cpu = extend_get(&scpu->ext, 'O'); + struct ovni_cpu *cpu = EXT(scpu, 'O'); for (int i = 0; i < CH_MAX; i++) { struct mux *mux = &cpu->mux[i]; struct chan *out = &cpu->ch[i]; @@ -119,7 +119,7 @@ connect_threads(struct emu *emu) static int connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv) { - struct ovni_cpu *cpu = extend_get(&scpu->ext, 'O'); + struct ovni_cpu *cpu = EXT(scpu, 'O'); for (int i = 0; i < CH_MAX; i++) { struct chan *out = &cpu->ch[i]; long type = cpu_type[i]; diff --git a/src/emu/ovni/event.c b/src/emu/ovni/event.c index ca25fd5..1e9c286 100644 --- a/src/emu/ovni/event.c +++ b/src/emu/ovni/event.c @@ -365,7 +365,7 @@ pre_burst(struct emu *emu) static int pre_flush(struct emu *emu) { - struct ovni_thread *th = extend_get(&emu->thread->ext, 'O'); + struct ovni_thread *th = EXT(emu->thread, 'O'); struct chan *flush = &th->ch[CH_FLUSH]; switch (emu->ev->v) {