This topic is mainly for developers of FreeBSD that develop in machine code, until even in binary code.

françai s romapera15 at gmail.com
Thu Nov 20 14:33:35 UTC 2014


This subject is irresistible to me,I like so much of this issue that get
out tears out of my eyes.

This topic is mainly for developers of FreeBSD that develop in machine
code, until even in binary code.

A FreeBSD developer told me via private message that the  the most FreeBSD
developers don’t develop in machine code, in other words, the  minority
FreeBSD developers develop in machine code, until even in binary code.

He told me this:

"We either create a macro expands to something like ".word <foo> “ or
sometimes the .word <foo> is just hard coded inline when there’s only going
to be one of them. Sometimes we expose them both in assembly and in C code,
in which case what we do varies a bit to accommodate the different
language’s syntax. It is rare, but has happened, that we only expose it to
C code.

Generally, though, we try to add support for the opcodes to gas so that we
get the constraint testing it does (making sure the opcode is supported at
the level you are compiling, making sure it isn’t in a delay slot or
violating some other precondition for its use)."

"You pointed me at macros that defined operations in terms of opcodes the
assembler didn’t understand with the workaround being the assembler
directive using .word followed by by some hex value to encode the opcode."

"Most developers of FreeBSD don’t  write directly in machine code in
FreeBSD development, and don’t care. Some developers use the marcos that I
described sometimes when doing specific, low-level coding. A handful of
developers create the marcos directly or use the .word directives in their
work to make certain things work that cannot work otherwise.

People generally don’t write in raw machine opcodes. That is independent of
FreeBSD.

However, a few, specialized people will find the need to do it from time to
time. Usually because they are porting FreeBSD to a newer processor that
needs newer opcodes to do context switching, optimize interrupt handling,
code with a new type of cache coherency, etc. These people look up the
assembler in the docs from the vendor and then create the .word workaround
to make sure things work. If they have the time, they may add it to our
somewhat ancient gas assembler as well."

"Almost nobody writes directly in binary. There are some exceptions,
sometimes though."

The following link leads to tutorial that teaches programming Assembly in
to FreeBSD:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/x86.html

Also exist tutorial that teaches programming in machine code to FreeBSD?


More information about the freebsd-emulation mailing list