assembly - *%gs :0x10 do in assembler? 是什么意思

标签 assembly x86 nasm reverse-engineering

以下语法在 GASM 中有何作用?

*%gs:0x10

我知道 call *%gs:0x10 调用将 __kernel_vsyscall,但我不知道 *%register:value 会做什么。

它的 NASM 等效项如下所示:call DWORD PTR gs:0x10

最佳答案

这是一个 near absolute indirect (FF /2)调用 gs:0x10 中指针的目标。
请注意,gs 是一个选择器寄存器,而不是通用寄存器(请参阅 Protected mode )。
该指令读取偏移量 0x10 处的 DWORD(相对于段 gs)并调用其值。
直接调用会产生完全不同的效果,可能涉及调用门。


gs:0x10libc copies the address of __kernel_vsyscall during its initialization. 的位置

AT&T syntax for the control transfer instructions

Branch addressing using registers or memory operands must be prefixed by a '*'. To specify a "far" control tranfers, a 'l' must be prefixed, as in ljmp, lcall, etc. For example,

GAS syntax          NASM syntax
==========          ===========

jmp *100            jmp  near [100]
call *100           call near [100]
jmp *%eax           jmp  near eax
jmp *%ecx           call near ecx
jmp *(%eax)         jmp  near [eax]
call *(%ebx)        call near [ebx]
ljmp *100           jmp  far  [100]
lcall *100          call far  [100]
ljmp *(%eax)        jmp  far  [eax]
lcal *(%ebx)        call far  [ebx]
ret                 retn
lret                retf
lret $0x100         retf 0x100

Segment-offset pointers are specified using the following format:

jmp $segment, $offset

关于assembly - *%gs :0x10 do in assembler? 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41690592/

相关文章:

assembly - 将文字值赋给 LLVM IR 中的局部变量

windows - Windows 上 LLVM 汇编语言中的 Hello World

c - PowerPC 程序集中的 "ifdef"

assembly - 访问参数时内联汇编过程崩溃

assembly - Asm 指令上的 INT 与 CALL

assembly - 是否有更好的 AVX 指令来从 3 ymm 寄存器移动数据?

performance - 有关 x86 字符串指令性能的可靠信息?

performance - SSE2 8x8 字节矩阵转置代码在 Haswell+ 上比在 Ivy 桥上慢两倍

linux - 生成文件 NASM 错误 : more than one input file specified

assembly - 如何在x86中仅使用2条连续的leal指令将寄存器乘以37?