How the DragonflyBSD developers solve problems that are not resolved by Assembly?

Matthew Dillon dillon at backplane.com
Mon Oct 20 20:41:54 PDT 2014


Both FreeBSD and DragonFly developers in the past have simply use .byte
assembly directives to lay down opcodes with no assembly equivalents.  For
example, in asmacros.h there is:

#define NON_GPROF_RET               .byte 0xc3

Which is used in assembly files for situations where the various RETs have
been #defined to be other things for profiling.

This is a last resort usually.  It has been used for a few floating point
ops here and there in the past, and ultimately the assembly gains the
needed opcodes and they can be replaced with the proper name.  I don't
think there is a whole lot of it in the current code bases.

-Matt

On Mon, Oct 20, 2014 at 4:10 PM, françai s <romapera15 at gmail.com> wrote:

> I think that the only case where you have to resort to writing binary
> code manually
> is when the assembler cannot output the desired code for some reason.
> If I recall correctly, there is only one such case in the HelenOS
> sources:
>
>
> http://trac.helenos.org/browser/mainline/kernel/arch/mips32/include/debug.h?rev=mainline%2C1446.3.1
>
> Here they manually encode the opcodes of five special debugging
> instructions for the MSIM MIPS simulator (these instructions are not
> part of the standard MIPS ISA, thus the assembler does not know them).
>
> But the developers of FreeBSD not write binary code manually.
>
> How the DragonflyBSD developers solve problems that are not resolved
> by Assembly?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20141020/785d6ab5/attachment-0002.html>


More information about the Kernel mailing list