lkml.org 
[lkml]   [2015]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] x86/asm/entry/64: use smaller insns

* Denys Vlasenko <vda.linux@googlemail.com> wrote:

> In my experiment, GAS uses 10-byte insn only for constants which
> won't work with 7-byte encoding; or if I explicitly ask for "movabs":
>
> _start: .globl _start
> mov $0x12345678,%edi # 5 bytes
> mov $0x12345678,%rdi # 7 bytes
> movq $0x12345678,%rdi # 7 bytes
> mov $0x80000000,%rdi # 10 bytes
> mov $0x123456789,%rdi # 10 bytes
> movabs $0x12345678,%rdi # 10 bytes
>
>
> $ gcc -nostartfiles -nostdlib -c z.S && objdump -dr z.o
> z.o: file format elf64-x86-64
> Disassembly of section .text:
> 0000000000000000 <_start>:
> 0: bf 78 56 34 12 mov $0x12345678,%edi
> 5: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi
> c: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi
> 13: 48 bf 00 00 00 80 00 movabs $0x80000000,%rdi
> 1a: 00 00 00
> 1d: 48 bf 89 67 45 23 01 movabs $0x123456789,%rdi
> 24: 00 00 00
> 27: 48 bf 78 56 34 12 00 movabs $0x12345678,%rdi
> 2e: 00 00 00

I see, so:

movq $AUDIT_ARCH_X86_64, %rsi

generated a 10-byte MOVABS opcode, while moving into %esi generates
the 5-byte 32-bit MOV opcode?

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-03-26 11:41    [W:0.061 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site