Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General improvements and cleanup to page tables handling #309

Merged
merged 11 commits into from
Oct 27, 2023
4 changes: 4 additions & 0 deletions arch/x86/pagetables.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void dump_pagetables(cr3_t cr3) {
static inline void *tmp_map_mfn(mfn_t mfn) {
BUG_ON(mfn_invalid(mfn));
set_pgentry(_tmp_mapping_entry, mfn, L1_PROT);
invlpg(_tmp_mapping);
return _tmp_mapping;
}

Expand Down Expand Up @@ -199,6 +200,7 @@ static void *_vmap(cr3_t *cr3_ptr, void *va, mfn_t mfn, unsigned int order,
tab = tmp_map_mfn(l3t_mfn);
entry = &tab[l3_table_index(va)];
set_pgentry(entry, mfn, l3_flags | _PAGE_PSE);
invlpg(va);
goto done;
}

Expand All @@ -208,6 +210,7 @@ static void *_vmap(cr3_t *cr3_ptr, void *va, mfn_t mfn, unsigned int order,
tab = tmp_map_mfn(l2t_mfn);
entry = &tab[l2_table_index(va)];
set_pgentry(entry, mfn, l2_flags | _PAGE_PSE);
invlpg(va);
goto done;
}

Expand All @@ -216,6 +219,7 @@ static void *_vmap(cr3_t *cr3_ptr, void *va, mfn_t mfn, unsigned int order,
tab = tmp_map_mfn(l1t_mfn);
entry = &tab[l1_table_index(va)];
set_pgentry(entry, mfn, l1_flags);
invlpg(va);

done:
spin_unlock(&lock);
Expand Down
1 change: 0 additions & 1 deletion include/arch/x86/pagetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ static inline pdpe_t *get_pdpe(const void *va) {
static inline void set_pgentry(pgentry_t *e, mfn_t mfn, unsigned long flags) {
*e = pgentry_from_mfn(mfn, flags);
barrier();
flush_tlb();
minipli-oss marked this conversation as resolved.
Show resolved Hide resolved
}

/* External declarations */
Expand Down
Loading