This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Random segfaults on REP instructions / i486sx ?


>>>>> "VL" == Vincent Leclaire <vleclaire@awox.com> writes:

    VL> Hi,
    VL> I'm developing an application that is tested on an i386 target
    VL> (namely, Compaq Prolinea 4/25, 486sx/25Mhz). I've set up all
    VL> the debugging stuff, serial line, Insight, and so on.

    VL> RedBoot does not cause any problems. The system segfaults
    VL> randomly at various places (before kernel initialization, in
    VL> kernel code, in app code...). The fault always occur on some
    VL> REPx assembly instruction, even with "valid" parameters... the
    VL> funniest one is the instruction that is just before eCos
    VL> initialization at the very beginning of the image loaded, so
    VL> this is not app code :-).

    VL> I could even reproduce the issue with "scratch" startup, ie
    VL> target hard-reset and Insight relaunched. Note that it
    VL> "sometimes" work.

    VL> Nothing found on the Net even if I noticed some segfault
    VL> reports on REP instructions but not in such a context. Sidely,
    VL> Insight seems to miss breakpoints randomly too; they work when
    VL> using some combination of Next-Continue but sometimes not when
    VL> using Continue only.

    VL> (gcc 3.2.1 for target from binary images on eCos website;
    VL> Insight 5.3 also but recompiled from sources; eCos 2.0,
    VL> i386-all. Dev station: Linux Redhat 9.0 on P4, native gcc
    VL> 3.2.2)

    VL> Any clues ? thanks in advance

One possibility is that the flags register is getting messed up
somehow. If the direction flag is set incorrectly then repeat-move
instructions will decrement the index register instead of incrementing
it, causing strange memory corruption. IIRC the direction flag should
normally be clear. Some single step operations will also manipulate
the flags register, specifically setting the trap bit. However I do
not know what could cause the flags register to get messed up.

How are you booting the PC - floppy, grub, other? I see that the
floppy version of hal_cpu_init has an explicit cld instruction to
clear the direction flag, but the alternative implementation for
grub/ROM does not have this.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]