On Mon, 18 Dec 2000 [EMAIL PROTECTED] wrote:
> I'm not an expert on any of this, but consider the following:
> 
>       jmp foo
>       [...]
>       inst1
> foo:  inst2
>       inst3
> 
> Let's say 'inst1' is a four byte instruction that we wish to emulate,
> so we replace it, along with part of 'inst2', with a five byte 'call
> xyz' instruction -- what happens to the foo branch?

Well, because of the dynamic nature of prescanning, this is no
problem.  There are two cases:

(1) jmp foo is prescanned AFTER the foo: piece has been prescanned
    (i.e. the foo code was executed earlier using a different code
    route)

    --> simple solution, just redirect the jump to the PIC code buffer

(2) jmp foo is prescanned BEFORE the foo: piece has been prescanned

    --> prescan will have to recurse anyway to prescan the foo: piece,
        so we can directly handle all the dependencies

> Note, it wouldn't be possible to scan for all 'jmp foo' instructions
> because the jmp branch offset could be dynamically setup.

If the branch offset is dynamically setup, we need to emulate the branch
anyway, even in the old prescan scheme --- we can't have uncontrolled
branches, or we'd lose control over the code!
 
-- Ramon




Reply via email to