summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/page/page.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/page/page.py b/tools/page/page.py
index 95d1ccc..0a0c359 100755
--- a/tools/page/page.py
+++ b/tools/page/page.py
@@ -24,6 +24,22 @@ def get_table_size(addr):
return((pte_cnt + pde_cnt + pdpe_cnt + pml4_cnt) * 8)
-ts = get_table_size(34359738368)
-print(ts)
+def get_palloc_table_size(tb, base, size):
+ tsize = 24
+ for x in range(8):
+ bs = tsize
+ tsize += c(((size / (0x1000 * (1 << x))) / 64)) * 8
+ print(tsize - bs)
+ print("buddy: {} - {} > {}".format(
+ hex(bs + tb),
+ hex((tsize + tb) - 1),
+ (size / (0x1000 * (1 << x))) / 64
+ ))
+ return(tsize)
+
+# tablebase, base, size
+free_chunks = [[0x200000, 0x100000, 3220041728], [0x22fce0, 0x100000000, 1073741824]]
+
+ts = get_palloc_table_size(free_chunks[0][0], free_chunks[0][1], free_chunks[0][2])
+print(hex(ts))