Skip to content

Commit 9fa5e04

Browse files
ptxed, block: move iscache into check_block()
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
1 parent f9ce9cb commit 9fa5e04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ptxed/src/ptxed.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,10 +1842,11 @@ static void print_block(struct ptxed_decoder *decoder,
18421842
diagnose(decoder, ip, "reconstruct error", -pte_nosync);
18431843
}
18441844

1845-
static void check_block(const struct pt_block *block,
1846-
struct pt_image_section_cache *iscache,
1845+
static void check_block(struct ptxed_decoder *decoder,
1846+
const struct pt_block *block,
18471847
uint64_t offset)
18481848
{
1849+
struct pt_image_section_cache *iscache;
18491850
struct pt_insn insn;
18501851
xed_address_width_enum_t addr_width;
18511852
xed_machine_mode_enum_t mode;
@@ -1856,7 +1857,7 @@ static void check_block(const struct pt_block *block,
18561857
uint16_t ninsn;
18571858
int errcode;
18581859

1859-
if (!block) {
1860+
if (!decoder || !block) {
18601861
printf("[internal error]\n");
18611862
return;
18621863
}
@@ -1874,6 +1875,7 @@ static void check_block(const struct pt_block *block,
18741875
mode = to_xed_mode(block->mode);
18751876
xed_state_init2(&xed, mode, addr_width);
18761877

1878+
iscache = decoder->iscache;
18771879
ip = block->ip;
18781880
do {
18791881
errcode = block_fetch_insn(&insn, block, ip, iscache);
@@ -1978,7 +1980,6 @@ static void decode_block(struct ptxed_decoder *decoder,
19781980
const struct ptxed_options *options,
19791981
struct ptxed_stats *stats)
19801982
{
1981-
struct pt_image_section_cache *iscache;
19821983
struct pt_block_decoder *ptdec;
19831984
uint64_t offset, sync, time;
19841985

@@ -1987,7 +1988,6 @@ static void decode_block(struct ptxed_decoder *decoder,
19871988
return;
19881989
}
19891990

1990-
iscache = decoder->iscache;
19911991
ptdec = decoder->variant.block;
19921992
offset = 0ull;
19931993
sync = 0ull;
@@ -2062,7 +2062,7 @@ static void decode_block(struct ptxed_decoder *decoder,
20622062
offset, time);
20632063

20642064
if (options->check)
2065-
check_block(&block, iscache,
2065+
check_block(decoder, &block,
20662066
offset);
20672067
}
20682068
break;
@@ -2078,7 +2078,7 @@ static void decode_block(struct ptxed_decoder *decoder,
20782078
offset, time);
20792079

20802080
if (options->check)
2081-
check_block(&block, iscache, offset);
2081+
check_block(decoder, &block, offset);
20822082
}
20832083

20842084
/* We're done when we reach the end of the trace stream. */

0 commit comments

Comments
 (0)