Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: xor eax,eax does not clear eax???

  1. #21
    Join Date
    May 2006
    Beans
    1,787

    Re: xor eax,eax does not clear eax???

    Quote Originally Posted by worksofcruft View Post
    I suspect your simple program is 'user-level' code only. Whereas the debugger has access to 'system-level' code and therefore has access to hardware (such as the CPU's registers).
    If anything, the program has more direct access to the registers than the debugger. The debugger needs to ask the kernel for what the values of the saved registers in another process are; the program uses them directly. But both are user-level programs.

  2. #22
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    1,876
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: xor eax,eax does not clear eax???

    Quote Originally Posted by worksofcruft View Post
    I suspect your simple program is 'user-level' code only. Whereas the debugger has access to 'system-level' code and therefore has access to hardware (such as the CPU's registers).

    Linux is a 'protected' O.S.
    One of the things a protected O.S. does is not allow code at the user-level to directly access hardware. You would need to write or call system-level code of some sort for your program to get actual access to hardware.

    Of interest to you might be to create a 'list file' the next time you build your program. Then look at how 'eax' is resolved in the listing. I suspect it resolves to an address and NOT an internal CPU register. And that is why your program returns 0xffffffff: Your code is reading an address that is not any type of memory or register, i.e. the data bus has no data on it. 0xffffffff is what an empty data bus returns.
    Hmmm. A debugger is supposed to show us what it says, otherwise there is no point using it?

  3. #23
    Join Date
    May 2006
    Beans
    1,787

    Re: xor eax,eax does not clear eax???

    It would be interested to know what the problem was. das86, did you resolve the issue?

Page 3 of 3 FirstFirst 123

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •