krnl386.exe16: Honour segment prefix override for outs[bwd] instruction

Bruno Jesus 00cpxxx at gmail.com
Tue Nov 22 00:03:01 CST 2016


Based on discussion from Morten Welinder, reference https://www.winehq.org/pipermail/wine-devel/2016-September/114664.html

Backed with information from http://faydoc.tripod.com/cpu/outsb.htm and http://x86.renejeschke.de/html/file_module_x86_id_223.html

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
---
 dlls/krnl386.exe16/instr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/krnl386.exe16/instr.c b/dlls/krnl386.exe16/instr.c
index b0de30f..f59ce90 100644
--- a/dlls/krnl386.exe16/instr.c
+++ b/dlls/krnl386.exe16/instr.c
@@ -645,14 +645,17 @@ DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
                           (long_addr ? context->Ecx : LOWORD(context->Ecx)) : 1;
 	      int opsize = (typ & 1) ? (long_op ? 4 : 2) : 1;
 	      int step = (context->EFlags & 0x400) ? -opsize : +opsize;
-	      int seg = outp ? context->SegDs : context->SegEs;  /* FIXME: is this right? */
+	      int seg;
 
 	      if (outp)
               {
+		/* Check if there is a segment prefix override and honour it */
+		seg = segprefix == -1 ? context->SegDs : segprefix;
 		/* FIXME: Check segment is readable.  */
               }
 	      else
               {
+		seg = context->SegEs;
 		/* FIXME: Check segment is writable.  */
               }
 
-- 
2.9.3




More information about the wine-patches mailing list