This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, Please find attached reworked patch . I tried to reach http://www.gnu.org/prep/standards_toc.html for coding standards, but it seems that the link is down. Please let me know, if this is okay. Regards, Shrinivas =============================================================================================== Changelog: 2003-08-11 Shrinivas Atre <shrinivasa@KPITCummins.com> * sim/sh/gencode.c ( tab[] ): Addition of MAC.L handler and correction for MAC.W handler * sim/sh/interp.c ( macl ): New Function. Implementation of MAC.L handler. ------------------------------------------------------------------------------------------------ --- sim/sh/gencode.old.c 2003-08-11 17:45:24.000000000 +0530 +++ sim/sh/gencode.c 2003-08-11 17:45:02.000000000 +0530 @@ -580,12 +580,11 @@ op tab[] = }, { "nm", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111", - "trap (255, R0, PC, memory, maskl, maskw, endianw);", - "/* FIXME: mac.l support */", + "macl(&R0,memory,n,m);", }, { "nm", "nm", "mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111", - "macw(R0,memory,n,m,endianw);", + "macw(&R0,memory,n,m,endianw);", }, { "n", "", "mov #<imm>,<REG_N>", "1110nnnni8*1....", ------------------------------------------------------------------------------------------------ --- sim/sh/interp.old.c 2003-08-11 17:45:18.000000000 +0530 +++ sim/sh/interp.c 2003-08-11 17:44:54.000000000 +0530 @@ -169,6 +169,7 @@ static char **prog_argv; #if 1 static int maskw = 0; +static int maskl = 0; #endif static SIM_OPEN_KIND sim_kind; @@ -651,6 +652,7 @@ rbat_fast (memory, x, maskb) #define RUWAT(x) (RWAT(x) & 0xffff) #define RSWAT(x) ((short)(RWAT(x))) +#define RSLAT(x) ((long)(RLAT(x))) #define RSBAT(x) (SEXT(RBAT(x))) #define RDAT(x, n) (do_rdat (memory, (x), (n), (maskl))) @@ -1348,6 +1350,56 @@ macw (regs, memory, n, m, endianw) MACL = sum; } +static void +macl (regs, memory, n, m) + int *regs; + unsigned char *memory; + int m, n; +{ + long tempm, tempn; + long prod, macl, mach, sum; + long long ans,ansl,ansh,t; + unsigned long long high,low,combine; + union mac64 + { + long m[2]; /* mach and macl*/ + long long m64; /* 64 bit MAC */ + }mac64; + + tempm = RSLAT(regs[m]); + regs[m] += 4; + + tempn = RSLAT(regs[n]); + regs[n] += 4; + + mach = MACH; + macl = MACL; + + mac64.m[0] = macl; + mac64.m[1] = mach; + + ans = (long long)tempm * (long long)tempn; /* Multiply 32bit * 32bit */ + + mac64.m64 += ans; /* Accumulate 64bit + 64 bit */ + + macl = mac64.m[0]; + mach = mac64.m[1]; + + if (S) /* Store only 48 bits of the result */ + { + if (mach < 0) /* Result is negative */ + { + mach = mach & 0x0000ffff; /* Mask higher 16 bits */ + mach |= 0xffff8000; /* Sign extend higher 16 bits */ + } + else + mach = mach & 0x00007fff; /* Postive Result */ + } + + MACL = macl; + MACH = mach; +} + static struct loop_bounds get_loop_bounds (rs, re, memory, mem_end, maskw, endianw) int rs, re; ------------------------------------------------------------------------------------------------ > -----Original Message----- > From: Michael Snyder [mailto:msnyder@redhat.com] > Sent: Saturday, August 09, 2003 4:28 AM > To: gdb-gnats@sources.redhat.com; nobody@sources.redhat.com; Shrinivas > Atre; gdb-prs@sources.redhat.com > Subject: Re: sim/1116: UPDATED PATCH: SH Simulator - MAC.L > implementation and MAC.W correction > > > http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit > -trail&database=gdb&pr=1116 > > Patch approved, if first re-indented to conform to rest of > source file. > Michael Snyder > > >
Attachment:
gencode.diff
Description: gencode.diff
Attachment:
interp.diff
Description: interp.diff
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |