OSDev.org https://forum.osdev.org/ |
|
Intel syntax with GAS? https://forum.osdev.org/viewtopic.php?f=8&t=38673 |
Page 1 of 1 |
Author: | moonchild [ Tue Dec 15, 2020 7:38 pm ] |
Post subject: | Intel syntax with GAS? |
The wiki article on GAS recommends not using GAS's intel syntax. It gives two reasons:
1 is certainly true, but only applicable to a small number of x87 instructions which should be avoided anyway. 2 seems to have been fixed; at least, I was unable to reproduce it: Code: $ cat testatt.s .code16 ; NB. I get the same results in 64-bit mode f1: mov $5, %si mov %di, %si mov %ax, %si movsx %al, %si movsb (%si), (%di) $ cat testintel.s .intel_syntax noprefix .code16 f1: mov si, 5 mov si, di mov si, ax movsx si, al movsb [di], [si] $ as testatt.s -o testatt.o && as testintel.s -o testintel.o $ diff test{att,intel}.o && echo same same Should the wiki page be updated? Are there any other reasons people know of for avoiding GAS's intel syntax? It's worked great for me, personally. |
Author: | Combuster [ Mon Dec 21, 2020 5:42 am ] |
Post subject: | Re: Intel syntax with GAS? |
Your average bootloader example contains something like Code: jmp far 0x0008:0x00010000 On my system's binutils 2.33.1, that still givesCode: astest.s:4: Error: junk `0x0008:0x00010000' after expression Have fun figuring out the correct syntax if you don't know it already. Hint: it's not in the intel or amd manuals ![]() |
Author: | nexos [ Mon Dec 21, 2020 7:01 am ] |
Post subject: | Re: Intel syntax with GAS? |
It may be hard enough to figure out GAS syntax to begin with! Luckily, I found a document on the net (forget where) that saved me a few weeks ago when I switched to GAS. |
Author: | crosssans [ Tue Jan 12, 2021 2:12 am ] |
Post subject: | Re: Intel syntax with GAS? |
Combuster wrote: Your average bootloader example contains something like Code: jmp far 0x0008:0x00010000 On my system's binutils 2.33.1, that still givesCode: astest.s:4: Error: junk `0x0008:0x00010000' after expression Have fun figuring out the correct syntax if you don't know it already. Hint: it's not in the intel or amd manuals ![]() It is indeed tricky to find equivalents of the Intel syntax while using GAS, that's why I'm going to take the opportunity to give the equivalent of your given instruction here so that people don't have to figure out the hard way (as I did!) ![]() Code: ljmp $0x8, $0x10000
|
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |