Re: Nokia n900 and Euphoria
- Posted by SDPringle May 25, 2011
- 5199 views
Inside the 4.0.2 distributed version of EUPHORIA's configure script there are these lines:
if echo "$UNAME_MACHINE" | grep "i[1-7]86" > /dev/null; then echo ARCH=ix86 >> "$PREFIX"${CONFIG_FILE} elif echo "$UNAME_MACHINE" | grep "x86_64" > /dev/null; then echo ARCH=ix86 >> "$PREFIX"${CONFIG_FILE} elif echo "$UNAME_MACHINE" | grep ARM > /dev/null; then echo ARCH=ARM >> "$PREFIX"${CONFIG_FILE} fi
Now, this is from a call to uname. The intention was that you call configure and it detects what kind of CPU you have. Now, it does make sense to override, ARCH. So, you can add a case in the switch statement simliar to the one for plat. Copying the case for plat and changing --plat for --arch, and PLAT for ARCH you'll get:
--arch*) VAL=`echo $1 | cut -d = -f 2` if [ "$VAL" = "$1" ]; then shift ; VAL=$1 fi echo "ARCH=$VAL" >> "$PREFIX"${CONFIG_FILE} ;;
Now you'll need to use --arch ARM or run configure with out arguments on an ARM processor (under emulation). The --arch argument and the value of ARCH should take either ix86 or ARM.
Looking in be_callc.c we see an example of ARCH use.
#if ARCH == ix86 #define push() asm("movl %0,%%ecx; pushl (%%ecx);" : /* no out */ : "r"(last_offset) : "%ecx" ) #define pop() asm( "movl %0,%%ecx; addl (%%ecx),%%esp;" : /* no out */ : "r"(as_offset) : "%ecx" ) #endif
So the idea is to use
#if ARCH == ARM // ARM code #endif #if ARCH == ix86 // Intel x86 code #endif
Shawn