summaryrefslogtreecommitdiffstats
path: root/kmod/cache_types.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-08-13 20:05:27 +0200
committerLouis Burda <quent.burda@gmail.com>2022-08-13 20:05:27 +0200
commit476f6c892d90e66fbd17ba616b82b000a990f63e (patch)
tree268efc588158ded4bf88aec234d44baf9584473f /kmod/cache_types.h
parent0f3b9caf389b486541614836bf180b64544615cb (diff)
downloadcachepc-476f6c892d90e66fbd17ba616b82b000a990f63e.tar.gz
cachepc-476f6c892d90e66fbd17ba616b82b000a990f63e.zip
Add cache line ordering that prevents hardware prefetching, fix cachepc counts read
Diffstat (limited to 'kmod/cache_types.h')
-rwxr-xr-xkmod/cache_types.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/kmod/cache_types.h b/kmod/cache_types.h
index 33da39b..b337d55 100755
--- a/kmod/cache_types.h
+++ b/kmod/cache_types.h
@@ -22,9 +22,8 @@
#define IS_LAST(flags) GET_BIT(flags, 1)
#define IS_CACHE_GROUP_INIT(flags) GET_BIT(flags, 2)
-// Offset of the next and prev field in the cacheline struct
-#define CL_NEXT_OFFSET 0
-#define CL_PREV_OFFSET 8
+#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;
@@ -53,12 +52,15 @@ struct cacheline {
cacheline *next;
cacheline *prev;
- uint16_t cache_set;
- uint16_t flags;
+ uint32_t cache_set;
+ uint32_t cache_line;
+ uint32_t flags;
// Unused padding to fill cache line
uint64_t count;
- char padding[32];
+
+ 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);