Subject: Re: pkg/34538: TME sun3 emulator incorrectly calculates EA with immediate mod...
To: None <skrll@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: None <SigmFSK@aol.com>
List: pkgsrc-bugs
Date: 10/02/2006 00:05:04
The following reply was made to PR pkg/34538; it has been noted by GNATS.

From: SigmFSK@aol.com
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/34538: TME sun3 emulator incorrectly calculates EA with immediate mod...
Date: Sun, 1 Oct 2006 20:02:37 EDT

 Following is the patch in "diff -u"  format
 
 --- m68k-execute.c.orig 2006-10-01 08:23:58.000000000 -0400
 +++  m68k-execute.c 2006-10-01 08:27:17.000000000 -0400
 @@ -591,6 +591,18  @@
 _TME_M68K_EXECUTE_FETCH_S16(ea_bd);
 /* XXX simulates  preincremented pc: */
 ea_address = ic->tme_m68k_ireg_pc  + first_ea_extword_offset +  ea_bd;
 +
 +          /* if  instruction has immediate, then we need to add either 2  
 bytes
 +              (for byte or word) or 4 bytes (for lword) to get the  effective
 +              address
 +           */
 +          if  (TME_M68K_OPCODE_HAS_IMM(params))  {
 +            if  (TME_FIELD_EXTRACTU(TME_M68K_INSN_OPCODE,6,2) ==  2)
 +               ea_address = ea_address +  4;
 +             else
 +               ea_address = ea_address +  2;
 +           }
 +
 ea_function_code =  function_code_program;
 break;
 }