notaz.gp2x.de
/
ia32rtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
74cea04
)
autoadd includes, kill entrypoint
author
notaz
<notasas@gmail.com>
Fri, 31 Jan 2014 00:42:12 +0000
(
02:42
+0200)
committer
notaz
<notasas@gmail.com>
Fri, 31 Jan 2014 01:04:53 +0000
(
03:04
+0200)
plugin/saveasm.cpp
patch
|
blob
|
blame
|
history
diff --git
a/plugin/saveasm.cpp
b/plugin/saveasm.cpp
index
ba66076
..
f8d2639
100644
(file)
--- a/
plugin/saveasm.cpp
+++ b/
plugin/saveasm.cpp
@@
-42,6
+42,7
@@
static const char *reserved_names[] = {
"type",
"offset",
"aam",
"type",
"offset",
"aam",
+ "text",
};
static int is_name_reserved(const char *name)
};
static int is_name_reserved(const char *name)
@@
-375,6
+376,14
@@
static void idaapi run(int /*arg*/)
memcpy(p, ".xmm", 4);
fout_line++;
qfprintf(fout, "%s\n", buf);
memcpy(p, ".xmm", 4);
fout_line++;
qfprintf(fout, "%s\n", buf);
+ continue;
+ }
+ p = strstr(buf, ".model");
+ if (p != NULL) {
+ qstrncpy(p, "include imports.inc", sizeof(buf) - (p - buf));
+ fout_line++;
+ qfprintf(fout, "\n%s\n", buf);
+ continue;
}
}
pl.lnnum = i;
}
}
pl.lnnum = i;
@@
-452,20
+461,24
@@
pass:
for (i = pl.lnnum; i < n; i++) {
do_def_line(buf, sizeof(buf), ln.down());
for (i = pl.lnnum; i < n; i++) {
do_def_line(buf, sizeof(buf), ln.down());
+ char *fw;
+ for (fw = buf; *fw != 0 && *fw == ' '; )
+ fw++;
+
// patches..
if (drop_large) {
// patches..
if (drop_large) {
- p = strstr(
buf
, "large ");
+ p = strstr(
fw
, "large ");
if (p != NULL)
memmove(p, p + 6, strlen(p + 6) + 1);
}
while (drop_rva) {
if (p != NULL)
memmove(p, p + 6, strlen(p + 6) + 1);
}
while (drop_rva) {
- p = strstr(
buf
, " rva ");
+ p = strstr(
fw
, " rva ");
if (p == NULL)
break;
memmove(p, p + 4, strlen(p + 4) + 1);
}
if (set_scale) {
if (p == NULL)
break;
memmove(p, p + 4, strlen(p + 4) + 1);
}
if (set_scale) {
- p = strchr(
buf
, '[');
+ p = strchr(
fw
, '[');
if (p != NULL)
p = strchr(p, '+');
if (p != NULL && p[1] == 'e') {
if (p != NULL)
p = strchr(p, '+');
if (p != NULL && p[1] == 'e') {
@@
-477,7
+490,7
@@
pass:
}
}
else if (jmp_near) {
}
}
else if (jmp_near) {
- p = strchr(
buf
, 'j');
+ p = strchr(
fw
, 'j');
while (p && *p != ' ')
p++;
while (p && *p == ' ')
while (p && *p != ' ')
p++;
while (p && *p == ' ')
@@
-488,7
+501,7
@@
pass:
}
}
if (word_imm) {
}
}
if (word_imm) {
- p = strstr(
buf
, ", ");
+ p = strstr(
fw
, ", ");
if (p != NULL && '0' <= p[2] && p[2] <= '9') {
p += 2;
memmove(p + 9, p, strlen(p) + 1);
if (p != NULL && '0' <= p[2] && p[2] <= '9') {
p += 2;
memmove(p + 9, p, strlen(p) + 1);
@@
-496,7
+509,7
@@
pass:
}
}
else if (dword_imm) {
}
}
else if (dword_imm) {
- p = strstr(
buf
, ", ");
+ p = strstr(
fw
, ", ");
if (p != NULL && '0' <= p[2] && p[2] <= '9') {
p += 2;
memmove(p + 10, p, strlen(p) + 1);
if (p != NULL && '0' <= p[2] && p[2] <= '9') {
p += 2;
memmove(p + 10, p, strlen(p) + 1);
@@
-504,9
+517,9
@@
pass:
}
}
else if (do_pushf) {
}
}
else if (do_pushf) {
- p = strstr(
buf
, "pushf");
+ p = strstr(
fw
, "pushf");
if (p == NULL)
if (p == NULL)
- p = strstr(
buf
, "popf");
+ p = strstr(
fw
, "popf");
if (p != NULL) {
p = strchr(p, 'f') + 1;
memmove(p + 1, p, strlen(p) + 1);
if (p != NULL) {
p = strchr(p, 'f') + 1;
memmove(p + 1, p, strlen(p) + 1);
@@
-514,6
+527,14
@@
pass:
}
}
}
}
+ if (fw[0] == 'e' && IS_START(fw, "end") && fw[3] == ' ') {
+ fout_line++;
+ qfprintf(fout, "include public.inc\n\n");
+
+ // kill entry point
+ fw[3] = 0;
+ }
+
fout_line++;
qfprintf(fout, "%s\n", buf);
}
fout_line++;
qfprintf(fout, "%s\n", buf);
}