Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#14 Linux: segmentation fault

open
nobody
None
5
2006-09-11
2006-09-11
m.hilpert
No

When I try to start ffff it crashes with a
segmentation fault:

-------------------------------------------------
> ./ffff
FFFF v3.2.3
(C)1994-2006 Daniele Paccaloni
(daniele.paccaloni@dylogic.com)
Initalizing...
Number of CPUs: 2
SMP support available, creating 1 slave threads.
SSE instructions supported. Switching to SSE
quadpoints computation.
SSE2 instructions supported.
3DNow! instructions NOT available.
Thread 1 says: "I'm a slave, I'm alive."
OpenGL v1.2 (2.0.2 NVIDIA 87.62)
Renderer: GeForce 7600 GS/PCI/SSE2
Vendor: NVIDIA Corporation

Keys:
1: Lame FPU computation, C code.
2: Fast FPU computation, 100% machine code.
3: Quadfast SSE computation, 100% machine code.
4: Dualfast SSE2 computation, 100% machine code.
5: Dualfast 3DNow computation, 100% machine code.
9: Experimental GPU Fragment Program computation
(OpenGL 1.3 ARB only)!
0: Experimental GPU Vertex Program computation
(nVidia or ATI cards only)!
d: Toggle double/single buffer (may not work on some
cards).
+,-: Inc/Dec max iters (press shift for +/-20).
/,*: Rotate palette (press 'd' if this does not work).
h: Shows this help.
o: Draw orbits (single buffered mode only).
r: Reset zoom position.
b: Speed benchmark in current mode (resets max iters
to 40).
See result in the console.
Segmentation fault
--------------------------------------------

?

Discussion

  • Eagle666
    Eagle666
    2007-01-28

    Logged In: YES
    user_id=1703865
    Originator: NO

    Hello,

    i've found that some modified cpu register are not marked as 'clobbered' in checkSSE() and checkSSE2()

    before
    : /* clobbered */ "%eax", "%edx"

    after
    : /* clobbered */ "%eax", "%edx", "%ebx", "%ecx"

    with these two modified lines, ffff start ok

     
  • The fix is simple. Find the line that says
    bool ssehw = false;
    and change it to
    int ssehw = 0;
    and similarly the lines
    bool sse2hw = false;
    bool b3DNow = false;
    need to use "int" instead. The reason is that GCC implements C++'s "bool" type as a 1-byte type, not a 4-byte type; thus the assembly line "movl $1, %0" writes four bytes into a 1-byte stack location, trashing the saved value of %ebp; and then the final "leave" instruction (generated by GCC) fetches garbage into %ebp instead of restoring its old value.