Port-amd64 archive

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

Re: Why avoid inline assembly ?



On 08/06/15 10:23, deco33000%yandex.com@localhost wrote:
> I would like to know why cpu functions (cpufunc.S) are written in assembly and not asm inlined (like in other operating systems).
> e.g x86_disable_intr

   Is that the only example?  Is inline assembler used in other parts of
the code?

   Be warned: Without actually knowing what the heck I'm talking about..

   My guess would be that the C code is intended for a
standards-compliant C compilers, and tries to make no assumptions beyond
that.  I.e. if you show up with your fully up-to-C99 compatible C
compiler, but which doesn't have an inline assembler, you should be able
to build NetBSD.

   Also, if you then add your own inline assembler syntax which you
think is superior to all others available in the mainstream compilers,
what good is the inline assembler in the NetBSD code?

   Perhaps some inline assembler (de-facto) standard has emerged which
everyone uses nowadays, but I recall that back in the day build
instructions sometimes came with instructions to use a very specific
compiler (instead of mentioning what language level and libraries the
build needed) just because of the inline assembler syntax.  I'd wager
that I wasn't the only one who was annoyed at that.

   When possible it's far better not to make assumptions, imho.

-- 
Kind Regards,
Jan


Home | Main Index | Thread Index | Old Index