s53e
Posts: 1
Joined: Mon Jan 21, 2013 6:53 pm

RDTSC on ARM

Wed Jan 23, 2013 11:55 am

Hello everyone,

I'm trying to install netbee[1] but when I'm doing 'make'. It stopped at profiling-function.c. I've commenting out like this thread[2], and try to change rdtsc to gettimeofday() but no result. RDTSC is required by another code (/path/to/src/nbnetvm/arch/generic/generic_interpreter.c), so when I changed to gettimeofday(), the error said:

Code: Select all

/home/pi/nbeesrc/nbeesrc-jan-10-2013/src/nbnetvm/arch/generic/generic_interpreter.c: In function 'genRT_Execute_Handlers':
/home/pi/nbeesrc/nbeesrc-jan-10-2013/src/nbnetvm/arch/generic/generic_interpreter.c:2757:5: error: unknown register name 'edi' in 'asm'
/home/pi/nbeesrc/nbeesrc-jan-10-2013/src/nbnetvm/arch/generic/generic_interpreter.c:2757:5: error: unknown register name 'eax' in 'asm'
/home/pi/nbeesrc/nbeesrc-jan-10-2013/src/nbnetvm/arch/generic/generic_interpreter.c:2757:5: error: unknown register name 'ecx' in 'asm'
What I'm trying to say is, this man is noob. Don't understand C/C++, low-level language, ARM architecture, etc. The only thing I know, -cmiiw-, the problem start at RDTSC. I have to find RDTSC equivalent in ARM (Cycle Count?), re-edit some pieces of code, and make sure nothing horrible happen.

Let me know if you have a good solution/suggestion.

Cheers,
-s53e-

links:
[1] http://www.nbee.org/download/nbeesrc-jan-10-2013.php
[2] http://www.raspberrypi.org/phpBB3/viewt ... sc#p179745

User avatar
diereinegier
Posts: 183
Joined: Sun Dec 30, 2012 5:45 pm
Location: Bonn, Germany

Re: RDTSC on ARM

Thu Jan 24, 2013 2:29 pm

It seems that this project contains assembler code for only Intel x86 CPUs or so it seems to me.

In readme-compile.txt is stated that the code was compiled under Windows, Ubuntu, Mac OS and FreeBSD but all on x86 processors.

You will not be able to port it to another processor I am afraid.
Clone or fork my repositories at https://github.com/GeorgBisseling

mazizi
Posts: 1
Joined: Sat Oct 11, 2014 5:08 pm

Re: RDTSC on ARM

Sat Oct 11, 2014 5:10 pm

Hello Everyone,
did someone succeeded to install netbee on RPi ?

IanS
Posts: 297
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England

Re: RDTSC on ARM

Wed Dec 21, 2016 3:38 pm

This is rather a late reply, but I came across this post when making my own attempt to get Netbee onto a RPi. I am posting this here now in case anybody else follows the same route.

There are a number of issues to solve.

Issue 1. The use of x86 assembly code.
The FFTW project has a whole bunch of equivalents to rdtsc as part of its own profiling code. See https://github.com/vesperix/FFTW-for-AR ... el/cycle.h
Replace the errant lines in nbeesrc-jan-10-2013/src/nbee/globals/profiling-functions.c (lines 49-50) with

Code: Select all

volatile unsigned cc;
static int init = 0;
if(!init) {
  __asm__ __volatile__ ("mcr p15, 0, %0, c9, c12, 2" :: "r"(1<<31)); /* stop the cc */
  __asm__ __volatile__ ("mcr p15, 0, %0, c9, c12, 0" :: "r"(5));     /* initialize */
  __asm__ __volatile__ ("mcr p15, 0, %0, c9, c12, 1" :: "r"(1<<31)); /* start the cc */
  init = 1;
}
__asm__ __volatile__ ("mrc p15, 0, %0, c9, c13, 0" : "=r"(cc));
return cc;
Issue 2. Incompatible version of bison. Version 2.5 is required instead of 3.x
wget -nc http://mirrordirector.raspbian.org/rasp ... _armhf.deb
wget -nc http://mirrordirector.raspbian.org/rasp ... _armhf.deb
sudo dpkg -i bison_2.5.dfsg-2.1_armhf.deb libbison-dev_2.5.dfsg-2.1_armhf.deb
Issue 3. More asm, this time in nbeesrc-jan-10-2013/src/nbnetvm/rt_environment.h
Get rid of the whole #ifdef block for different definitions of MMSET (lines 230-257), except for the non-asm version.
i.e. Keep

Code: Select all

#define MMSET(ptr,zero,length) { int mmsetCounter=0; \
   for(; mmsetCounter < length; mmsetCounter++) ptr[mmsetCounter] = zero; \
}
This now compiles cleanly at least. Not sure if it works properly yet as I am using this as a dependency of something else and more testing is required.

Return to “C/C++”