From b1577ce064b7430f90fb5bd8feda679c6a621879 Mon Sep 17 00:00:00 2001 From: Cyrill Burth Date: Mon, 18 Nov 2024 16:25:33 +0100 Subject: [PATCH] [FIX] move __tilecfg definition into header --- .../Environment/X86/Payload/AVX512Payload.hpp | 13 ++++++++++- .../Environment/X86/Payload/AVX512Payload.cpp | 23 +++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/firestarter/Environment/X86/Payload/AVX512Payload.hpp b/include/firestarter/Environment/X86/Payload/AVX512Payload.hpp index a41564c8..170874f4 100644 --- a/include/firestarter/Environment/X86/Payload/AVX512Payload.hpp +++ b/include/firestarter/Environment/X86/Payload/AVX512Payload.hpp @@ -24,6 +24,17 @@ #include namespace firestarter::environment::x86::payload { + +// Define struct that is used as config and loaded through ldtilecfg() +typedef struct __tile_config +{ + uint8_t palette_id; + uint8_t start_row; + uint8_t reserved_0[14]; + uint16_t colsb[16]; + uint8_t rows[16]; +} __tilecfg; + class AVX512Payload final : public X86Payload { public: AVX512Payload(asmjit::CpuFeatures const &supportedFeatures) @@ -44,7 +55,7 @@ class AVX512Payload final : public X86Payload { return new AVX512Payload(this->supportedFeatures()); }; - static void create_AMX_config(void *tileinfo); + static void create_AMX_config(__tilecfg *tileinfo); static void request_permission(); static void init_buffer_rand(uintptr_t buf1, uintptr_t buf2); diff --git a/src/firestarter/Environment/X86/Payload/AVX512Payload.cpp b/src/firestarter/Environment/X86/Payload/AVX512Payload.cpp index defea535..5d1f1c04 100644 --- a/src/firestarter/Environment/X86/Payload/AVX512Payload.cpp +++ b/src/firestarter/Environment/X86/Payload/AVX512Payload.cpp @@ -41,16 +41,6 @@ using namespace firestarter::environment::x86::payload; using namespace asmjit; using namespace asmjit::x86; -// Define struct that is used as config and loaded through ldtilecfg() -typedef struct __tile_config -{ - uint8_t palette_id; - uint8_t start_row; - uint8_t reserved_0[14]; - uint16_t colsb[16]; - uint8_t rows[16]; -} __tilecfg; - int AVX512Payload::compilePayload( std::vector> const &proportion, unsigned instructionCacheSize, @@ -526,21 +516,20 @@ void AVX512Payload::init(unsigned long long *memoryAddr, X86Payload::init(memoryAddr, bufferSize, 0.27948995982e-4, 0.27948995982e-4); } -void AVX512Payload::create_AMX_config(void *tileinfo){ +void AVX512Payload::create_AMX_config(__tilecfg *tileinfo){ // Create tile_cfg, fill it and return - __tilecfg* cfg = static_cast<__tilecfg*>(tileinfo); int i; - cfg->palette_id = 1; - cfg->start_row = 0; + tileinfo->palette_id = 1; + tileinfo->start_row = 0; for (i = 0; i < 8; ++i) { - cfg->colsb[i] = MAX_COLS; - cfg->rows[i] = MAX_ROWS; + tileinfo->colsb[i] = MAX_COLS; + tileinfo->rows[i] = MAX_ROWS; } - _tile_loadconfig(cfg); + _tile_loadconfig(tileinfo); }