I've been messing around with some oproms lately and it would be nice if we could identify standard legacy BIOS interrupts and better inline them.
An example of what I mean.
Before:
LAB_0000_4b26 XREF[2]: 0000:4b16(j), 0000:4b1e(j)
0000:4b26 50 PUSH AX
0000:4b27 b4 0f MOV AH,0xf
0000:4b29 cd 10 INT 0x10
0000:4b2b 3c 03 CMP AL,0x3
0000:4b2d 74 09 JZ LAB_0000_4b38
0000:4b2f b8 03 00 MOV AX,0x3
0000:4b32 cd 10 INT 0x10
0000:4b34 b4 0f MOV AH,0xf
0000:4b36 cd 10 INT 0x10
LAB_0000_4b38 XREF[1]: 0000:4b2d(j)
0000:4b38 b4 03 MOV AH,0x3
0000:4b3a cd 10 INT 0x10
[...]
pcVar3 = (code *)swi(0x10);
cVar5 = (*pcVar3)();
if (cVar5 != '\x03') {
pcVar3 = (code *)swi(0x10);
(*pcVar3)();
pcVar3 = (code *)swi(0x10);
(*pcVar3)();
}
pcVar3 = (code *)swi(0x10);
(*pcVar3)();
After:
pcVar3 = get_video_mode() : "bf 0f cd 10"
cVar5 = pcVar3
if (cVar5 != 3) {
set_video_mode(3); : "b8 03 00"
pcVar3 = get_video_mode() : "bf 0f cd 10"
}
get_cursor_position(dh, dl) : "b4 03 cd 10"
Something like that.
I don't know if Ghidra has the facilities for such a thing but if we assume our interrupt handler hasn't been mangled than PC-BIOS interrupts are a standard.
I've been messing around with some oproms lately and it would be nice if we could identify standard legacy BIOS interrupts and better inline them.
An example of what I mean.
Before:
After:
Something like that.
I don't know if Ghidra has the facilities for such a thing but if we assume our interrupt handler hasn't been mangled than PC-BIOS interrupts are a standard.