LEA instruction not working as expected

Discussion in 'Programmer's Corner' started by alank2, May 3, 2014.

  1. alank2

    Thread Starter Member

    Jul 14, 2009
    26
    0
    Hi Everyone,

    I'm debugging some code and am having a problem with the way the lea instruction executes like this:

    lea edi,[esi+10h]

    What happens is that esi is a valid location in the 0x02000000 range and sometimes this instruction assigns edi --> 0x02000010, but sometimes it comes back with a totally different value such as 0x00000011.

    Can anyone explain what other factors go into this calculation beyond esi and a static 10h? When it works and when it fails the segment registers seem the same...

    Thanks,

    Alan
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Which cpu are we talking about?
     
  3. alank2

    Thread Starter Member

    Jul 14, 2009
    26
    0
    Sorry, intel 32 bit.
     
Loading...