Skip to content

Commit

Permalink
[FIX] move __tilecfg definition into header
Browse files Browse the repository at this point in the history
  • Loading branch information
cyssi-cb committed Nov 18, 2024
1 parent ce35b28 commit b1577ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
13 changes: 12 additions & 1 deletion include/firestarter/Environment/X86/Payload/AVX512Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
#include <firestarter/Environment/X86/Payload/X86Payload.hpp>

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)
Expand All @@ -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);

Expand Down
23 changes: 6 additions & 17 deletions src/firestarter/Environment/X86/Payload/AVX512Payload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::pair<std::string, unsigned>> const &proportion,
unsigned instructionCacheSize,
Expand Down Expand Up @@ -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);
}


Expand Down

0 comments on commit b1577ce

Please sign in to comment.