Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: stfiwx implementation for PowerPC gdb simulator
@ 2006-11-22 11:04 Tom Marn
  2006-11-28 16:07 ` Daniel Jacobowitz
  2006-11-29 15:28 ` Andrew Cagney
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Marn @ 2006-11-22 11:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: matej.kupljen

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Hi

I append new optional instruction "stfiwx" for PowerPC 603/603e/604 needed by gdb inside sim/ppc simulator. GNU gcc already generates binaries with this instruction and the patch is essential for properly running binaries on gdb simulator (target sim). Without this patch you will get: program interrupt - illegal instruction (optional instruction not supported)

Tom Marn


[-- Attachment #2: gdb-sim-ppc-stfiwx-instruction.patch --]
[-- Type: text/x-patch, Size: 1444 bytes --]

2006-11-22  Tom Marn <tom.marn@telargo.com>
  
    * ppc-instructions: implementation of optional PowerPC stfiwx 
                        instruction for gdb and insight source to avoid
                        illegal instruction code interrupt

--- gdb-6.5/sim/ppc/ppc-instructions.orig	2006-11-22 09:25:56.000000000 +0100
+++ gdb-6.5/sim/ppc/ppc-instructions	2006-11-22 09:42:34.000000000 +0100
@@ -3644,6 +3644,18 @@
 	STORE(EA, 8, *frS);
 	PPC_INSN_INT_FLOAT(0, 0, (RA_BITMASK & ~1) | RB_BITMASK, FRS_BITMASK);
 
+0.31,6.FRS,11.RA,16.RB,21.983,31./:X:f::Store Floating-Point Integer Word Indexed
+*603: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
+*603e:PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
+*604: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  3,  0
+	unsigned_word b;
+	unsigned_word EA;
+	if (RA_is_0) b = 0;
+	else         b = *rA;
+	EA = b + *rB;
+	STORE(EA, 4, *frS);
+	PPC_INSN_INT_FLOAT(0, 0, (RA_BITMASK & ~1) | RB_BITMASK, FRS_BITMASK);
+
 0.55,6.FRS,11.RA,16.D:D:f::Store Floating-Point Double with Update
 *601: PPC_UNIT_IU,    PPC_UNIT_IU,    1,  1,  0
 *603: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
@@ -4682,13 +4694,6 @@
 	FPSCR |= bit;
 	FPSCR_END(Rc);
 
-
-#
-# I.A.1.1 Floating-Point Store Instruction
-#
-0.31,6.FRS,11.RA,16.RB,21.983,31./:X:f,o::Store Floating-Point as Integer Word Indexed
-	program_interrupt(processor, cia, optional_instruction_program_interrupt);
-
 #
 # I.A.1.2 Floating-Point Arithmetic Instructions
 #

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: stfiwx implementation for PowerPC gdb simulator
  2006-11-22 11:04 PATCH: stfiwx implementation for PowerPC gdb simulator Tom Marn
@ 2006-11-28 16:07 ` Daniel Jacobowitz
  2006-11-29  8:33   ` Tom Marn
  2006-11-29 15:28 ` Andrew Cagney
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2006-11-28 16:07 UTC (permalink / raw)
  To: Tom Marn; +Cc: gdb-patches, matej.kupljen

On Wed, Nov 22, 2006 at 12:04:33PM +0100, Tom Marn wrote:
> Hi
> 
> I append new optional instruction "stfiwx" for PowerPC 603/603e/604 needed 
> by gdb inside sim/ppc simulator. GNU gcc already generates binaries with 
> this instruction and the patch is essential for properly running binaries 
> on gdb simulator (target sim). Without this patch you will get: program 
> interrupt - illegal instruction (optional instruction not supported)

I would review this patch, except that I have no idea whether it's
correct.  I hope someone more familiar with PowerPC is able to look
at it.

I'd recommend not moving the instruction; I believe the comments are
section references to the manual from which the pseudocode came
originally.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: stfiwx implementation for PowerPC gdb simulator
  2006-11-28 16:07 ` Daniel Jacobowitz
@ 2006-11-29  8:33   ` Tom Marn
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Marn @ 2006-11-29  8:33 UTC (permalink / raw)
  To: Tom Marn, gdb-patches, matej.kupljen

Daniel Jacobowitz wrote:
> I would review this patch, except that I have no idea whether it's
> correct.  I hope someone more familiar with PowerPC is able to look
> at it.
>

Thank you Daniel

The instruction is the same as stfdx except that the stfiwx has effect only on lower 4 bytes instead of full 8 (as stfdx)
My reference for that instruction:

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.aixassem/doc/alangref/stfiwx.htm

and also:
the code for stfdx in gdb/sim/ppc/ppc-instructions file

> I'd recommend not moving the instruction; I believe the comments are
> section references to the manual from which the pseudocode came
> originally.
>

I agree not moving the location of implementation but: At first, I did implement the instruction on comment out section but I had a problems with dynamic code generator (i don't know why there is not appropriate place), code just won't compile. If someone has a better knowledge about code locations inside ppc-instructions also this could be corrected.

It is also strange that only this instruction is left out (or forgotten), all others "optional PowerPC instructions" are implemented. Instead of this instruction the illegal instruction exception is raised, but also in linux kernel there is no implementation. I think that the problem becomes more and more obvious (this year i think) when GCC starts to generate the binaries with this instruction. The same thing is in the QEMU, guess what, also this instruction is missing, where I'm also trying to implement stfiwx instruction. But this is for QEMU mailing list, where i also saw your contributions, maybe we could fix this problem together.

Tom Marn 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: stfiwx implementation for PowerPC gdb simulator
  2006-11-22 11:04 PATCH: stfiwx implementation for PowerPC gdb simulator Tom Marn
  2006-11-28 16:07 ` Daniel Jacobowitz
@ 2006-11-29 15:28 ` Andrew Cagney
  2006-11-29 15:30   ` Daniel Jacobowitz
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2006-11-29 15:28 UTC (permalink / raw)
  To: tom.marn; +Cc: gdb-patches, matej.kupljen

Tom Marn wrote:
> Hi
> 
> I append new optional instruction "stfiwx" for PowerPC 603/603e/604 
> needed by gdb inside sim/ppc simulator. GNU gcc already generates 
> binaries with this instruction and the patch is essential for properly 
> running binaries on gdb simulator (target sim). Without this patch you 
> will get: program interrupt - illegal instruction (optional instruction 
> not supported)

Thanks!

I've checked this in (finding a 604 manual is getting tricky :-), but 
with a slightly simpler ChangeLog.

BTW, you may want to do a general audit of ppc-instructions, there could 
be a few other missing optional instructions :-)

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: stfiwx implementation for PowerPC gdb simulator
  2006-11-29 15:28 ` Andrew Cagney
@ 2006-11-29 15:30   ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2006-11-29 15:30 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: tom.marn, gdb-patches, matej.kupljen

On Wed, Nov 29, 2006 at 10:27:39AM -0500, Andrew Cagney wrote:
> Tom Marn wrote:
> >Hi
> >
> >I append new optional instruction "stfiwx" for PowerPC 603/603e/604 
> >needed by gdb inside sim/ppc simulator. GNU gcc already generates 
> >binaries with this instruction and the patch is essential for properly 
> >running binaries on gdb simulator (target sim). Without this patch you 
> >will get: program interrupt - illegal instruction (optional instruction 
> >not supported)
> 
> Thanks!
> 
> I've checked this in (finding a 604 manual is getting tricky :-), but 
> with a slightly simpler ChangeLog.

Thank you too!

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-29 15:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-22 11:04 PATCH: stfiwx implementation for PowerPC gdb simulator Tom Marn
2006-11-28 16:07 ` Daniel Jacobowitz
2006-11-29  8:33   ` Tom Marn
2006-11-29 15:28 ` Andrew Cagney
2006-11-29 15:30   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox