RITZ
June 27th, 2006, 15:45
I need to grab a chunk of code from the beginning of a function in memory, but it has to be to the nearest complete instruction so that I can arbitrarily concatenate some more code to it. In order to do this I'll obviously need to know the operand sizes of every opcode and trace through the instructions. Does anyone know of some code snippet or API already out there that I can use? Because right now what I'm doing is making a little program just to extract this information from the IA-32 instruction set manual PDFs and put it in a data form that I can use like a C array. But I know I'm not the first person to want to know the operand size for each opcode.
Another thing: I figure I can treat prefixes as just 0 sized opcodes but that's assuming that there are no IA-32 prefixes that would change the affected instruction's operand size. Am I correct in thinking this? I can't think of any that change the size off hand. If I'm right then the algo I need this for might just remain elegant.
Another thing: I figure I can treat prefixes as just 0 sized opcodes but that's assuming that there are no IA-32 prefixes that would change the affected instruction's operand size. Am I correct in thinking this? I can't think of any that change the size off hand. If I'm right then the algo I need this for might just remain elegant.
