index_guesser.c 711 Bytes
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "util.h"

#include "stage2.h"

const uint64_t MIN_CHOICE = 1;
const uint64_t MAX_CHOICE = 256;

static inline page_t *init_pages() {
    return calloc(MAX_CHOICE, sizeof(page_t));
}

static inline void flush_all_pages(page_t *pages) {
    // TODO: Implement me!
}

static inline size_t guess_accessed_page(page_t *pages) {
    // TODO: Implement me! 

    return 0;
}

int main() {
    page_t *pages = init_pages();

    flush_all_pages(pages);

    do_access(pages);
    
    size_t guess = guess_accessed_page(pages);
    if (guess) { 
        printf("%zu\n", guess);
    }
}