Endianness inside CPU registers

后端 未结 4 1884
暗喜
暗喜 2020-12-08 05:56

I need help understanding endianness inside CPU registers of x86 processors. I wrote this small assembly program:

section .data
section .bss

section .text
          


        
4条回答
  •  遥遥无期
    2020-12-08 06:24

    In simple words, treat registers as just values, endiannes on how they are finally stored is not important.

    You know that writing on eax you write a 32 bit number, and you know that reading from eax you will read the same 32 bit number. In this terms, endianness doesn't matter.

    Than you know that in "al" you have less significant 8-bit part of the value, in "ah" most significan 8-bit part of the lower 16 bits. There is no way to access single bytes on higher 16bits, except of course reading the whole 32 bit value.

提交回复
热议问题