혹시 Pin Tool 쓰는 분 계신가요!? INS에 대해서 .
안녕 하세요 이번에 Pin tool 공부를 하고있는 학생인데
INS ins <- 이것에 대한 설명이 안나와있더라구요
레퍼런스를 뒤져봐도..
user guide 에서 지금 메모리 연산 읽고 쓰고 하는 example에 대해서
보고있는데 하나의 INS 에서 메모리 연산의 수만큼을 가져와서 연산하는것처럼보이는데
VOID Instruction(INS ins, VOID *v)
{
// Instruments memory accesses using a predicated call, i.e.
// the instrumentation is called iff the instruction will actually be executed.
//
// The IA-64 architecture has explicitly predicated instructions.
// On the IA-32 and Intel(R) 64 architectures conditional moves and REP
// prefixed instructions appear as predicated instructions in Pin.
UINT32 memOperands = INS_MemoryOperandCount(ins);
// Iterate over each memory operand of the instruction.
for (UINT32 memOp = 0; memOp < memOperands; memOp++)
{
if (INS_MemoryOperandIsRead(ins, memOp))
{
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemRead,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
// Note that in some architectures a single memory operand can be
// both read and written (for instance incl (%eax) on IA-32)
// In that case we instrument it once for read and once for write.
if (INS_MemoryOperandIsWritten(ins, memOp))
{
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemWrite,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
}
}
이쪽부분이 설명이 이해가 잘안가네요..
혹시 Pin tool에 대해서 알고있으시다면 알려주시면 감사하겠습니다:)
pin tool은 runtime에
pin tool은 runtime에 instruction 끼워주는 용도로 쓰는 것으로 알고 있습니다. (아닌가요?)
저 부분은 아마 현재 수행되고 있는, 그러니까 fetch(또는 issue)된 instruction 정보를 읽어와서 분석하는 부분입니다. 따라서 INS ins는 지금 실행되는(또는 실행되어야 할) instruction이고, 포맷은 해당 CPU 레퍼런스를 참조하시는게 좋을듯 하네요. 이를테면 Intel CPU Reference 같은거요.
감사합니다^^
공부를 하다보니 자연스래 약간 이해가 되었는데 답변해주셔서 감사합니다^^
댓글 달기