diff --git a/tools/c2e/c2e_instr.cpp b/tools/c2e/c2e_instr.cpp index e098a0c4659900d5a57e34c0bc23c62063a1b94b..b78e10caab6626a97d7efe9454c9b91714599471 100644 --- a/tools/c2e/c2e_instr.cpp +++ b/tools/c2e/c2e_instr.cpp @@ -251,16 +251,16 @@ Instruction_t* Cgc2Elf_Instrument::insertFdwait(Instruction_t* after) Instruction_t *jmp2return=NULL, *jmp2error=NULL, *success=NULL, *error=NULL; char buf[100]; sprintf(buf, "mov eax, %d", SYS_select); - after=insertAssemblyAfter(firp, after, "push esi"); // push readyfds + after=insertAssemblyAfter(firp, after, "push edi"); // push readyfds after=insertAssemblyAfter(firp, after, buf); // set eax to syscall # after=insertAssemblyAfter(firp, after, "mov edi, esi"); // mov 4th param to fdwait - fdwait(...,timeout,...) // into 5th param to select - select(...,timeout,...) after=insertAssemblyAfter(firp, after, "mov esi, 0"); // set 4th param to select to 0 after=insertAssemblyAfter(firp, after, "int 0x80"); // make syscall - after=insertAssemblyAfter(firp, after, "pop esi"); // pop readyfds + after=insertAssemblyAfter(firp, after, "pop edi"); // pop readyfds after=insertAssemblyAfter(firp, after, "cmp eax, -1"); // if return == -1 jmp2error=after=insertAssemblyAfter(firp, after, "je 0x0"); // jmp to error - after=insertAssemblyAfter(firp, after, "cmp esi, 0"); // if tx_bytes == 0 + after=insertAssemblyAfter(firp, after, "cmp edi, 0"); // if tx_bytes == 0 jmp2return=after=insertAssemblyAfter(firp, after, "je 0x0"); // jmp to success after=insertAssemblyAfter(firp, after, "mov [esi], eax"); // store return value into readyfds success=after=insertAssemblyAfter(firp, after, "mov eax, 0"); // return success diff --git a/tools/c2e/c2e_instr.hpp b/tools/c2e/c2e_instr.hpp index 117c1f85b54d3fb0a745e0c90da6c316e0094f0d..30ac9346299bc57ecd7d94ae7a3bd0ba2c28f4e7 100644 --- a/tools/c2e/c2e_instr.hpp +++ b/tools/c2e/c2e_instr.hpp @@ -17,7 +17,7 @@ class Cgc2Elf_Instrument libIRDB::Instruction_t* insertTerminate(libIRDB::Instruction_t* after) ; libIRDB::Instruction_t* insertTransmit(libIRDB::Instruction_t* after, int sysno=SYS_write) ; - libIRDB::Instruction_t* insertReceive(libIRDB::Instruction_t* after, bool force_stdin=false) ; + libIRDB::Instruction_t* insertReceive(libIRDB::Instruction_t* after, bool force_stdin=true) ; libIRDB::Instruction_t* insertFdwait(libIRDB::Instruction_t* after) ; libIRDB::Instruction_t* insertAllocate(libIRDB::Instruction_t* after) ; libIRDB::Instruction_t* insertDeallocate(libIRDB::Instruction_t* after) ;