Turns the #define __NR_(system call) (number)
into fasm format:
sys.(system call) = (number)
#!/usr/bin/perl
use warnings;
while (<>){
if ($_ =~ s/#define __NR_(\w*)\s*(\d*)/sys.$1 =\t$2/){
$_ =~ s/\/\*.*\*\///; #removes C comments
$_ =~ s/__NR_/sys./; #removes extra NR stuff and turns into sys.
print $_;
}
}
And I am still workin gon this one, sys2macro.pl, but currently itturns sys.(system call) = (number) into
macro SYS.(system call) arg1, arg2, arg3{
mov eax, (number)
if arg1 eq
else
mov ebx, arg1
end if
if arg2 eq
else
mov ecx, arg2
end if
if arg3 eq
else
mov edx, arg3
end if
}
Not perfect, but what can you do? Here is what i have so far in my perl code:
#!/usr/bin/perl
use warnings;
while (<>){
if ($_ =~ /sys\.(\w*) =\t(\d*)/){
print "\nmacro SYS.$1 arg1, arg2, arg3{\n";
print "\tmov eax, $2\n";
print "\tif arg1 eq \nelse\n";
print "\t\tmov ebx, arg1\n";
print "\tend if\n";
print "\tif arg2 eq \nelse\n";
print "\t\tmov ecx, arg2\n";
print "\tend if\n";
print "\tif arg3 eq \nelse\n";
print "\t\tmov edx, arg3\n";
print "\tend if\n";
print "\tint 80h\n}\n";
}
}
Just incase anyone wants to use them... There they are. Note that they are not perfect, but they seem to make almost working code (just off by 2 lines max)