I wrote a small program to test pthreads using the m5threads library on an ARM O3CPU using syscall emulation. However, when running the program, an assertion error is encountered which prevents it from executing.
Source code of the program (threads.c): ```c #include <stdio.h> #include <pthread.h> void *doWork(void *arg) { printf("do work\n"); } int main(int argc, char **argv) { pthread_t thread; int error = pthread_create(&thread, NULL, doWork, NULL); if (error == 0) { pthread_join(thread, NULL); } else { printf("pthread_create error %d\n",error); } return 0; } ``` Makefile used to compile it ```Makefile CCLOC= /arm-gem5-linux-gnueabi/bin/ CC = $(CCLOC)arm-gem5-linux-gnueabi-gcc CPP = $(CCLOC)arm-gem5-linux-gnueabi-g++ OPTS = -g -O3 -march=armv7-a -marm all: threads.arm threads.arm: threads.o pthread.o $(CPP) $(OPTS) -static -o threads.arm threads.o pthread.o clean: -rm *.o *.arm threads.o: threads.c $(CC) $(OPTS) -std=gnu99 -c threads.c pthread.o: $(CC) $(OPTS) -c m5threads/pthread.c -o pthread.o ``` Command and output: ``` $build/ARM/gem5.opt configs/example/se.py --num-cpus 2 --cpu-type O3CPU --caches -c thread-test/threads.arm build/ARM/base/statistics.hh:277: warn: One of the stats is a legacy stat. Legacy stat is a stat that does not belong to any statistics::Group. Legacy stat is deprecated. gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 version 21.1.0.0 gem5 compiled Aug 12 2021 21:55:38 gem5 started Aug 15 2021 22:39:29 gem5 executing on uc14, pid 2265762 command line: build/ARM/gem5.opt configs/example/se.py --num-cpus 2 --cpu-type O3CPU --caches -c thread-test/threads.arm warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` warn: membus.slave is deprecated. `slave` is now called `cpu_side_ports` Global frequency set at 1000000000000 ticks per second warn: No dot file generated. Please install pydot to generate the dot file and pdf. build/ARM/mem/mem_interface.cc:791: warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes) 0: system.remote_gdb: listening for remote gdb on port 7000 **** REAL SIMULATION **** build/ARM/sim/simulate.cc:107: info: Entering event queue @ 0. Starting simulation... build/ARM/arch/arm/regs/misc.cc:334: warn: CP14 unimplemented crn[14], opc1[7], crm[15], opc2[7] build/ARM/sim/power_state.cc:105: warn: PowerState: Already in the requested power state, request ignored build/ARM/arch/arm/isa.hh:658: warn: User mode does not have SPSR build/ARM/arch/arm/isa.hh:658: warn: User mode does not have SPSR gem5.opt: build/ARM/cpu/o3/rename_map.hh:280: gem5::PhysRegId* gem5::o3::UnifiedRenameMap::lookup(const gem5::RegId&) const: Assertion `vecMode == enums::Elem' failed. Program aborted at tick 10204500 --- BEGIN LIBC BACKTRACE --- build/ARM/gem5.opt(+0x55ef70)[0x55b186d5ef70] build/ARM/gem5.opt(+0x59807e)[0x55b186d9807e] /lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fcba3b9a3c0] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fcba313d18b] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fcba311c859] /lib/x86_64-linux-gnu/libc.so.6(+0x25729)[0x7fcba311c729] /lib/x86_64-linux-gnu/libc.so.6(+0x36f36)[0x7fcba312df36] build/ARM/gem5.opt(+0x80cc71)[0x55b18700cc71] build/ARM/gem5.opt(+0x7fcf5a)[0x55b186ffcf5a] build/ARM/gem5.opt(+0x8a82eb)[0x55b1870a82eb] build/ARM/gem5.opt(+0xbd4c98)[0x55b1873d4c98] build/ARM/gem5.opt(+0xc23f92)[0x55b187423f92] build/ARM/gem5.opt(+0xc2442a)[0x55b18742442a] build/ARM/gem5.opt(+0xbe9a84)[0x55b1873e9a84] build/ARM/gem5.opt(+0xbecd7c)[0x55b1873ecd7c] build/ARM/gem5.opt(+0xc30f9d)[0x55b187430f9d] build/ARM/gem5.opt(+0xc3115f)[0x55b18743115f] build/ARM/gem5.opt(+0x6415d7)[0x55b186e415d7] build/ARM/gem5.opt(+0xbe7956)[0x55b1873e7956] build/ARM/gem5.opt(+0xb4cef4)[0x55b18734cef4] build/ARM/gem5.opt(+0x7f031b)[0x55b186ff031b] build/ARM/gem5.opt(+0x7f144e)[0x55b186ff144e] build/ARM/gem5.opt(+0x7f2cd0)[0x55b186ff2cd0] build/ARM/gem5.opt(+0x7f3998)[0x55b186ff3998] build/ARM/gem5.opt(+0x8048d9)[0x55b1870048d9] build/ARM/gem5.opt(+0x573fc6)[0x55b186d73fc6] build/ARM/gem5.opt(+0x5c4304)[0x55b186dc4304] build/ARM/gem5.opt(+0x5c4b52)[0x55b186dc4b52] build/ARM/gem5.opt(+0x1ae0d02)[0x55b1882e0d02] build/ARM/gem5.opt(+0x594461)[0x55b186d94461] /lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x2a8738)[0x7fcba3e50738] /lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x8dd8)[0x7fcba3c25f48] --- END LIBC BACKTRACE --- Aborted ``` Backtrace of the assertion error: https://gist.github.com/Icohedron/3ef39945445095a2f034b0290311071d Operating System: Ubuntu 20.04.2 LTS
_______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s