I'm investigating whether I can use valgrind to simulate embedded
firmware.

In other words, to build the firmware for linux instead of the embedded
platform, then run it through valgrind plus a layer which intercepts any
reads/writes from peripheral blocks, and forwards them to/from a
simulation model of the hardware.

The firmware has hardwired pointers to peripherals, so I'd like to
detect reads & writes to the hardwired addresses.

I've got my own skeleton tool running, but don't know if I can get hold
of the untranslated guest data pointers from within the tool. Is it
possible? Something like below...

Best regards,
Andy



static
IRSB* sc_instrument ( VgCallbackClosure* closure,
                      IRSB* sbIn, 
                      VexGuestLayout* layout, 
                      VexGuestExtents* vge,
                      IRType gWordTy, IRType hWordTy )
{
    // preamble

    // for (each IRStmt)
    {
        switch (st->tag) {
            case Ist_WrTmp:
                if (guest_data_pointer in magic_address range)
                {
                    // substitute Stmt with WrConst obtained from
model...
                }
                else
                {
                    addStmtToIRSB( sbOut, st );
                }

            case Ist_Store:
                if (guest_data_pointer in magic_address range)
                {
                    // model.SetValue()
                    // add a no-op to sbOut
                }
                else
                {
                    addStmtToIRSB( sbOut, st );
                }



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to