From 9d7137b757c946771c017073183a24a501a38680 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 21 Sep 2013 01:00:36 +0000 Subject: [PATCH] [SOFT386] Fix the CALL instruction. The offset must be fetched before EIP is pushed. svn path=/branches/ntvdm/; revision=60259 --- lib/soft386/opcodes.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index b0dd8f58e45..88dcdfa361a 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -4506,13 +4506,6 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall) return FALSE; } - /* Push the current value of the instruction pointer */ - if (!Soft386StackPush(State, State->InstPtr.Long)) - { - /* Exception occurred */ - return FALSE; - } - if (Size) { LONG Offset = 0; @@ -4524,6 +4517,13 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall) return FALSE; } + /* Push the current value of the instruction pointer */ + if (!Soft386StackPush(State, State->InstPtr.Long)) + { + /* Exception occurred */ + return FALSE; + } + /* Move the instruction pointer */ State->InstPtr.Long += Offset; } @@ -4538,6 +4538,13 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall) return FALSE; } + /* Push the current value of the instruction pointer */ + if (!Soft386StackPush(State, State->InstPtr.Long)) + { + /* Exception occurred */ + return FALSE; + } + /* Move the instruction pointer */ State->InstPtr.LowWord += Offset; }