Skip to content

Commit

Permalink
libipt, ild, insn: merge instruction decode and classification
Browse files Browse the repository at this point in the history
Instruction decode provides a fine-grain classification in struct pt_ild that
is translated into a coarser instruction class and into a newly introduced
struct pt_insn_ext.

Merge this post-processing step into instruction decode.

Change-Id: I86d776937ed5dd83ea2fe9bb20992d27266619c3
Signed-off-by: Markus Metzger <[email protected]>
  • Loading branch information
markus-metzger committed Aug 11, 2016
1 parent 3d75f65 commit d56408b
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 219 deletions.
25 changes: 2 additions & 23 deletions libipt/internal/include/pt_ild.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,8 @@ struct pt_ild {

/* outputs */
uint8_t length; /* bytes */
pti_inst_enum_t iclass;
uint64_t direct_target; /* if direct_indirect = 1 */
union {
struct {
uint32_t branch:1; /* direct or indirect */

/* direct jmp, direct call or rel/direct branch sets
* branch_direct = 1.
*
* 1=direct, 0=indirect
*/
uint32_t branch_direct:1;

/* this includes other transfers like SYSENTER,
* SYSEXIT, and IRET.
*
* 1=far, 0=near
*/
uint32_t branch_far:1;

uint32_t ret:1;
uint32_t call:1;
uint32_t cond:1;
/* internal fields */
uint32_t osz:1;
uint32_t asz:1;
uint32_t lock:1;
Expand Down Expand Up @@ -136,6 +114,7 @@ extern int pt_instruction_length_decode(struct pt_ild *ild);
* Returns zero if a non-interesting instruction was encountered.
* Returns a negative error code otherwise.
*/
extern int pt_instruction_decode(struct pt_ild *ild);
extern int pt_instruction_decode(struct pt_insn *insn, struct pt_insn_ext *iext,
const struct pt_ild *ild);

#endif /* PT_ILD_H */
Loading

0 comments on commit d56408b

Please sign in to comment.