flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [bug]SWAPGS bug and inconsistent error reporting with 64bit

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 20 Apr 2006, 09:39
Inconsistent error reporting with new 64bit instructions
Code:

use64

;the following should be valid in 64bit mode

swapgs                  ;<-- error: illegal instruction.

use32

;the following two should not be valid outside 64bit mode

syscall                 ;<-- no error!
sysret                  ;<-- no error!

;the following two should generate "illegal instruction"

cmpxchg16b dqword[0]    ;<-- error: invalid size of operand.
movsxd rax,eax          ;<-- error: invalid size of operand.

;these others are okay

cdqe                    ;<-- error: illegal instruction.
cmpsq                   ;<-- error: illegal instruction.
lodsq                   ;<-- error: illegal instruction.
movsq                   ;<-- error: illegal instruction.
stosq                   ;<-- error: illegal instruction.    
Post 20 Apr 2006, 09:39
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 20 Apr 2006, 11:13
Hmm, Intel and AMD cannot agree on the syscall/sysenter/sysexit/sysret validity.

Intel says syscall/sysret are only valid in 64bit modes
Amd says syscall/sysret are valid in all modes

Intel says sysenter/sysexit are valid in all modes
Amd says sysenter/sysexit are only valid in 32bit modes
Post 20 Apr 2006, 11:13
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 20 Apr 2006, 20:18
Fixed what had to be fixed.
Post 20 Apr 2006, 20:18
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 24 Apr 2006, 12:14
Thanks for the fixes, much appreciated. Especially swapgs, I was using "db 15,1,0f8h" to get around the problem.

Do you think it is a good idea to make swapgs invalid in 32 bit code?
Post 24 Apr 2006, 12:14
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.