Converting barebones boot.s to intel syntax
Posted: Sun May 29, 2016 11:05 am
Hi,
I followed the barebones guide and got the 'hello world' OS up and running.
As an exercise, I tried changing the boot.s file to intel syntax. As far as I can see, this just involved changing
to
and then recompiling it with
This all went fine. However, when it came to linking time, I received the following error:
which instantly made me think it was still looking for ATT-syntax mnemonics like '%esp' instead of 'esp'. I tried combinations of adding '-masm=intel' to the i686-elf-gcc call, and '-mmnemonic=intel' to the i686-elf-as call, but these made no difference.
What finally did work was adding '.intel_syntax noprefix' to the top of the boot.s file. However, I'm assuming that the command line options are meant to make it so you don't have to specify this in each .s file. The flags seem to affect the general syntax, but not the register names somehow.
Any guidance on this would be much appreciated.
I followed the barebones guide and got the 'hello world' OS up and running.
As an exercise, I tried changing the boot.s file to intel syntax. As far as I can see, this just involved changing
Code: Select all
movl $stack_top, %esp
Code: Select all
mov esp, offset dword ptr stack_top
Code: Select all
i686-elf-as -msyntax=intel
Code: Select all
(.text+0x2): undefined reference to 'esp'
What finally did work was adding '.intel_syntax noprefix' to the top of the boot.s file. However, I'm assuming that the command line options are meant to make it so you don't have to specify this in each .s file. The flags seem to affect the general syntax, but not the register names somehow.
Any guidance on this would be much appreciated.