@@ -67,6 +67,7 @@ static void mem_vmpu_set_entry(struct addr_space* as, mpid_t mpid, struct mp_reg
6767 mpe -> region .mem_flags = mpr -> mem_flags ;
6868 mpe -> region .as_sec = mpr -> as_sec ;
6969 mpe -> state = MPE_S_VALID ;
70+ mpe -> mpid = mpid ;
7071
7172 list_insert_ordered (& cpu ()-> as .vmpu .ordered_list , (node_t * )& cpu ()-> as .vmpu .node [mpid ],
7273 vmpu_node_cmp );
@@ -409,13 +410,13 @@ void mem_vmpu_coalesce_contiguous(struct addr_space* as, bool broadcast)
409410 }
410411
411412 if (merge ) {
412- mem_vmpu_remove_region (as , cur_mpid , broadcast );
413- mem_vmpu_remove_region (as , prev_mpid , broadcast );
414413 struct mp_region merged_reg = {
415414 .base = prev_reg -> region .base ,
416415 .size = prev_reg -> region .size + cur_reg -> region .size ,
417416 .mem_flags = cur_reg -> region .mem_flags ,
418417 };
418+ mem_vmpu_remove_region (as , cur_mpid , broadcast );
419+ mem_vmpu_remove_region (as , prev_mpid , broadcast );
419420 mpid_t mpid = mem_vmpu_allocate_entry (as );
420421 if (mpid != INVALID_MPID ) {
421422 mem_vmpu_insert_region (as , mpid , & merged_reg , broadcast );
0 commit comments