English 中文(简体)
XOR 注册、注册(组)[复制]
原标题:XOR register,register (assembler) [duplicate]

From time to time we have to analyze pieces of assembler code (IA32), and more than often i come across an instruction that looks like this:

xor ax, ax

或与其他登记一样:xor dx, dx,xor al, al.

这究竟是什么? (轴心总能为0)

最佳回答

注册号为0。

<代码>xor ax, ax对应于ax = ax ^ ax,正如你已经注意到的那样,该编码有效ax = 0

如果我正确回顾一下,其主要优势是,其编码规模小于mov ax, 0

问题回答

That is exactly what it does -- zero the contents of a register

如先前的评论所述,x %轴心为x = xx ax。 这基本上为零。 此外,它还影响到/修改一些ESF,如F、CF、SF、PF或ZF。 在此情况下,将确定PF和ZF的旗帜。

SF - 说明最后一项行动的结果是否产生了价值,其最高范围为1。

PF - 如果设定的借项数为奇数,甚至在最后一项业务结果的双位代表中注明。

ZF - 如果数学/科学操作的结果是零,或者以其他方式重新分类,则予以确定。

下文使用亚洲开发银行的幻灯。

学历:%

在“xor”之前

(gdb) info registers
eax            0xaa55   43605
ecx            0x0  0
edx            0x80 128
ebx            0x0  0
esp            0x6f20   0x6f20
ebp            0x0  0x0
esi            0x0  0
edi            0x0  0
eip            0x7c02   0x7c02
eflags         0x2  [ ]
cs             0x0  0
ss             0x0  0
ds             0x0  0
es             0x0  0
fs             0x0  0
gs             0x0  0

“xor”之后

(gdb) info registers
eax            0x0  0          --------------------> AX = 0          
ecx            0x0  0
edx            0x80 128
ebx            0x0  0
esp            0x6f20   0x6f20
ebp            0x0  0x0
esi            0x0  0
edi            0x0  0
eip            0x7c04   0x7c04
eflags         0x46 [ PF ZF ] --------------------> Flags Set
cs             0x0  0
ss             0x0  0
ds             0x0  0
es             0x0  0
fs             0x0  0
gs             0x0  0




相关问题
How can I do a CPU cache flush in x86 Windows?

I am interested in forcing a CPU cache flush in Windows (for benchmarking reasons, I want to emulate starting with no data in CPU cache), preferably a basic C implementation or Win32 call. Is there a ...

What are the names of the new X86_64 processors registers?

Where can I find the names of the new registers for assembly on this architecture? I am referring to registers in X86 like EAX, ESP, EBX, etc. But I d like them in 64bit. I don t think they are the ...

How do I disassemble raw 16-bit x86 machine code?

I d like to disassemble the MBR (first 512 bytes) of a bootable x86 disk that I have. I have copied the MBR to a file using dd if=/dev/my-device of=mbr bs=512 count=1 Any suggestions for a Linux ...

32bit application access to 64bit registry

I have an OS Shell written in 32bit that is replacing the Explorer.exe of a Vista machine. I run a utility which is also written in 32bit, which allows to switch between the Explorer shell and My ...

Left Shift Overflow on 68k/x86?

I heard that the Motorola 68000 and Intel x86 architectures handle overflow from left shifting differently. Specifically the 68k LSL vs. the Intel SAL/SHL assembly instructions. Does anyone know the ...

Translate a FOR to assembler

I need to translate what is commented within the method, to assembler. I have a roughly idea, but can t. Anyone can help me please? Is for an Intel x32 architecture: int secuencia ( int n, ...

热门标签