accedently hit Post... ignore the previous mail. nice trick by the way.

--
cinap
--- Begin Message ---


This one sounds like to work (except it does not save registers) ...

defn call(addr)
{
        local pco;

        // we need stack space, and thus process stopped.
        if status(pid) != "Stopped" then {
                print("Waiting...\n");
                stop(pid);
        }

        // Backup orginal instruction
        pco = fmt(*PC, bpfmt);

        // Put a temporary breakpoint
        **PC = bpinst;
        
        // update stack pointer
        *SP = *SP - 4;

        // make called function returning to this point
        **SP = *PC;

        // set PC to function to call
        *PC = addr;

        // do the call
        startstop(pid);

        // restore original instruction
        *PC = pco;
}

Phil;

--- End Message ---

Reply via email to