Move the page table allocator above ac_test_init(), a future commit will handle all page table allocation during init. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/access.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/x86/access.c b/x86/access.c index ba20359..f69071b 100644 --- a/x86/access.c +++ b/x86/access.c @@ -281,6 +281,27 @@ static void ac_env_int(ac_pt_env_t *pt_env, int page_table_levels) pt_env->pt_levels = page_table_levels; } +static pt_element_t ac_test_alloc_pt(ac_pt_env_t *pt_env) +{ + pt_element_t pt; + + pt = pt_env->pt_pool_pa + (pt_env->pt_pool_current * PAGE_SIZE); + pt_env->pt_pool_current++; + memset(va(pt), 0, PAGE_SIZE); + return pt; +} + +static _Bool ac_test_enough_room(ac_pt_env_t *pt_env) +{ + /* '120' is completely arbitrary. */ + return (pt_env->pt_pool_current + 5) < 120; +} + +static void ac_test_reset_pt_pool(ac_pt_env_t *pt_env) +{ + pt_env->pt_pool_current = 0; +} + static void ac_test_init(ac_test_t *at, void *virt, ac_pt_env_t *pt_env) { set_efer_nx(1); @@ -360,27 +381,6 @@ static int ac_test_bump(ac_test_t *at) return ret; } -static pt_element_t ac_test_alloc_pt(ac_pt_env_t *pt_env) -{ - pt_element_t pt; - - pt = pt_env->pt_pool_pa + (pt_env->pt_pool_current * PAGE_SIZE); - pt_env->pt_pool_current++; - memset(va(pt), 0, PAGE_SIZE); - return pt; -} - -static _Bool ac_test_enough_room(ac_pt_env_t *pt_env) -{ - /* '120' is completely arbitrary. */ - return (pt_env->pt_pool_current + 5) < 120; -} - -static void ac_test_reset_pt_pool(ac_pt_env_t *pt_env) -{ - pt_env->pt_pool_current = 0; -} - static pt_element_t ac_test_permissions(ac_test_t *at, unsigned flags, bool writable, bool user, bool executable) -- 2.34.0.rc2.393.gf8c9666880-goog