I had a similar problem with thumb instruction. The patch below (provided
by Ali) fixed my problem. I think this should work for you as well.

diff -r 839eeb3fcdf8 util/m5/m5op_arm.S
--- a/util/m5/m5op_arm.S        Mon Apr 30 10:23:46 2012 -0500

+++ b/util/m5/m5op_arm.S        Mon Apr 30 16:50:41 2012 -0500
@@ -41,14 +41,26 @@
  *          Ali Saidi
  *          Chander Sudanthi
  */
+.syntax unified
+#ifdef __thumb__
+.thumb

+#endif

 #define m5_op 0xEE

 #include "m5ops.h"

+#ifdef __thumb__
+#define INST(op, ra, rb, func)                          \
+        .short (((op) << 8) | (func));                  \

+        .short (((ra) << 12) | (0x1 << 8) | (0x1 << 4) | (rb))
+/*               m5ops           m5func         */
+/*                ra         coproc 1       op=1       rb   */
+#else

 #define INST(op, ra, rb, func) \
         .long (((op) << 24) | ((func) << 16) | ((ra) << 12) | (0x1 <<
8) | (0x1 << 4) | (rb))
 /*               m5ops           m5func             ra         coproc
1       op=1       rb   */

+#endif

 #define LEAF(func)    \
         .globl  func; \


Thanks,
Amin




On Mon, Nov 12, 2012 at 8:41 AM, Fernando Endo <fernando.en...@gmail.com>wrote:

> Hello all,
>
> I'm trying to run an ARM code using the thumb instruction set. I'm using
> the stable version of gem5.
> The code is completly writen in C, and my target is "arm_detailed". I use
> the instructions m5_reset_stats and m5_dump_stats provided by gem5 to
> control the stats generation.
>
> When I compile, I get some warning messages (listing 1)
> I think they can be ignored, because both instruction I use aren't
> truncated
>
> Ok, then gem5 panics at an unknown instruction (listing 2).
> Saddly, when I comment the m5_*_stats commands, gem5 simutation is ok
> (listing 3).
>
> With or without -mcpu=cortex-a9, the result is the same. The code works
> without -mthumb and -D__thumb__. Any idea?
>
> listing 1:
> -----
> arm-linux-gnueabi-gcc-4.4 -I"../gem5-stable" -D__thumb__ -O3 -static
> -mthumb -mcpu=cortex-a9 -o main_unroll.o -c main_unroll.c
> arm-linux-gnueabi-gcc-4.4 -I"../gem5-stable" -D__thumb__ -O3 -static
> -mthumb -mcpu=cortex-a9 -o utils.o -c utils.c
> arm-linux-gnueabi-gcc-4.4 -I"../gem5-stable" -D__thumb__ -O3 -static
> -mthumb -mcpu=cortex-a9 -o mmunroll1.o -c mmunroll1.c
> arm-linux-gnueabi-gcc-4.4 -I"../gem5-stable" -D__thumb__ -O3 -static
> -mthumb -mcpu=cortex-a9 -o mmunroll1.bin mmunroll1.o main_unroll.o utils.o
> ../gem5-stable/util/m5/m5op_arm.S
> ../gem5-stable/util/m5/m5op_arm.S: Assembler messages:
> ../gem5-stable/util/m5/m5op_arm.S:159: Warning: value 0x10110 truncated to
> 0x110
> ../gem5-stable/util/m5/m5op_arm.S:160: Warning: value 0x11110 truncated to
> 0x1110
> -----
>
> listing 2:
> -----
> gem5 Simulator System.  http://gem5.org
> gem5 is copyrighted software; use the --copyright option for details.
>
> gem5 compiled Nov  6 2012 18:03:46
> gem5 started Nov 12 2012 15:06:28
> gem5 executing on GRE034537
> command line: gem5-stable/build/ARM/gem5.opt -d Results/gem5out
> --stats-file=statsMMU1.txt gem5-stable/configs/example/se.py -c
> mmul_src/mmunroll1.bin -o 10 --caches --l2cache --cpu-type=arm_detailed
> Global frequency set at 1000000000000 ticks per second
> 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
> **** REAL SIMULATION ****
> info: Entering event queue @ 0.  Starting simulation...
> warn: CP14 unimplemented crn[14], opc1[7], crm[15], opc2[7]
> matrix size : 10 x 10 elements
> matrix size :   0x190 bytes
> size of gdata : 0x100000 bytes
> panic: Attempted to execute unknown instruction (inst 0x2ee4146f7)
>  @ cycle 21103000
> [invoke:build/ARM/arch/arm/faults.cc, line 191]
> Memory Usage: 629556 KBytes
> Program aborted at cycle 21103000
> -----
>
> listing 3:
>  -----
> gem5 Simulator System.  http://gem5.org
> gem5 is copyrighted software; use the --copyright option for details.
>
> gem5 compiled Nov  6 2012 18:03:46
> gem5 started Nov 12 2012 15:13:12
> gem5 executing on GRE034537
> command line: gem5-stable/build/ARM/gem5.opt -d Results/gem5out
> --stats-file=statsMMU1.txt gem5-stable/configs/example/se.py -c
> mmul_src/mmunroll1.bin -o 10 --caches --l2cache --cpu-type=arm_detailed
> Global frequency set at 1000000000000 ticks per second
> 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
> **** REAL SIMULATION ****
> info: Entering event queue @ 0.  Starting simulation...
> warn: CP14 unimplemented crn[14], opc1[7], crm[15], opc2[7]
> matrix size : 10 x 10 elements
> matrix size :   0x190 bytes
> size of gdata : 0x100000 bytes
> hack: be nice to actually delete the event here
> Exiting @ tick 27101000 because target called exit()
> -----
>
> Regards,
>
> --
> Fernando A. Endo, PhD student and researcher
>
> Université de Grenoble, UJF
> France
>
>
> _______________________________________________
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to