1

Are boot.s and head.s written in Intel syntax or AT&T syntax (it seems to be Intel syntax from the assembly instructions)? What's the usual giveaway tell to differentiate the two? And if one of the first Linux Kernel version was written with the Intel syntax, is there a neat story behind it?

RayaneCTX
  • 573
  • 4
  • 13
  • 1
    AT&T will have `%eax` instead of `eax`, and `$` on immediates. [Limitations of Intel Assembly Syntax Compared to AT&T](https://stackoverflow.com/a/9958480) And see https://stackoverflow.com/tags/att/info. – Peter Cordes Jul 13 '18 at 04:18
  • https://github.com/zavg/linux-0.01/blob/master/boot/boot.s looks like `as86`, which is a weird kind of Intel syntax that is a lot like gas `.intel_syntax`, but decorates immediates with `#` – Peter Cordes Jul 13 '18 at 04:23
  • Did GCC at the time of kernel 0.0.1's release know how to translate the Intel Syntax? I thought it was a recent addition. If not, why would Intel Syntax be used here if the default tool people have to debug it is GCC? The whole switcheroo between the two syntax is really confusing to me. – RayaneCTX Jul 13 '18 at 04:30
  • 3
    The boot files have to run in 16-bit mode; IDK if there was good support from the GNU toolchain for that. (And NASM didn't exist yet.) Apparently `as86` was one of the more widely used free assemblers at the time for 16-bit stuff. – Peter Cordes Jul 13 '18 at 05:00
  • 1
    @PeterCordes the Makefile does invoke `as` from `AS86`, so your presumption seems at least consistent. – Michael Foukarakis Jul 13 '18 at 11:05
  • Thanks to your comments and links, my questions are answered. – RayaneCTX Jul 13 '18 at 15:15
  • @RayaneCTX GCC used to support Xenix and Xenix's assembler was MASM, so Intel syntax was supported back then. However I'm not sure that's really relevant here. – Ross Ridge Jul 14 '18 at 14:35

0 Answers0