Skip to content

Commit

Permalink
pagetables: make kmap() static inline
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Jan 19, 2022
1 parent b14c0ca commit 0a91b08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
12 changes: 0 additions & 12 deletions arch/x86/pagetables.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,6 @@ void vunmap(void *va, unsigned int order) {
vmap(va, MFN_INVALID, order, PT_NO_FLAGS, PT_NO_FLAGS, PT_NO_FLAGS, PT_NO_FLAGS);
}

void *kmap(mfn_t mfn, unsigned int order,
#if defined(__x86_64__)
unsigned long l4_flags,
#endif
unsigned long l3_flags, unsigned long l2_flags, unsigned long l1_flags) {
return vmap(mfn_to_virt_kern(mfn), mfn, order,
#if defined(__x86_64__)
l4_flags,
#endif
l3_flags, l2_flags, l1_flags);
}

void init_pagetables(void) {
for_each_memory_range (r) {
switch (r->base) {
Expand Down
18 changes: 13 additions & 5 deletions include/arch/x86/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ extern void *vmap(void *va, mfn_t mfn, unsigned int order,
#endif
unsigned long l3_flags, unsigned long l2_flags, unsigned long l1_flags);

extern void *kmap(mfn_t mfn, unsigned int order,
#if defined(__x86_64__)
unsigned long l4_flags,
#endif
unsigned long l3_flags, unsigned long l2_flags, unsigned long l1_flags);
extern void vunmap(void *va, unsigned int order);

/* Static declarations */
Expand Down Expand Up @@ -188,6 +183,19 @@ static inline mfn_t virt_to_mfn(const void *va) {
return paddr_to_mfn(virt_to_paddr(va));
}

static inline void *kmap(mfn_t mfn, unsigned int order,
#if defined(__x86_64__)
unsigned long l4_flags,
#endif
unsigned long l3_flags, unsigned long l2_flags,
unsigned long l1_flags) {
return vmap(mfn_to_virt_kern(mfn), mfn, order,
#if defined(__x86_64__)
l4_flags,
#endif
l3_flags, l2_flags, l1_flags);
}

static inline void *vmap_1g(void *va, mfn_t mfn, unsigned long l3_flags) {
return vmap(va, mfn, PAGE_ORDER_1G, L4_PROT_USER, l3_flags, PT_NO_FLAGS, PT_NO_FLAGS);
}
Expand Down

0 comments on commit 0a91b08

Please sign in to comment.