Mercurial > repos > blastem
comparison gen_x86.c @ 692:e11e68918691
Fix bug in map_native_address that was breaking some self-modifying code in Gunstar Heroes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 28 Apr 2015 19:04:36 -0700 |
parents | 74d636e85bf8 |
children | cb1c005880e7 |
comparison
equal
deleted
inserted
replaced
691:74d636e85bf8 | 692:e11e68918691 |
---|---|
2133 code++; | 2133 code++; |
2134 } | 2134 } |
2135 if (has_modrm(prefix, main_op)) { | 2135 if (has_modrm(prefix, main_op)) { |
2136 uint8_t mod_rm = *(code++); | 2136 uint8_t mod_rm = *(code++); |
2137 if (has_sib(mod_rm)) { | 2137 if (has_sib(mod_rm)) { |
2138 uint8_t sib = *(code++); | 2138 //sib takes up a byte, but can't add any additional ones beyond that |
2139 } else { | 2139 code++; |
2140 | 2140 } |
2141 uint8_t mode = mod_rm & 0xC0; | |
2142 uint8_t rm = mod_rm & 3; | |
2143 if (mode == MODE_REG_DISPLACE8) { | |
2144 code++; | |
2145 } else if (mode == MODE_REG_DISPLACE32 || (mode == MODE_REG_INDIRECT && rm == RBP)) { | |
2146 code += 4; | |
2141 } | 2147 } |
2142 } else { | 2148 } else { |
2143 } | 2149 } |
2144 | 2150 |
2145 return code-start; | 2151 return code-start; |