What does the “mov rax, QWORD PTR fs:0x28” assembly instruction do? [duplicate]

穿精又带淫゛_ 提交于 2019-12-09 14:28:53

问题


Immediately before this instruction is executed fs contains 0x0.

Also I'd like to know how I can read from this memory area in GDB, what would the command for that be?


回答1:


The fs and gs registers in modern OSes like Linux and Windows point to thread-specific and other OS-defined structures. Modifying the segment register is a protected instruction, so only the OS can set these up for you.

This question should help explain what exactly the point to: amd64 fs/gs registers in linux.

The actual value of the fs register isn't an address. It is a selector - an offset into the GDT, that describes what that segment can/cannot be used for. You cannot see what the values of the hidden fs base and limit registers are - they are internal CPU registers that are only updated by writing a new "selector" to fs (at which point the base/limit registers are updated from the GDT).



来源:https://stackoverflow.com/questions/14414763/what-does-the-mov-rax-qword-ptr-fs0x28-assembly-instruction-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!