DynamoRIO / DynamoRIO/dynamorio
decoding: decoder max should match MAX_INSTR_LENGTH
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
_From [derek.br...@gmail.com](https://code.google.com/u/117968039472581148324/) on February 14, 2009 10:10:53_
Today we use a MAX_INSTR_LENGTH define of 17 in various places yet our own
decoder does not stop at 17. The two should match so we can allocate a
buffer and decode from it. Since it is a conservative estimate the maximum
should probably be higher since some processors (at list historically) have
allowed 18, 20, and even (so I've heard, never seen) 24-byte instructions.
The AMD manual claims 15 is the limit, and 17 used to be the typically
assumed limit, but the actual limit at which a processor raises #GP is
variable. We shouldn't make it too high though since we don't want to read
off onto the next page when not necessary.
Example of our decoder on a 23-byte instr (this raises #GP on my Q9300):
0x080494a8 66 66 66 66 66 66 66 data16 nop 0x00000000(%eax,%eax,1)
66 66 66 66 66 66 66 66 0f 1f 84 00 00 00 00 00
_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=9_
Contributor guide
Assessment
This issue has not been assessed yet.