Archive for the ‘Computer Architecture And Organization’ Category

PTLSIM Setup On OpenSuse With G++4.1

September 29, 2009

Lately , i have found my self using ptlsim.

Obviously , the first step to use ptlsim is to install it. Here , i will tell you how to install ptlsim on opensuse with g++4.1and some troubleshooting about the installation and later phases of the usage. I will also keep this document up to date as much as possible.

Installation Steps:

1) Go to http://www.ptlsim.org, download the latest package, what i have downloaded was ptlsim-20090314-r229.

2) After that extract this package.

3) Open a console and change your directory to this ptlsim directory.

4) In the ptlsim directory, open Makefile and edit the line:

– CC = g++-4.3  change this line to CC = g++-4.1

5) then turn back to konsole, and type make

6) you may have several errors like

stubs-32.h not found

Solution:

– Download and install glibc , // zypper install glibc

7) if this error has occured , type “make clean” and when cleaning process is finished , type “make ” again.

8) possibly the ptlsim will be successfully compiled and ready use.

Trouble Shooting:

In the working phase, you may get an error like this:

-/sysdeps/x86_64/cacheinfo.c:197: handle_intel: Assertion `maxidx >= 2′ failed.

Solution:

This is an assertion from glibc running on an Intel CPU. It assumes that the cpuid instruction has minimum level of support, but ptlsim doesn’t provide it.You can either remove the assertion from glibc, or more easily, hack the cpuid instruction in ptlsim such that it claims it has a higher level of support than it provides.

– This can be done by editing the  ptlsim/decode-complex.cpp file

– Search for the  void assist_cpuid(Context& ctx) function

– and edit the case:

   case 0: {
     // Max avail function spec and vendor ID:
    const W32* vendor = (const W32*)&cpuid_vendor;
    // rax = 1; // only one extended function  // Comment this

    // add this
    rax = 2; // only one extended function (but fake more otherwise glibc
             // fails an assertion)
     rbx = vendor[0];
     rdx = vendor[1];
     rcx = vendor[2];

– Finally recompile and use ptlsim. That’s all folks.

Advertisements