From bea8bab78455d0736a19c581127b399461ada86c Mon Sep 17 00:00:00 2001
From: an7s <an7s@git.zephyr-software.com>
Date: Sat, 13 Jun 2015 00:38:24 +0000
Subject: [PATCH] fixed bug in fdwait c2e conversion

Former-commit-id: 998a747ddd6cc48186b40104e3c855e9031477a6
---
 tools/c2e/c2e_instr.cpp | 6 +++---
 tools/c2e/c2e_instr.hpp | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/c2e/c2e_instr.cpp b/tools/c2e/c2e_instr.cpp
index e098a0c46..b78e10caa 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 117c1f85b..30ac93462 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) ;
-- 
GitLab