void return_input (void) { char array[30]; gets (array); printf("%s\n", array); }
%GS在GCC编译它之后,该功能将转换为以下汇编代码:什么是大会
push %ebp mov %esp,%ebp sub $0x28,%esp mov %gs:0x14,%eax mov %eax,-0x4(%ebp) xor %eax,%eax lea -0x22(%ebp),%eax mov %eax,(%esp) call 0x8048374 lea -0x22(%ebp),%eax mov %eax,(%esp) call 0x80483a4 mov -0x4(%ebp),%eax xor %gs:0x14,%eax je 0x80484ac call 0x8048394 leave ret
我不明白两行:
mov %gs:0x14,%eax xor %gs:0x14,%eax
什么是%gs,这两条线究竟做了什么?
这是编译命令:
cc -c -mpreferred-stack-boundary=2 -ggdb file.c
我想这些是SS,DS,CS,ES,FS,GS段寄存器。如果我说得对。 – 2012-02-12 14:00:50
可能重复[什么是“FS”/“GS”寄存器?](http://stackoverflow.com/questions/10810203/what-is-the-fs-gs-register-intended-for) – 2015-11-07 09:17:28