Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section 1.3.1 #66

Open
dibyendumajumdar opened this issue Apr 24, 2018 · 2 comments
Open

Section 1.3.1 #66

dibyendumajumdar opened this issue Apr 24, 2018 · 2 comments

Comments

@dibyendumajumdar
Copy link

Hi,

The book says 'The writes into 32-bit parts, however, fill the upper 32 bits of the full register with sign bits. For example, zeroing eax will zero the entire rax, storing -1 into eax will fill the upper 32 bits with ones.'.

However Intel manual says in section 3.4.1.1:

32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register

I checked this in Visual Studio using a simple program:

.code
SomeFunction proc
	mov eax, -1
	ret
SomeFunction endp
end

The RAX register was zero extended as described in Intel manual.

Is this an error in the book?

Thanks and Regards
Dibyendu

@sayon
Copy link
Collaborator

sayon commented May 6, 2018

Hello,
it is indeed an error. A similar error for another section is already present in errata, but not this specific one.
I will add it to the errata.

Thank you very much for reporting and helping to get rid of errors for a better experience!

@ghost
Copy link

ghost commented Aug 12, 2018

An experiment in my x64 computer.

mov rax,0
   mov al,+1	rax = 0000000000000001
   mov ah,+1	rax = 0000000000000100
   mov ax,+1	rax = 0000000000000001
   mov eax,+1	rax = 0000000000000001
   mov rax,+1	rax = 0000000000000001

mov rax,0
   mov al,-1	rax = 00000000000000FF
   mov ah,-1	rax = 000000000000FF00
   mov ax,-1	rax = 000000000000FFFF
   mov eax,-1	rax = 00000000FFFFFFFF
   mov rax,-1	rax = FFFFFFFFFFFFFFFF

mov rax,-1
   mov al,+1	rax = FFFFFFFFFFFFFF01
   mov ah,+1	rax = FFFFFFFFFFFF01FF
   mov ax,+1	rax = FFFFFFFFFFFF0001
   mov eax,+1	rax = 0000000000000001
   mov rax,+1	rax = 0000000000000001

mov rax,-1
   mov al,-1	rax = FFFFFFFFFFFFFFFF
   mov ah,-1	rax = FFFFFFFFFFFFFFFF
   mov ax,-1	rax = FFFFFFFFFFFFFFFF
   mov eax,-1	rax = 00000000FFFFFFFF
   mov rax,-1	rax = FFFFFFFFFFFFFFFF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants