Skip to content

Commit e3a21a8

Browse files
fix(addr_space): Change functions to use the correct address space
1 parent 84df9e0 commit e3a21a8

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

src/core/mpu/mem.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ static void mem_vmpu_set_entry(struct addr_space* as, mpid_t mpid, struct mp_reg
7272
mpe->mpid = mpid;
7373
mpe->lock = locked;
7474

75-
list_insert_ordered(&cpu()->as.vmpu.ordered_list, (node_t*)&cpu()->as.vmpu.node[mpid],
76-
vmpu_node_cmp);
75+
list_insert_ordered(&as->vmpu.ordered_list, (node_t*)&as->vmpu.node[mpid], vmpu_node_cmp);
7776
}
7877

7978
static void mem_vmpu_clear_entry(struct addr_space* as, mpid_t mpid)
@@ -94,7 +93,7 @@ static void mem_vmpu_free_entry(struct addr_space* as, mpid_t mpid)
9493
struct mpe* mpe = mem_vmpu_get_entry(as, mpid);
9594
mpe->state = MPE_S_FREE;
9695

97-
list_rm(&cpu()->as.vmpu.ordered_list, (node_t*)&cpu()->as.vmpu.node[mpid]);
96+
list_rm(&as->vmpu.ordered_list, (node_t*)&as->vmpu.node[mpid]);
9897
}
9998

10099
static mpid_t mem_vmpu_allocate_entry(struct addr_space* as)
@@ -135,26 +134,6 @@ static mpid_t mem_vmpu_get_entry_by_addr(struct addr_space* as, vaddr_t addr)
135134
return mpid;
136135
}
137136

138-
static inline priv_t as_priv(struct addr_space* as)
139-
{
140-
priv_t priv;
141-
142-
switch (as->type) {
143-
case AS_HYP:
144-
/* fallthrough */
145-
case AS_HYP_CPY:
146-
priv = PRIV_HYP;
147-
break;
148-
case AS_VM:
149-
priv = PRIV_VM;
150-
break;
151-
default:
152-
priv = PRIV_NONE;
153-
}
154-
155-
return priv;
156-
}
157-
158137
static void mem_init_boot_regions(void)
159138
{
160139
/**
@@ -239,7 +218,7 @@ void as_init(struct addr_space* as, enum AS_TYPE type, asid_t id, cpumap_t cpus,
239218
mem_vmpu_free_entry(as, i);
240219
}
241220

242-
list_init(&cpu()->as.vmpu.ordered_list);
221+
list_init(&(as->vmpu.ordered_list));
243222
as_arch_init(as);
244223
}
245224

@@ -432,7 +411,7 @@ void mem_vmpu_coalesce_contiguous(struct addr_space* as, bool broadcast, bool lo
432411
mpid_t prev_mpid = INVALID_MPID;
433412
struct mpe* prev_reg;
434413
struct mpe* cur_reg;
435-
list_foreach_tail(cpu()->as.vmpu.ordered_list, struct mpe, cur, prev)
414+
list_foreach_tail(as->vmpu.ordered_list, struct mpe, cur, prev)
436415
{
437416
if (prev == NULL) {
438417
continue;

0 commit comments

Comments
 (0)