Repository navigation
Closed
Description
Environment
$ date
pon, 17 sty 2022, 23:31:20 CET
$ uname -ms
Linux x86_64
$ r2 -v
radare2 5.5.5 27756 @ linux-x86-64 git.5.5.4
commit: 7127e204a2c75f857c764918794bb0bed71476a1 build: 2022-01-17__21:36:50
$
Description
for a while I noticed to have some additional arguments when I analyse data as function using af for x86-16bit arch.
testing similar code in 32bit workds as expected.
r2 incorrectly think that ax register is an parater even if al and ah is previously set from const or other regs.
In general I could try and I will fix that by self, but please point me to where try to find that bug for faster results.
Test
16bit first:
$r2 -
e asm.arch=x86.nasm
e asm.bits=16
e asm.seggrn=8
e asm.segoff=true
"wa push bp; mov bp, sp; mov dx, word [bp+6]; mov al, dl; mov ah, 0; mov bx, ax; test byte [bx + 0x4141], 0x80; pop bp; ret"
pd 9
af
pdf
32bit for comparison:
$r2 -
e asm.bits=32
"wa push ebp; mov ebp, esp; mov edx, word [ebp+6]; mov al, dl; mov ah, 0; mov ebx, eax; test byte [ebx + 0x4141], 0x80; pop ebp; ret"
pd 9
af
pdf
Output:
16bit:
-- Wait a minute! I found a bug, self-fixing ... OK
[0x00000000]> e asm.arch=x86.nasm
[0x00000000]> e asm.bits=16
[0000:0000]> e asm.seggrn=8
[0000:0000]> e asm.segoff=true
[0000:0000]> "wa push bp; mov bp, sp; mov dx, word [bp+6]; mov al, dl; mov ah, 0; mov bx, ax; test byte [bx + 0x4141], 0x80; pop bp; ret"
Written 19 byte(s) (push bp; mov bp, sp; mov dx, word [bp+6]; mov al, dl; mov ah, 0; mov bx, ax; test byte [bx + 0x4141], 0x80; pop bp; ret) = wx 5589e58b560688d0b40089c3f6874141805dc3
[0000:0000]> pd 9
0000:0000 55 push bp
0000:0001 89e5 mov bp, sp
0000:0003 8b5606 mov dx, word ptr [bp + 6]
0000:0006 88d0 mov al, dl
0000:0008 b400 mov ah, 0
0000:000a 89c3 mov bx, ax
0000:000c f687414180 test byte ptr [bx + 0x4141], 0x80
0000:0011 5d pop bp
0000:0012 c3 ret
[0000:0000]> af
[0000:0000]> pdf
┌ 19: fcn.00000000 (int16_t arg1, int16_t arg_6h);
│ ; arg int16_t arg_6h @ bp+0x6
│ ; arg int16_t arg1 @ ax
│ 0000:0000 55 push bp
│ 0000:0001 89e5 mov bp, sp
│ 0000:0003 8b5606 mov dx, word ptr [arg_6h]
│ 0000:0006 88d0 mov al, dl
│ 0000:0008 b400 mov ah, 0
│ 0000:000a 89c3 mov bx, ax ; arg1
│ 0000:000c f687414180 test byte ptr [bx + 0x4141], 0x80
│ 0000:0011 5d pop bp
└ 0000:0012 c3 ret
32bit:
-- Don't wait for Travis
[0x00000000]> e asm.bits=32
[0x00000000]> "wa push ebp; mov ebp, esp; mov edx, word [ebp+6]; mov al, dl; mov ah, 0; mov ebx, eax; test byte [ebx + 0x4141], 0x80; pop ebp; ret"
Written 17 byte(s) (push ebp; mov ebp, esp; mov edx, word [ebp+6]; mov al, dl; mov ah, 0; mov ebx, eax; test byte [ebx + 0x4141], 0x80; pop ebp; ret) = wx 5589e58b550688d0b40089c3f603805dc3
[0x00000000]> pd 9
0x00000000 55 push ebp
0x00000001 89e5 mov ebp, esp
0x00000003 8b5506 mov edx, dword [ebp + 6]
0x00000006 88d0 mov al, dl
0x00000008 b400 mov ah, 0
0x0000000a 89c3 mov ebx, eax
0x0000000c f60380 test byte [ebx], 0x80
0x0000000f 5d pop ebp
0x00000010 c3 ret
[0x00000000]> af
[0x00000000]> pdf
┌ 17: fcn.00000000 (int32_t arg_6h);
│ ; arg int32_t arg_6h @ ebp+0x6
│ 0x00000000 55 push ebp
│ 0x00000001 89e5 mov ebp, esp
│ 0x00000003 8b5506 mov edx, dword [arg_6h]
│ 0x00000006 88d0 mov al, dl
│ 0x00000008 b400 mov ah, 0
│ 0x0000000a 89c3 mov ebx, eax
│ 0x0000000c f60380 test byte [ebx], 0x80
│ 0x0000000f 5d pop ebp
└ 0x00000010 c3 ret
Metadata
Metadata
Assignees
Labels
No labels


Activity
trufae commentedon Sep 27, 2026
This was fixed by @0verflowme a week back