Re: Bad instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



BTW, as I run the instruction, I get permission denied error.


Regards,
Mahmood 

    On Tuesday, July 9, 2019, 1:23:58 PM GMT+4:30, Mahmood Naderan via gcc-help <gcc-help@xxxxxxxxxxx> wrote:  
 
 >You mean x86-64, instead of x86.  On x86 "c5 00" means "lds (%eax),%eax".
>
>"c5" itself is not illegal.  For example, "c5 00 58 00" means an AVX instruction
>"vaddps (%rax),%xmm15,%xmm8".  The disassembler can only determine that it's an
>illegal instruction after it has seen "c5 00 00".


Xi,The code looks like
$ cat machine3.c
void main() {
__asm__(".byte 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00");
}
$ gcc -masm=intel -g -c machine3.c
$ objdump -d -M intel -S -z machine3.o

machine3.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <main>:
void main() {
   0:   55                      push   rbp
   1:   48 89 e5                mov    rbp,rsp
   4:   c5 00 00                (bad)
   7:   00 00                   add    BYTE PTR [rax],al
   9:   00 00                   add    BYTE PTR [rax],al
   b:   00 00                   add    BYTE PTR [rax],al
   d:   00 00                   add    BYTE PTR [rax],al
   f:   00 00                   add    BYTE PTR [rax],al
  11:   00 00                   add    BYTE PTR [rax],al
__asm__(".byte 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00");
}
  13:   5d                      pop    rbp
  14:   c3                      ret



Why gcc considers that as a three byte instructions and then tag it as a bad instruction?

Regards,
Mahmood  



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux