This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc for PPC750 simulator from microlib.org


On Wednesday 18 August 2004 12:36 pm, Sven Heithecker wrote:
> Hi,
>
> we are using a crossgcc-build gcc to compile programms to us with the
> PowerPC 750 simulator/emulator from www.microlib.org. Unfortunately, only
> very small programs run, serious programs crash with the following message:
>
> Attempted to execute a bogus opcode at 0x1001c180 (OPCD = 31, XO_10 = 246,
> XO_9 = 246, XO_5 = 22)
> 0x1001c180 : 0x7c0831ec    ????
> 0x1001c184 : 0x9086fffc    stw r4, -4(r6)
> 0x1001c188 : 0x9086fff8    stw r4, -8(r6)
> 0x1001c18c : 0x9086fff4    stw r4, -12(r6)
> 0x1001c190 : 0x9086fff0    stw r4, -16(r6)
> 0x1001c194 : 0x60000000    ori r0, r0, 0
> 0x1001c198 : 0x9086ffec    stw r4, -20(r6)
> 0x1001c19c : 0x9086ffe8    stw r4, -24(r6)
> 0x1001c1a0 : 0x60000000    ori r0, r0, 0
> 0x1001c1a4 : 0x9086ffe4    stw r4, -28(r6)
>
> Does someone have a clue what to do about this ? Unfortunately, I dont get
> any answer from emails to microlib.org.
>
> Regards, Sven

Sven,

Are you sure the program starts from the _start label like it should?
I had problems with mine since _start was not the first instruction
in the text section.  This patch fixes that, along with a couple of
other bug fixes.  I got no response from the author when I sent in the
patch.

- Jay

diff -uNr orig/ppc750sim-1.0.4/powerpc/src/BTIC.cpp ppc750sim-1.0.4/powerpc/src/BTIC.cpp
--- orig/ppc750sim-1.0.4/powerpc/src/BTIC.cpp	Fri Nov 15 05:19:07 2002
+++ ppc750sim-1.0.4/powerpc/src/BTIC.cpp	Tue Nov 18 10:00:23 2003
@@ -79,16 +79,16 @@
 					
 				case 1:
 					plrubits[index] |= B0;
-					plrubits[index] &= B1;
+					plrubits[index] &= ~B1;
 					break;
 					
 				case 2:
 					plrubits[index] |= B2;
-					plrubits[index] &= B0;
+					plrubits[index] &= ~B0;
 					break;
 					
 				case 3:
-					plrubits[index] &= B0 + B2;
+					plrubits[index] &= ~(B0 + B2);
 					break;
 			}
 			break;
diff -uNr orig/ppc750sim-1.0.4/powerpc/src/Cache.cpp ppc750sim-1.0.4/powerpc/src/Cache.cpp
--- orig/ppc750sim-1.0.4/powerpc/src/Cache.cpp	Fri Nov 15 05:19:07 2002
+++ ppc750sim-1.0.4/powerpc/src/Cache.cpp	Tue Nov 18 10:01:30 2003
@@ -94,16 +94,16 @@
 					
 				case 1:
 					plrubits[index] |= B0;
-					plrubits[index] &= B1;
+					plrubits[index] &= ~B1;
 					break;
 					
 				case 2:
 					plrubits[index] |= B2;
-					plrubits[index] &= B0;
+					plrubits[index] &= ~B0;
 					break;
 					
 				case 3:
-					plrubits[index] &= B0 + B2;
+					plrubits[index] &= ~(B0 + B2);
 					break;
 			}
 			break;
diff -uNr orig/ppc750sim-1.0.4/powerpc/src/Makefile ppc750sim-1.0.4/powerpc/src/Makefile
--- orig/ppc750sim-1.0.4/powerpc/src/Makefile	Fri Nov 15 05:33:43 2002
+++ ppc750sim-1.0.4/powerpc/src/Makefile	Wed Nov 12 14:56:27 2003
@@ -7,7 +7,7 @@
 ######################################################
 
 #SYSTEMC_DIR=/usr/local/systemc-1.0.2
-SYSTEMC_DIR=/usr/local/systemc-2.0.1
+SYSTEMC_DIR=/opt/systemc
 
 ######################################################
 #                                                    #
@@ -53,7 +53,7 @@
 ######################################################
 
 ################## For SystemC 2.x ###################
-CXXFLAGS=-DSC2 -O3 -fomit-frame-pointer -fexpensive-optimizations -fstrength-reduce -fschedule-insns2 -funroll-loops
+CXXFLAGS=-DSC2 -O3 -g -fomit-frame-pointer -fexpensive-optimizations -fstrength-reduce -fschedule-insns2 -funroll-loops
 LIBS=-L$(SYSTEMC_DIR)/lib-$(ARCH) -L$(PPCEMUL_DIR)/lib -lsystemc -lppcemul -lstdc++
 ######################################################
 
diff -uNr orig/ppc750sim-1.0.4/powerpc/src/PowerPC.cpp ppc750sim-1.0.4/powerpc/src/PowerPC.cpp
--- orig/ppc750sim-1.0.4/powerpc/src/PowerPC.cpp	Fri Nov 15 05:45:56 2002
+++ ppc750sim-1.0.4/powerpc/src/PowerPC.cpp	Fri Nov 14 10:45:08 2003
@@ -1136,7 +1136,7 @@
 					{
 						busInterfaceUnit->MemoryWrite(new_section_addr, (UInt8 *) new_section, new_section_size);
 						busInterfaceUnit->ZeroMemory(new_section_addr + new_section_size, 128);
-						fetchUnit->programCounter = new_section_addr;
+						fetchUnit->programCounter = hdr->e_entry;
 					}
 					else
 					{
diff -uNr orig/ppc750sim-1.0.4/ppcemul/src/Makefile ppc750sim-1.0.4/ppcemul/src/Makefile
--- orig/ppc750sim-1.0.4/ppcemul/src/Makefile	Wed Jul 31 04:41:37 2002
+++ ppc750sim-1.0.4/ppcemul/src/Makefile	Fri Nov  7 16:44:11 2003
@@ -9,7 +9,7 @@
 #                                                                                                #
 ##################################################################################################
 
-CFLAGS=-O3 -fomit-frame-pointer -fexpensive-optimizations -fstrength-reduce -fschedule-insns2 -funroll-loops
+CFLAGS=-O3 -g -fomit-frame-pointer -fexpensive-optimizations -fstrength-reduce -fschedule-insns2 -funroll-loops
 LIBS=-lm
 INCLUDES=-I../include
 
diff -uNr orig/ppc750sim-1.0.4/ppcemul/src/loader.c ppc750sim-1.0.4/ppcemul/src/loader.c
--- orig/ppc750sim-1.0.4/ppcemul/src/loader.c	Wed Jul 31 05:37:00 2002
+++ ppc750sim-1.0.4/ppcemul/src/loader.c	Fri Nov  7 16:18:37 2003
@@ -227,7 +227,7 @@
 					{
 						MEM_WRITE(new_section_addr, new_section, new_section_size);
 						MEM_SET(new_section_addr + new_section_size, 0, 128);
-						PC = new_section_addr;
+						PC = hdr->e_entry;
 					}
 					else
 					{

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]