Discussion:
ARM SE: cannot decode flags 0x40000
(too old to reply)
Amin Farmahini
2012-04-28 02:38:11 UTC
Permalink
Hi,

I have written a very simple hello world program to run on ARM SE. However,
the simulator prints a warning, and the simulation never finishes (Gem5
keeps ticking, but no progress. So I have to manually stop it). Here is the
program:

#include <stdio.h>
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); * //if I comment this out, then it works fine*
}

And here is the output:
command line: build/ARM/gem5.opt configs/example/se.py -c hello
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...
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: *open: cannot decode flags 0x40000*
^Chack: be nice to actually delete the event here
Exiting @ tick 85824528000 because user interrupt received

I took a look at arm/linux.linux.hh and it seems like flag
*0x40000*corresponds to TGT_O_DIRECT. FYI, hostflags are set to
0x23000 (defined in
syscall_emul.hh).

The weird thing is that if I comment out the last printf("Hello World\n");
then the whole simulation works just fine.

Any thoughts what the problem might be?

Thanks,
Amin
Ali Saidi
2012-04-28 15:03:38 UTC
Permalink
The error message is printed with hex and the flags are listed with octal, so they're not the same. It's complaining about NOATIME which as it turns out is not in flag translation table in: src/arch/arm/linux/linux.cc

You can certainly try to add it, however I'm skeptical that it's going to fix your problem, but maybe it will.

You're going to need to use the debug flags (particularly Exec) to figure out what the CPU is doing differently with the addition of the single printf. It shouldn't change anything, but clearly it is.

Ali
Post by Amin Farmahini
Hi,
#include <stdio.h>
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); //if I comment this out, then it works fine
}
command line: build/ARM/gem5.opt configs/example/se.py -c hello
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: open: cannot decode flags 0x40000
^Chack: be nice to actually delete the event here
I took a look at arm/linux.linux.hh and it seems like flag 0x40000 corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000 (defined in syscall_emul.hh).
The weird thing is that if I comment out the last printf("Hello World\n"); then the whole simulation works just fine.
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Gabe Black
2012-04-28 22:14:24 UTC
Permalink
I'd guess it isn't the printf itself that changes things, it's probably
that that changes the size of the function, stack frame, etc., and makes
the compiler generate different code or use different syscalls or
underlying functions. It could also be it changes how/when stdio is
buffered.

Gabe
Post by Ali Saidi
The error message is printed with hex and the flags are listed with
octal, so they're not the same. It's complaining about NOATIME which
as it turns out is not in flag translation table
in: src/arch/arm/linux/linux.cc
You can certainly try to add it, however I'm skeptical that it's going
to fix your problem, but maybe it will.
You're going to need to use the debug flags (particularly Exec) to
figure out what the CPU is doing differently with the addition of the
single printf. It shouldn't change anything, but clearly it is.
Ali
Post by Amin Farmahini
Hi,
I have written a very simple hello world program to run on ARM SE.
However, the simulator prints a warning, and the simulation never
finishes (Gem5 keeps ticking, but no progress. So I have to manually
#include <stdio.h>
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); *//if I comment this out, then it works
fine*
}
command line: build/ARM/gem5.opt configs/example/se.py -c hello
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: *open: cannot decode flags 0x40000*
^Chack: be nice to actually delete the event here
I took a look at arm/linux.linux.hh and it seems like flag *0x40000*
corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000
(defined in syscall_emul.hh).
The weird thing is that if I comment out the last printf("Hello
World\n"); then the whole simulation works just fine.
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Amin Farmahini
2012-04-30 03:00:29 UTC
Permalink
Ali and Gabe,

Thanks for your responses. I found out that disabling thumb instructions in
gcc (-mno-thumb) fixes this problem. I'll try to dig into this more
tomorrow.

Ali,

As you mentioned, adding that flag did not help much. I got the panic
message of "Page table fault when accessing virtual address."

Thanks,
Amin
Post by Gabe Black
**
I'd guess it isn't the printf itself that changes things, it's probably
that that changes the size of the function, stack frame, etc., and makes
the compiler generate different code or use different syscalls or
underlying functions. It could also be it changes how/when stdio is
buffered.
Gabe
The error message is printed with hex and the flags are listed with octal,
so they're not the same. It's complaining about NOATIME which as it turns
out is not in flag translation table in: src/arch/arm/linux/linux.cc
You can certainly try to add it, however I'm skeptical that it's going
to fix your problem, but maybe it will.
You're going to need to use the debug flags (particularly Exec) to
figure out what the CPU is doing differently with the addition of the
single printf. It shouldn't change anything, but clearly it is.
Ali
Hi,
I have written a very simple hello world program to run on ARM SE.
However, the simulator prints a warning, and the simulation never finishes
(Gem5 keeps ticking, but no progress. So I have to manually stop it). Here
#include <stdio.h>
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); * //if I comment this out, then it works fine
*
}
command line: build/ARM/gem5.opt configs/example/se.py -c hello
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: *open: cannot decode flags 0x40000*
^Chack: be nice to actually delete the event here
I took a look at arm/linux.linux.hh and it seems like flag *0x40000*corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000 (defined in
syscall_emul.hh).
The weird thing is that if I comment out the last printf("Hello World\n");
then the whole simulation works just fine.
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Ali Saidi
2012-04-30 11:55:35 UTC
Permalink
Hi Amin,

I'd really like to know what is going on. It all should work. What version of gcc are you using?

Thanks,
Ali
Post by Amin Farmahini
Ali and Gabe,
Thanks for your responses. I found out that disabling thumb instructions in gcc (-mno-thumb) fixes this problem. I'll try to dig into this more tomorrow.
Ali,
As you mentioned, adding that flag did not help much. I got the panic message of "Page table fault when accessing virtual address."
Thanks,
Amin
I'd guess it isn't the printf itself that changes things, it's probably that that changes the size of the function, stack frame, etc., and makes the compiler generate different code or use different syscalls or underlying functions. It could also be it changes how/when stdio is buffered.
Gabe
Post by Ali Saidi
The error message is printed with hex and the flags are listed with octal, so they're not the same. It's complaining about NOATIME which as it turns out is not in flag translation table in: src/arch/arm/linux/linux.cc
You can certainly try to add it, however I'm skeptical that it's going to fix your problem, but maybe it will.
You're going to need to use the debug flags (particularly Exec) to figure out what the CPU is doing differently with the addition of the single printf. It shouldn't change anything, but clearly it is.
Ali
Post by Amin Farmahini
Hi,
#include <stdio.h>
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); //if I comment this out, then it works fine
}
command line: build/ARM/gem5.opt configs/example/se.py -c hello
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: open: cannot decode flags 0x40000
^Chack: be nice to actually delete the event here
I took a look at arm/linux.linux.hh and it seems like flag 0x40000 corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000 (defined in syscall_emul.hh).
The weird thing is that if I comment out the last printf("Hello World\n"); then the whole simulation works just fine.
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Ali Saidi
2012-04-30 18:13:47 UTC
Permalink
Hi Amin,

Are you using gem5 stable or development? There was a bug
that might explain this that was fixed about 5 weeks ago in the
development repository.

Thanks,

Ali

On 30.04.2012 07:55, Ali Saidi
Post by Ali Saidi
Hi Amin,
I'd really like to know what is going on. It all
should work. What version of gcc are you using?
Post by Ali Saidi
Thanks,
Ali
Post by Amin Farmahini
Ali and Gabe,
Thanks for your responses. I found out that disabling thumb
instructions in gcc (-mno-thumb) fixes this problem. I'll try to dig
into this more tomorrow.
Post by Ali Saidi
Post by Amin Farmahini
Ali,
As you mentioned, adding
that flag did not help much. I got the panic message of "Page table
fault when accessing virtual address."
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
On
Post by Gabe Black
I'd guess it isn't the printf itself that changes things,
it's probably that that changes the size of the function, stack frame,
etc., and makes the compiler generate different code or use different
syscalls or underlying functions. It could also be it changes how/when
stdio is buffered.
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Gabe
On 04/28/12 08:03, Ali Saidi
Post by Ali Saidi
The error message is printed with hex and the flags
are listed with octal, so they're not the same. It's complaining about
NOATIME which as it turns out is not in flag translation table in:
src/arch/arm/linux/linux.cc
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You can certainly try to add it,
however I'm skeptical that it's going to fix your problem, but maybe it
will.
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You're going to need to use the debug flags (particularly
Exec) to figure out what the CPU is doing differently with the addition
of the single printf. It shouldn't change anything, but clearly it is.
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Ali
On Apr 27, 2012, at 10:38 PM, Amin Farmahini
Post by Amin Farmahini
Hi,
I have written a very simple hello
world program to run on ARM SE. However, the simulator prints a warning,
and the simulation never finishes (Gem5 keeps ticking, but no progress.
So I have to manually stop it). Here is the program:
#include
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
#include "m5op.h"
int main() {
printf("Hello
Worldn");
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
m5_reset_stats(0,0);
printf("Hello Worldn");
printf("Hello Worldn");
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
printf("Hello Worldn"); //IF I COMMENT
THIS OUT, THEN IT WORKS FINE
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
}
And here is the
command line: build/ARM/gem5.opt configs/example/se.py -c
hello
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port
7000
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
**** REAL SIMULATION ****
0. Starting simulation...
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Hello World
warn: instruction
'cdp' unimplemented
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
warn: Syscall: OPEN: CANNOT DECODE FLAGS
0X40000
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
^Chack: be nice to actually delete the event here
Exiting @ tick 85824528000 because user interrupt received
I took a look at arm/linux.linux.hh and it seems like flag 0X40000
corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000 (defined
in syscall_emul.hh).
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
The weird thing is that if I comment
out the last printf("Hello Worldn"); then the whole simulation works
just fine.
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [2]
_______________________________________________ gem5-users mailing list
gem5-***@gem5.org [3]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [4]
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [6]
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users




Links:
------
[1] mailto:gem5-***@gem5.org
[2]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[3]
mailto:gem5-***@gem5.org
[4]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[5]
mailto:gem5-***@gem5.org
[6]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[7]
mailto:***@eecs.umich.edu
[8] mailto:gem5-***@gem5.org
Amin Farmahini
2012-04-30 18:28:34 UTC
Permalink
Hi Ali,

I am using the development copy.

And here is the gcc I am using:
../Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc
--version

arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite 2011.09-70) 4.6.1

And here is input command to generate the binary using thumb instructions:
arm-none-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=vfpv3
-mfloat-abi=softfp -static util/m5/m5op_arm.S -Iutil/m5 hello.c -o hello
-Wall

and here is input command to generate the binary without thumb instruction:
arm-none-linux-gnueabi-gcc -march=armv7-a -mno-thumb -mfpu=vfpv3
-mfloat-abi=softfp -static util/m5/m5op_arm.S -Iutil/m5 hello.c -o hello
-Wall

Let me know if you need more information. I am new to Gem5, so it is
possible that I am doing something wrong.

Thanks,
Amin
Post by Ali Saidi
**
Hi Amin,
Are you using gem5 stable or development? There was a bug that might
explain this that was fixed about 5 weeks ago in the development repository.
Thanks,
Ali
Hi Amin,
I'd really like to know what is going on. It all should work. What version
of gcc are you using?
Thanks,
Ali
Ali and Gabe,
Thanks for your responses. I found out that disabling thumb instructions
in gcc (-mno-thumb) fixes this problem. I'll try to dig into this more
tomorrow.
Ali,
As you mentioned, adding that flag did not help much. I got the panic
message of "Page table fault when accessing virtual address."
Thanks,
Amin
Post by Gabe Black
I'd guess it isn't the printf itself that changes things, it's probably
that that changes the size of the function, stack frame, etc., and makes
the compiler generate different code or use different syscalls or
underlying functions. It could also be it changes how/when stdio is
buffered.
Gabe
The error message is printed with hex and the flags are listed with
octal, so they're not the same. It's complaining about NOATIME which as it
turns out is not in flag translation table in: src/arch/arm/linux/linux.cc
You can certainly try to add it, however I'm skeptical that it's going to
fix your problem, but maybe it will.
You're going to need to use the debug flags (particularly Exec) to figure
out what the CPU is doing differently with the addition of the single
printf. It shouldn't change anything, but clearly it is.
Ali
Hi,
I have written a very simple hello world program to run on ARM SE.
However, the simulator prints a warning, and the simulation never finishes
(Gem5 keeps ticking, but no progress. So I have to manually stop it). Here
#include
#include "m5op.h"
int main() {
printf("Hello World\n");
m5_reset_stats(0,0);
printf("Hello World\n");
printf("Hello World\n");
printf("Hello World\n"); * //if I comment this out, then it works fine*
}
command line: build/ARM/gem5.opt configs/example/se.py -c hello
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
Hello World
warn: instruction 'cdp' unimplemented
warn: Syscall: *open: cannot decode flags 0x40000*
^Chack: be nice to actually delete the event here
I took a look at arm/linux.linux.hh and it seems like flag *0x40000*corresponds to TGT_O_DIRECT. FYI, hostflags are set to 0x23000 (defined in
syscall_emul.hh).
The weird thing is that if I comment out the last printf("Hello
World\n"); then the whole simulation works just fine.
Any thoughts what the problem might be?
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________ gem5-users mailing list
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Ali Saidi
2012-04-30 21:41:07 UTC
Permalink
Hi Amin,

The issue is that you're compiling m5op_arm.S as thumb
code. It would need some work for that to end up creating the right
thing since we encode the instructions with .longs.

Ali

On
Post by Amin Farmahini
Hi Ali,
I am using the
development copy.
../Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc
--version
Post by Amin Farmahini
arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite
2011.09-70) 4.6.1
Post by Amin Farmahini
And here is input command to generate the binary
arm-none-linux-gnueabi-gcc -march=armv7-a
-mthumb -mfpu=vfpv3 -mfloat-abi=softfp -static util/m5/m5op_arm.S
-Iutil/m5 hello.c -o hello -Wall
Post by Amin Farmahini
and here is input command to
generate the binary without thumb instruction:
arm-none-linux-gnueabi-gcc -march=armv7-a -mno-thumb -mfpu=vfpv3
-mfloat-abi=softfp -static util/m5/m5op_arm.S -Iutil/m5 hello.c -o hello
-Wall
Post by Amin Farmahini
Let me know if you need more information. I am new to Gem5,
so it is possible that I am doing something wrong.
Post by Amin Farmahini
Thanks,
Amin
Post by Amin Farmahini
Post by Ali Saidi
Hi Amin,
Are you using gem5 stable or
development? There was a bug that might explain this that was fixed
about 5 weeks ago in the development repository.
Post by Amin Farmahini
Post by Ali Saidi
Thanks,
Ali
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Hi Amin,
I'd really like to know what is going on. It all should work. What
version of gcc are you using?
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Thanks,
Ali
On Apr 29,
Post by Amin Farmahini
Ali and Gabe,
Thanks for your responses. I found out that disabling thumb
instructions in gcc (-mno-thumb) fixes this problem. I'll try to dig
into this more tomorrow.
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Ali,
As you mentioned,
adding that flag did not help much. I got the panic message of "Page
table fault when accessing virtual address."
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
On Sat, Apr 28, 2012 at 5:14 PM, Gabe Black
Post by Gabe Black
I'd guess it isn't the
printf itself that changes things, it's probably that that changes the
size of the function, stack frame, etc., and makes the compiler generate
different code or use different syscalls or underlying functions. It
could also be it changes how/when stdio is buffered.
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Gabe
Post by Ali Saidi
The
error message is printed with hex and the flags are listed with octal,
so they're not the same. It's complaining about NOATIME which as it
turns out is not in flag translation table in:
src/arch/arm/linux/linux.cc
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You can certainly try to add it,
however I'm skeptical that it's going to fix your problem, but maybe it
will.
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You're going to need to use the debug flags (particularly
Exec) to figure out what the CPU is doing differently with the addition
of the single printf. It shouldn't change anything, but clearly it is.
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Ali
On Apr 27, 2012, at 10:38 PM, Amin Farmahini
Post by Amin Farmahini
Hi,
I have written a very
simple hello world program to run on ARM SE. However, the simulator
prints a warning, and the simulation never finishes (Gem5 keeps ticking,
but no progress. So I have to manually stop it). Here is the
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
#include
#include
"m5op.h"
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
int main() {
printf("Hello Worldn");
m5_reset_stats(0,0);
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
printf("Hello Worldn");
printf("Hello Worldn");
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
printf("Hello Worldn"); //IF I COMMENT
THIS OUT, THEN IT WORKS FINE
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
}
And here is the
command line: build/ARM/gem5.opt configs/example/se.py
-c hello
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Global frequency set at 1000000000000 ticks per
second
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
0: system.remote_gdb.listener: listening for remote gdb
#0 on port 7000
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
**** REAL SIMULATION ****
info: Entering
Hello World
warn: instruction 'cdp' unimplemented
CANNOT DECODE FLAGS 0X40000
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
^Chack: be nice to actually delete
the event here
received
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
I took a look at arm/linux.linux.hh and it
seems like flag 0X40000 corresponds to TGT_O_DIRECT. FYI, hostflags are
set to 0x23000 (defined in syscall_emul.hh).
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
The weird
thing is that if I comment out the last printf("Hello Worldn"); then the
whole simulation works just fine.
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Any thoughts what
the problem might be?
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [2]
_______________________________________________ gem5-users mailing list
gem5-***@gem5.org [3]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [4]
_______________________________________________
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [6]
_______________________________________________
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [9]
_______________________________________________
Post by Amin Farmahini
Post by Ali Saidi
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [11]




Links:
------
[1] mailto:gem5-***@gem5.org
[2]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[3]
mailto:gem5-***@gem5.org
[4]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[5]
mailto:gem5-***@gem5.org
[6]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[7]
mailto:***@eecs.umich.edu
[8] mailto:gem5-***@gem5.org
[9]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[10]
mailto:gem5-***@gem5.org
[11]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[12]
mailto:***@umich.edu
Ali Saidi
2012-04-30 21:52:29 UTC
Permalink
If you want to do this you can apply the following patch:

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;
Post by Ali Saidi
Hi Amin,
The issue is that you're compiling m5op_arm.S as thumb code. It would
need some work for that to end up creating the right thing since we
encode the instructions with .longs.
Post by Ali Saidi
Ali
On 30.04.2012
Post by Amin Farmahini
Hi Ali,
I am using the
development copy.
../Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc
--version
Post by Ali Saidi
Post by Amin Farmahini
arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite
2011.09-70) 4.6.1
Post by Ali Saidi
Post by Amin Farmahini
And here is input command to generate the
arm-none-linux-gnueabi-gcc
-march=armv7-a -mthumb -mfpu=vfpv3 -mfloat-abi=softfp -static
util/m5/m5op_arm.S -Iutil/m5 hello.c -o hello -Wall
Post by Ali Saidi
Post by Amin Farmahini
and here is
input command to generate the binary without thumb instruction:
arm-none-linux-gnueabi-gcc -march=armv7-a -mno-thumb -mfpu=vfpv3
-mfloat-abi=softfp -static util/m5/m5op_arm.S -Iutil/m5 hello.c -o hello
-Wall
Post by Ali Saidi
Post by Amin Farmahini
Let me know if you need more information. I am new to Gem5,
so it is possible that I am doing something wrong.
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Hi Amin,
Are you using gem5 stable or
development? There was a bug that might explain this that was fixed
about 5 weeks ago in the development repository.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Thanks,
Ali
Post by Ali Saidi
Hi
Amin,
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
I'd really like to know what is going on. It all should
work. What version of gcc are you using?
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Thanks,
Ali
Ali and Gabe,
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Thanks for your responses. I found out that
disabling thumb instructions in gcc (-mno-thumb) fixes this problem.
I'll try to dig into this more tomorrow.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Ali,
As you mentioned, adding that flag did not help much. I got the panic
message of "Page table fault when accessing virtual address."
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
On Sat, Apr 28, 2012 at 5:14 PM,
Post by Gabe Black
I'd guess
it isn't the printf itself that changes things, it's probably that that
changes the size of the function, stack frame, etc., and makes the
compiler generate different code or use different syscalls or underlying
functions. It could also be it changes how/when stdio is
buffered.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Gabe
On 04/28/12 08:03, Ali
Post by Ali Saidi
The error message is printed with hex and
the flags are listed with octal, so they're not the same. It's
complaining about NOATIME which as it turns out is not in flag
translation table in: src/arch/arm/linux/linux.cc
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You can
certainly try to add it, however I'm skeptical that it's going to fix
your problem, but maybe it will.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
You're going to need to use
the debug flags (particularly Exec) to figure out what the CPU is doing
differently with the addition of the single printf. It shouldn't change
anything, but clearly it is.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Ali
On Apr 27,
Post by Amin Farmahini
Hi,
I have written a very simple hello world program to run on ARM
SE. However, the simulator prints a warning, and the simulation never
finishes (Gem5 keeps ticking, but no progress. So I have to manually
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
#include
#include "m5op.h"
int main() {
printf("Hello
Worldn");
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
m5_reset_stats(0,0);
printf("Hello
Worldn");
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
printf("Hello Worldn");
printf("Hello
Worldn"); //IF I COMMENT THIS OUT, THEN IT WORKS FINE
}
build/ARM/gem5.opt configs/example/se.py -c hello
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Global
frequency set at 1000000000000 ticks per second
system.remote_gdb.listener: listening for remote gdb #0 on port
7000
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
**** REAL SIMULATION ****
info: Entering event
Hello World
instruction 'cdp' unimplemented
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
warn: Syscall: OPEN: CANNOT
DECODE FLAGS 0X40000
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
^Chack: be nice to actually delete the
event here
received
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
I took a look at arm/linux.linux.hh and it
seems like flag 0X40000 corresponds to TGT_O_DIRECT. FYI, hostflags are
set to 0x23000 (defined in syscall_emul.hh).
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
The
weird thing is that if I comment out the last printf("Hello Worldn");
then the whole simulation works just fine.
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Any
thoughts what the problem might be?
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
Thanks,
Amin
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
Post by Amin Farmahini
gem5-users
mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [2]
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
Post by Ali Saidi
_______________________________________________ gem5-users
mailing list gem5-***@gem5.org [3]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [4]
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
Post by Gabe Black
gem5-users
mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [6]
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
Post by Ali Saidi
Post by Amin Farmahini
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [9]
_______________________________________________
Post by Ali Saidi
Post by Amin Farmahini
Post by Ali Saidi
gem5-users mailing
list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users [11]




Links:
------
[1] mailto:gem5-***@gem5.org
[2]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[3]
mailto:gem5-***@gem5.org
[4]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[5]
mailto:gem5-***@gem5.org
[6]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[7]
mailto:***@eecs.umich.edu
[8] mailto:gem5-***@gem5.org
[9]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[10]
mailto:gem5-***@gem5.org
[11]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[12]
mailto:***@umich.edu
Amin Farmahini
2012-04-30 23:31:27 UTC
Permalink
Thanks Ali. It worked fine with the new patch.

Thanks,
Amin
Post by Ali Saidi
+#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
Loading...