flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > lock prefix freedom

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 23 Jun 2011, 13:47
I can do anything i want with lock prefix.
Code:
lock mul bx    

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 23 Jun 2011, 13:47
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 23 Jun 2011, 14:56

#UD Invalid Opcode Exception

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 23 Jun 2011, 14:56
View user's profile Send private message Send e-mail Reply with quote
JoeCoder1



Joined: 13 Jun 2011
Posts: 62
JoeCoder1 23 Jun 2011, 17:10
haha isn't lock interpreted as a label there Wink
Post 23 Jun 2011, 17:10
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 24 Jun 2011, 00:58
No, its a prefix, like rep is also a prefix
Code:
repe stos byte[edi]    

A lock label would be like
Code:
_lock: lock mul bx    


Now the real question is:
Should FASM be allowed to generate invalid opcodes?
Post 24 Jun 2011, 00:58
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 28 Jun 2011, 03:49
bitshifter wrote:
Should FASM be allowed to generate invalid opcodes?
The LOCK prefix only has restricted usage on a subset of CPUs (i.e. the later ones), so actually your question is more like this: Should fasm disallow opcode combinations that are perfectly valid on older CPUs but now cause a fault on newer CPUs? I think the answer is obvious: NO.

I even have some old 80286 boards that used the hardware lock signal for some special purposes other than locking memory accesses. Subsequently the code had some lock's in places that looked very weird until one realised that it was simply raising an external signal and not controlling any memory functionality.
Post 28 Jun 2011, 03:49
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Jun 2011, 06:07
Code:
cs gs lock repe mul bx
    

Sometimes it just HAS to make sense Smile

Its an oldie, but I couldn't resist Razz
Code:
who | grep -i blonde | talk ; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep
    


Last edited by Madis731 on 28 Jun 2011, 06:16; edited 1 time in total
Post 28 Jun 2011, 06:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 28 Jun 2011, 06:11
Madis731: Also ...
Code:
gs fs es ss cs ds lock rep lea eax,ebx    
Razz

https://board.flatassembler.net/~flatasse/subdomains/board/topic.php?p=65787#65787
Post 28 Jun 2011, 06:11
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.