summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-29 01:42:17 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-29 01:42:17 +0800
commitd02dbcac9d53d84a8b0c8b5a46479dd87a37ae93 (patch)
tree3e5c6da0ee81d7864a547f946465ee663998b886
parent09ffedb60dc6d2e8abca77ecf3bebcaefa483c1b (diff)
downloadrich4-d02dbcac9d53d84a8b0c8b5a46479dd87a37ae93.tar.xz
final fix
-rw-r--r--csrc/mkf_asm.asm2
-rw-r--r--csrc/mkf_asm_data.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/csrc/mkf_asm.asm b/csrc/mkf_asm.asm
index 2a9d9b1..7a5d0b6 100644
--- a/csrc/mkf_asm.asm
+++ b/csrc/mkf_asm.asm
@@ -11,7 +11,7 @@ extern cfcn_004551bb
extern cfcn_00455040
fcn_00455040:
-;jmp cfcn_00455040
+jmp cfcn_00455040
push ebp
mov ebp, esp
push ebx
diff --git a/csrc/mkf_asm_data.c b/csrc/mkf_asm_data.c
index 032034a..555f861 100644
--- a/csrc/mkf_asm_data.c
+++ b/csrc/mkf_asm_data.c
@@ -669,8 +669,22 @@ void cfcn_00455040(void *arg1, void *arg2)
bx -= 0xfd;
void *old_esi = esi; /* push esi */
esi = edi - 1 - dx;
- memcpy(edi, esi, bx); /* using rep movsb */
+
+ /* the following is a little bit tricky,
+ * if we use memcpy/memmove, the picture is broken
+ */
+#if 1
+ ecx = bx;
+ do {
+ *(uint8_t*)edi = *(uint8_t*)esi;
+ edi++;
+ esi++;
+ ecx--;
+ } while (ecx);
+#else
+ memmove(edi, esi, bx); /* using rep movsb */
edi += bx; /* by movsb */
+#endif
esi = old_esi; /* pop esi */
ecx = old_ecx; /* restore ecx */
}