Can anyone explain "movl %eax %eax"?

From: Jidong Xiao
Date: Wed Feb 09 2011 - 17:24:49 EST


Hi,

In the kernel source, I see in a couple of places, there is "movl %eax
%eax". Is this used for alignment purpose?

For example, in the following piece of code we can see "movl %eax,%eax".

407 ENTRY(ia32_syscall)
408 CFI_STARTPROC32 simple
409 CFI_SIGNAL_FRAME
410 CFI_DEF_CFA rsp,SS+8-RIP
411 /*CFI_REL_OFFSET ss,SS-RIP*/
412 CFI_REL_OFFSET rsp,RSP-RIP
413 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
414 /*CFI_REL_OFFSET cs,CS-RIP*/
415 CFI_REL_OFFSET rip,RIP-RIP
416 PARAVIRT_ADJUST_EXCEPTION_FRAME
417 SWAPGS
418 /*
419 * No need to follow this irqs on/off section: the syscall
420 * disabled irqs and here we enable it straight after entry:
421 */
422 ENABLE_INTERRUPTS(CLBR_NONE)
423 movl %eax,%eax
424 pushq %rax
425 CFI_ADJUST_CFA_OFFSET 8
426 cld
427 /* note the registers are not zero extended to the sf.
428 this could be a problem. */
429 SAVE_ARGS 0,0,1
430 GET_THREAD_INFO(%r10)
431 orl $TS_COMPAT,TI_status(%r10)
432 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
433 jnz ia32_tracesys
434 cmpq $(IA32_NR_syscalls-1),%rax
435 ja ia32_badsys
436 ia32_do_call:
437 IA32_ARG_FIXUP
438 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
439 ia32_sysret:
440 movq %rax,RAX-ARGOFFSET(%rsp)
441 ia32_ret_from_sys_call:
442 CLEAR_RREGS -ARGOFFSET
443 jmp int_ret_from_sys_call


Regards
Jidong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/