以下语法在 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:0x10
是 libc 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/