Wednesday, December 28, 2005

X86_64 Assembly Nightmare

A few days ago I was trying to compile mpg123 application. It is a command-line MP3 player. I begin with command:

make help

It gave some options. First I tried "make linux", still failed to compile with a bunch of errors. I then tried "make linux-3dnow", or "make linux-3dnow-alsa". All of them failed to compile at some assembly files (*.s). I look at one of the assembly-code files, and saw that the codes were designed for 32bit platform, while my laptop was running x86_64 Suse v10.0 (64-bit Linux). I did change "pushl %ebp" etc. to "push %rbp" etc., the compiled went OK, but when I tried to run the program, it crashed with segmentation fault message.

Hmm...I then went to AMD website and download all the documentation. These PDF documents are huge (each PDF file has more than 300 pages). I started reading one of them. Will post any progress later.

Stay tuned!

64-Bit Power Struggle Heats Up

AMD still is the winner, at least for now.

http://www.eweek.com/print_article2/0,1217,a=167278,00.asp

Sunday, December 18, 2005

Fixes on FFTW for 64bit

I just downloaded FFTW library from http://www.fftw.org and tried to compile it with full optimizations and 64bit-enable flag. Many files were compiled OK, but when GCC tried to compile sse2.c, it failed with complaints:

Error: suffix or operands invalid for `push'
Error: suffix or operands invalid for `pop'
When I digged into the code I saw that it was using 32bit register ebx. I then changed it to rbx (64bit version of BX) and recompile it, it works.

Still need to test it rigorously whether the would inadvertent effect with all the optimizations. By the way, here is my optimization flags to GCC compiler:

CFLAGS="-mtune=athlon64 -msse2 -mfpmath=sse -ffast-math -m64 -O3"

I am in 64bit Now!

A few days ago, I did installed SUSE ver 10.0 64-bit edition to my Compaq Presario R3000z laptop. After backing up all the data to my new SEAGATE external hard drive (its 200 GB, so has plenty of space), I resized the Linux (reiserfs) partition from 15 GB to 25 GB, plus I added an extra 5 GB FAT32 partition to share files between Linux and Windows XP (in case I use Windows :-).

The standard SUSE does not came with NVIDIA's binary-only enhanced driver, so the graphic was standard. I then downloaded the 64bit driver from nvidia.com, but had problem installing it. Somehow downloading the 64bit driver from YaST worked out. I don't know what was the problem, but anyway it work OK so I could change the resolution to 1680x1050 and the graphic was fine.

Another problem was the wireless device. Linux 64bit does not like 32bit driver, so the old Broadcom driver for WinXP did not work. After googling up, I found the driver for Win 64bit (somebody posted it at www.planetamd64.com. You must register to the site to be able to download it, but it is free registration). Yet, the ndiswrapper still could not load the driver. From dmesg result, I saw there was one error saying "ntoskernel.exe: RtlZeroMemory" was an undefined function. Hm...

One problem was that the *.conf under /etc/ndiswrapper/bcmwl5 had different devid. I checked again using lspci -n showed a different devid. I just created a symbolic link to the existing conf file, but the link file name is now has the correct devid. Still ndiswrapper failed to load the driver. Oh yeah, I forgot to mention that I always set the environment variable CFLAGS="-mtune=athlon64 -msse2 -mfpmath=sse -ffast-math -m64", as well as CPPFLAGS.

I googled again, and found one posted message with the same problem. The guy later on said that he then upgraded the ndiswrapper to the latest one and it worked. I then gave it a shot. You know what? It was working!

The next tasks for me is to recompile xine (the one that comes in SUSE Linux does not support reading DCSS-encryption to read commercial DVD movies), also I need to recompile some others to the 64-bit.

Thanks to Google, I had successfuly make my laptop wireless work! I am getting more in love into Linux now. I rarely boot my laptop to Windows anymore. Only when I need to run "Age of Empir