Skip to content

Commit

Permalink
Merge pull request #452 from aleden/master
Browse files Browse the repository at this point in the history
Fix incorrect sizes for Intel PT packets tma, pwrx, and vmcs
  • Loading branch information
ifratric authored Dec 12, 2024
2 parents 5f6acd0 + 4f2b9e5 commit 5b7d718
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ptdecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,18 @@ unsigned char ext_size_lut[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -449,16 +449,16 @@ tracelet_cache_node *cache_find_node(uint64_t hash, decoder_state *state, unsign

void dump_lut(unsigned char *lut, char *lutname) {
printf("unsigned char %s[] = {\n", lutname);
for (int i = 0; i<16; i++) {
printf(" ");
for (int j = 0; j<16; j++) {
printf("%02x", lut[i * 16 + j]);
if (j != 15) printf(", ");
for (int i = 0; i<32; i++) {
printf("\t");
for (int j = 0; j<8; j++) {
printf("0x%02x", lut[i * 8 + j]);
if (j != 7) printf(", ");
}
if (i != 15) printf(",\n");
if (i != 31) printf(",\n");
else printf("\n");
}
printf("}; \n\n");
printf("};\n\n");
}

// function that was used to build the lookup tables for the packet decoder
Expand Down Expand Up @@ -644,15 +644,15 @@ void build_luts() {

//tma packet
ext_lut[pt_ext_tma] = ppt_tma;
ext_size_lut[pt_ext_tma] = 8;
ext_size_lut[pt_ext_tma] = 7;

//stop packet
ext_lut[pt_ext_stop] = ppt_stop;
ext_size_lut[pt_ext_stop] = 2;

//vmcs packet
ext_lut[pt_ext_vmcs] = ppt_vmcs;
ext_size_lut[pt_ext_vmcs] = 8;
ext_size_lut[pt_ext_vmcs] = 7;

//exstop packet
ext_lut[pt_ext_exstop] = ppt_exstop;
Expand All @@ -672,7 +672,7 @@ void build_luts() {

//pwrx packet
ext_lut[pt_ext_pwrx] = ppt_pwrx;
ext_size_lut[pt_ext_pwrx] = 8;
ext_size_lut[pt_ext_pwrx] = 7;

//ptw packet
for (int i = 0; i<2; i++) {
Expand Down

0 comments on commit 5b7d718

Please sign in to comment.