summaryrefslogtreecommitdiffstats
path: root/kmod/cache_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'kmod/cache_types.h')
-rw-r--r--kmod/cache_types.h66
1 files changed, 0 insertions, 66 deletions
diff --git a/kmod/cache_types.h b/kmod/cache_types.h
deleted file mode 100644
index b337d55..0000000
--- a/kmod/cache_types.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#pragma once
-
-#include "device_conf.h"
-
-#define SET_MASK(SETS) (((((uintptr_t) SETS) * CACHELINE_SIZE) - 1) ^ (CACHELINE_SIZE - 1))
-
-#define REMOVE_PAGE_OFFSET(ptr) ((void *) (((uintptr_t) ptr) & PAGE_MASK))
-
-#define GET_BIT(b, i) (((b) >> (i)) & 1)
-#define SET_BIT(b, i) ((b) | (1 << (i)))
-
-/* Operate cacheline flags
- * Used flags:
- * 32 2 1 0
- * | | ... | cache group initialized | last | first |
- */
-#define DEFAULT_FLAGS 0
-#define SET_FIRST(flags) SET_BIT(flags, 0)
-#define SET_LAST(flags) SET_BIT(flags, 1)
-#define SET_CACHE_GROUP_INIT(flags) SET_BIT(flags, 2)
-#define IS_FIRST(flags) GET_BIT(flags, 0)
-#define IS_LAST(flags) GET_BIT(flags, 1)
-#define IS_CACHE_GROUP_INIT(flags) GET_BIT(flags, 2)
-
-#define CL_NEXT_OFFSET offsetof(struct cacheline, next)
-#define CL_PREV_OFFSET offsetof(struct cacheline, prev)
-
-typedef enum cache_level cache_level;
-typedef enum addressing_type addressing_type;
-typedef struct cacheline cacheline;
-typedef struct cache_ctx cache_ctx;
-
-enum cache_level {L1, L2};
-enum addressing_type {VIRTUAL, PHYSICAL};
-
-struct cache_ctx {
- cache_level cache_level;
- addressing_type addressing;
-
- uint32_t sets;
- uint32_t associativity;
- uint32_t access_time;
- uint32_t nr_of_cachelines;
- uint32_t set_size;
- uint32_t cache_size;
-};
-
-struct cacheline {
- // Doubly linked list inside same set
- // Attention: CL_NEXT_OFFSET and CL_PREV_OFFSET
- // must be kept up to date
- cacheline *next;
- cacheline *prev;
-
- uint32_t cache_set;
- uint32_t cache_line;
- uint32_t flags;
-
- // Unused padding to fill cache line
- uint64_t count;
-
- char padding[24];
-};
-
-static_assert(sizeof(struct cacheline) == CACHELINE_SIZE, "Bad cache line struct size");
-static_assert(CL_NEXT_OFFSET == 0 && CL_PREV_OFFSET == 8);