mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-20 04:09:41 +00:00
Add support for dword offsets (#4825)
* Add support for dword offsets to internal assembler Internal assembler produces incorrect opcodes for offsets that were greater than a short. rasm2 "mov eax, [eax + 1337]" 8b8039 This adds support for values >127. rasm2 "mov eax, [eax + 1337]" 8b8039050000 producing the same output as the `nasm` assembler. * Fix support for negative short and dword offsets Handle negative offsets for `mov` instructions both short and dword sizes. * Whitespace fixes * Remove rogue character Remove the reogue `:` that got into the code
This commit is contained in:
parent
a68955c268
commit
766b9ec4f0
@ -1082,14 +1082,26 @@ SETNP/SETPO - Set if No Parity / Set if Parity Odd (386+)
|
||||
}
|
||||
data[l++] = 0x8b;
|
||||
if (delta) {
|
||||
ut8 mask = 0x40;
|
||||
ut32 d = r_num_math (NULL, delta) * N;
|
||||
// Check if delta is short or dword
|
||||
if ((ST8_MIN > d) && (d > ST8_MAX)) {
|
||||
mask = 0x80;
|
||||
}
|
||||
int r = getreg (arg2);
|
||||
if (r==4) { //ESP
|
||||
data[l++] = getreg (arg)<<3 | r | 0x40;
|
||||
data[l++] = getreg (arg)<<3 | r | mask;
|
||||
data[l++] = 0x24;
|
||||
} else if (r==5) { // EBP
|
||||
data[l++] = getreg (arg)<<3 | r | 0x40;
|
||||
} else data[l++] = getreg (arg)<<3 | r | 0x40;
|
||||
data[l++] = r_num_math (NULL, delta) * N;
|
||||
data[l++] = getreg (arg)<<3 | r | mask;
|
||||
} else data[l++] = getreg (arg)<<3 | r | mask;
|
||||
|
||||
data[l++] = d;
|
||||
if ((ST8_MIN > d) && (d > ST8_MAX)) {
|
||||
data[l++] = d>>8;
|
||||
data[l++] = d>>16;
|
||||
data[l++] = d>>24;
|
||||
}
|
||||
} else {
|
||||
int r = getreg (arg2);
|
||||
if (r==4) { //ESP
|
||||
|
Loading…
Reference in New Issue
Block a user