rusage: Move pgsize_to_pgshift to arch-memory.h

Change-Id: Ia10b6e5c7d078d345347a79a3e98c06c16d28d6a
This commit is contained in:
Masamichi Takagi
2019-06-21 19:13:28 +09:00
parent 0267a0c8ea
commit 3b74b0a093
5 changed files with 87 additions and 40 deletions

View File

@@ -17,6 +17,7 @@
#define __HEADER_X86_COMMON_ARCH_MEMORY_H
#include <ihk/types.h>
#include <errno.h>
#define KERNEL_CS_ENTRY 4
#define KERNEL_DS_ENTRY 5
@@ -365,6 +366,17 @@ static inline int pgsize_to_tbllv(size_t pgsize)
return 0;
}
static inline int pgsize_to_pgshift(size_t pgsize)
{
switch (pgsize) {
case PTL1_SIZE: return PTL1_SHIFT;
case PTL2_SIZE: return PTL2_SHIFT;
case PTL3_SIZE: return PTL3_SHIFT;
case PTL4_SIZE: return PTL4_SHIFT;
default: return -EINVAL;
}
}
static inline size_t tbllv_to_pgsize(int level)
{
switch (level) {