Apply touchups to last PR

Compilers like GCC require comments on lines like `#endif rdmsr`. Since
the rdmsr macro was only being used in arch_prctl(), I've localized the
macro, and I'm considering deleting arch_prctl() too, since there isn't
any way to have mem segments unfortunately across operating systems ;_;
The remaining changed lines are due to clang-format which runs on auto.
This commit is contained in:
Justine Tunney 2021-02-04 16:37:22 -08:00
parent 888cfa74d7
commit 3384a5a48c
6 changed files with 159 additions and 135 deletions

View file

@ -17,11 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "ape/lib/pc.h"
#include "libc/bits/bits.h"
textreal void pageunmap(int64_t vaddr) {
uint64_t *entry;
entry = __getpagetableentry(vaddr, 3, &g_pml4t, &g_ptsp_xlm);
*entry &= ~PAGE_V;
invlpg(vaddr);
asm volatile("invlpg\t(%0)" : /* no outputs */ : "r"(vaddr) : "memory");
}