Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >LOCK Prefix (lock) Intel X86 IA-32 Assembly Language Reference Manual

LOCK Prefix (lock) Intel X86 IA-32 Assembly Language Reference Manual

作者头像
战神伽罗
发布于 2019-08-09 07:38:33
发布于 2019-08-09 07:38:33
90800
代码可运行
举报
运行总次数:0
代码可运行

LOCK Prefix (lock)

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
lock

Operation

LOCK# -> NEXT Instruction

Description

The LOCK # signal is asserted during execution of the instruction following the lock prefix. This signal can be used in a multiprocessor system to ensure exclusive use of shared memory while LOCK # is asserted. The bts instruction is the read-modify-write sequence used to implement test-and-run.

The lock prefix works only with the instructions listed here. If a lock prefix is used with any other instructions, an undefined opcode trap is generated.

bt, bts, btr, btc

m, r/imm

xchg

r, m

xchg

m, r

add, or, adc, sbb, and, sub, xor

m, r/imm

not, neg, inc, dec

m

Memory field alignment does not affect the integrity of lock.

If a different 80386 processor is concurrently executing an instruction that has a characteristic listed here, locked access is not guaranteed. The previous instruction:

  • Does not follow a lock prefix
  • Is not on the previous list of acceptable instructions
  • A memory operand specified has a partial overlap with the destination operand.

Example

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
lock
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
About Cache Coherence, Atomic Operation, Memory Ordering, Memory Barrier, Volatile
该文章介绍了CPU缓存以及多线程程序中CPU缓存一致性的问题,并给出了具体的例子和解决方案。文章指出,多线程程序中的CPU缓存不一致问题可能会导致性能下降,因此需要谨慎处理。通过使用原子操作、锁操作等技术,可以避免CPU缓存不一致问题,从而提高程序的性能。
s1mba
2017/12/28
1.8K0
 About Cache Coherence,  Atomic Operation,  Memory Ordering,  Memory Barrier, Volatile
给大家介绍一下实现Go并发同步原语的基石
Go是一门以并发编程见长的语言,它提供了一系列的同步原语方便开发者使用,例如sync包下的Mutex、RWMutex、WaitGroup、Once、Cond,以及抽象层级更高的Channel。但是,它们的实现基石是原子操作。需要记住的是:软件原子操作离不开硬件指令的支持。本文拟通过探讨原子操作——比较并交换(compare and swap, CAS)的实现,来理解Go是如何借助硬件指令来实现这一过程的。
KevinYan
2021/09/24
1.1K0
给大家介绍一下实现Go并发同步原语的基石
x86系统cache locking的原理
cmpxchg 本身不是原子的,需要加 lock 才是原子的,而 lock 是通过锁内存总线来实现原子性的。
JavaEdge
2020/05/27
4.4K2
gcc x64 asm 内联汇编尝试
asm volatile(assembler template : output : input : clobber);
战神伽罗
2019/07/24
3.1K0
gcc x64 asm 内联汇编尝试
IDA Pro 7.5 + HexRays (x86/x64/ARM/ARM64)
The source code of the software we use on a daily basis isn’t always available. A disassembler like IDA Pro is capable of creating maps of their execution to show the binary instructions that are actually executed by the processor in a symbolic representation called assembly language. This disassembly process allows software specialists to analyse programs that are suspected to be nefarious in nature, such as spyware or malware. However, assembly language is hard to read and make sense of. That is why advanced techniques have been implemented into IDA Pro to make that complex code more readable. In some cases, it is possible to revert the binary program back, to a quite close level, to the original source code that produced it. The map of the program’s code can then be post-processed for further investigation.
obaby
2023/02/23
6.7K0
IDA Pro 7.5 + HexRays (x86/x64/ARM/ARM64)
VMProtect 3.x- 如何对vmp静态分析(2)
虚拟分支中最明显的一致性是PUSHVSP的使用。当两个加密值位于VSP + 0、 和的堆栈上时,将执行此虚拟指令VSP + 8。这些加密值使用给定块的最后一个LCONSTDW值解密。因此,可以基于这两个一致性创建一个非常小的算法。算法的第一部分将简单地使用std::find_if反向迭代器来定位给定代码块中的最后一个LCONSTDW。该 DWORD 值将被解释为用于解密两个分支的加密相对虚拟地址的 XOR 密钥。std::find_if现在执行第二个步骤来定位PUSHVSPvirtual 指令,当执行时,两个加密的相对虚拟地址将位于堆栈上。该算法将每条PUSHVSP指令的顶部两个堆栈值解释为加密的相对虚拟地址,并对最后一个LCONSTDW值应用 XOR 运算。
franket
2021/10/12
3.7K0
x86汇编指令详解_x86汇编指令详解
参考链接:X86-assembly/Instructions/lea – aldeid
全栈程序员站长
2022/09/30
1.5K0
CAS指令与MESI缓存一致性协议、 “轻量级锁” 与原子操作CAS指令与MESI缓存一致性协议、 “轻量级锁” 与原子操作
CAS指令,在Intel CPU上称为CMPXCHG。最常见的原子操作有Compare and Exchange,Self Increase/Decrease等等
一个会写诗的程序员
2018/08/17
2.8K0
IA32和X86有什么区别?
 特别鸣谢:木芯工作室 孔子学鼓琴师襄子,十日不进。师襄子曰:“可以益矣。”孔子曰:“丘已习其曲矣,未得其数也。”有间,曰:“已习其数,可以益矣。”孔子曰:“丘未得其志也。”有间,曰:“已习其志,可以益矣。”孔子曰:“丘未得其为人也。”有间,有所穆然深思焉,有所怡然高望而远志焉。曰:“丘得其为人,黯然而黑,几然而长,眼如望羊,如王四国,非文王其谁能为此也!”师襄子辟席再拜,曰:“师盖云文王操也。”
20岁爱吃必胜客
2022/11/13
2.2K0
Volatile 可见性承诺
Java Volatile 关键字是一种轻量级的数据一致性保障机制,之所以说是轻量级的是因为 volatile 不具备原子性,它对数据一致性的保障体现在对修改过的数据进行读取的场景下(也就是数据的可见性)。比起对读操作使用互斥锁, volatile 是一种很高效的方式。因为 volatile 不会涉及到线程的上下文切换,以及操作系统对线程执行的调度运算。同时 volidate 关键字的另一个功能是解决“指令重排序问题”。
不会飞的小鸟
2020/03/17
7420
CAS操作在ARM和x86下的不同实现
  cmpxchg是X86比较交换指令,这个指令在各大底层系统实现的原子操作和各种同步原语中都有广泛的使用,比如linux内核,JVM,GCC编译器等,cmpxchg就是比较交换指令,了解cmpxchg之前先了解原子操作。
用户4415180
2022/06/23
1.3K0
Java CAS 原理分析
CAS 全称是 compare and swap,是一种用于在多线程环境下实现同步功能的机制。CAS 操作包含三个操作数 -- 内存位置、预期数值和新值。CAS 的实现逻辑是将内存位置处的数值与预期数值想比较,若相等,则将内存位置处的值替换为新值。若不相等,则不做任何操作。
田小波
2018/05/15
2.1K9
Java CAS 原理分析
x86 CPU与IA-32架构
现代计算机使用的CPU大部分都是x86CPU,包括现在牙膏厂的酷睿。x86系列CPU的原型是Intel 1978年推出的8086 CPU
Orlion
2024/09/02
2650
x86 CPU与IA-32架构
volatile与内存屏障 发布于 2
在Java中,volatile用于标记变量,而内存屏障又是volatile的底层实现。它们是Java中最基础也是最简单的两个概念,它们的出现使得开发者在多线程环境下能够保证更好的数据一致性和程序执行的正确性。volatile简单、轻量,相比于其他方式,如synchronized或直接加锁,有着更好的性能。能让开发者少些对锁的忧虑,多一些对实际问题的关注。
DioxideCN
2023/10/21
4620
eBPF 简史「建议收藏」
最近总能看到bpf,但苦于找不到合适的资料理解,终于找到一个分析讲解较全面的文章,分享给大家,原网址如下: http://www.linux-ren.org/tech/2230.mhtml https://www.ibm.com/developerworks/cn/linux/l-lo-eBPF-history/index.html
全栈程序员站长
2022/09/29
5040
IDA PRO 5.6 Demo
‘instant debugger’: the debugger can be launched and a process started without a database. This feature is available locally and remotely and allows the debugger to be attached to any running process in the system. IDA can be used as the default system debugger. Remote 64-bit debugger for MS Windows 64 running on AMD64/EMT64. IDA itself runs in 32-bit mode while the debugger server runs in 64-bit mode to launch and debug 64-bit applications. full type system support for the ARM processor. IDA supports the function calling conventions and comments function parameters in the same way as it does on PC. The ARM module has been significantly improved: see a list of all the ARM specific enhancements below. Wizard-like interface to load new files. IDA assists the user in the initial load process by asking relevant questions about the file. This interface is configurable with XML files. Processor Modules
obaby
2023/02/28
1K0
Java 虚拟机圖文詳解: JVM 體系結構 ( The JVM Architecture Explained
A Virtual Machine is a software implementation of a physical machine. Java was developed with the concept of WORA (Write Once Run Anywhere), which runs on a VM. The compiler compiles the Java file into a Java .class file, then that .class file is input into the JVM, which loads and executes the class file. Below is a diagram of the Architecture of the JVM.
一个会写诗的程序员
2021/12/16
9170
Java 虚拟机圖文詳解: JVM 體系結構  ( The JVM Architecture Explained
X86 寻址方式、AT&T 汇编语言相关知识、AT&T 与 Intel 汇编语言的比较、gcc 嵌入式汇编
注:本分类下文章大多整理自《深入分析linux内核源代码》一书,另有参考其他一些资料如《linux内核完全剖析》、《linux c 编程一站式学习》等,只是为了更好地理清系统编程和网络编程中的一些概念
s1mba
2017/12/28
3.4K0
X86 寻址方式、AT&T 汇编语言相关知识、AT&T 与 Intel 汇编语言的比较、gcc 嵌入式汇编
计算机常用算法对照表整理
常用对照: NLP CRF算法: 中文名称条件随机场算法,外文名称conditional random field algorithm,是一种数学算法,是2001年提出的,基于遵循马尔可夫性的概率图模型。 全部对照 第一部分、计算机算法常用术语中英对照 Data Structures 基本数据结构 Dictionaries 字典 Priority Queues 堆 Graph Data Structures 图 Set Data Structures 集合 Kd-Tre
学到老
2018/03/16
2.2K0
相关推荐
About Cache Coherence, Atomic Operation, Memory Ordering, Memory Barrier, Volatile
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验