Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 18:40:56 -0200
From:      =?UTF-8?Q?fran=C3=A7ai_s?= <romapera15@gmail.com>
To:        freebsd-emulation@freebsd.org
Subject:   Re: This topic is mainly for developers of FreeBSD that develop in machine code, until even in binary code.
Message-ID:  <CAK_6RwehZouWtVOK1MJOZ6jQEtWt2cLJ52GQtrwHZzK=2OLcSw@mail.gmail.com>
In-Reply-To: <CAK_6RweXftPPitkRmOkZQOYvaKrA1FNrfpgqcJLidwgATmZFGA@mail.gmail.com>
References:  <CAK_6RweXftPPitkRmOkZQOYvaKrA1FNrfpgqcJLidwgATmZFGA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Someone?

2014-11-20 12:33 GMT-02:00 fran=C3=A7ai s <romapera15@gmail.com>:

> 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 FreeBS=
D
> developers don=E2=80=99t develop in machine code, in other words, the  mi=
nority
> 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> =E2=80=
=9C or
> sometimes the .word <foo> is just hard coded inline when there=E2=80=99s =
only going
> to be one of them. Sometimes we expose them both in assembly and in C cod=
e,
> in which case what we do varies a bit to accommodate the different
> language=E2=80=99s syntax. It is rare, but has happened, that we only exp=
ose it to
> C code.
>
> Generally, though, we try to add support for the opcodes to gas so that w=
e
> get the constraint testing it does (making sure the opcode is supported a=
t
> the level you are compiling, making sure it isn=E2=80=99t 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=E2=80=99t understand with the workaround being the assembl=
er
> directive using .word followed by by some hex value to encode the opcode.=
"
>
> "Most developers of FreeBSD don=E2=80=99t  write directly in machine code=
 in
> FreeBSD development, and don=E2=80=99t care. Some developers use the marc=
os that I
> described sometimes when doing specific, low-level coding. A handful of
> developers create the marcos directly or use the .word directives in thei=
r
> work to make certain things work that cannot work otherwise.
>
> People generally don=E2=80=99t write in raw machine opcodes. That is inde=
pendent
> 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 th=
at
> 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 workaroun=
d
> 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?
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAK_6RwehZouWtVOK1MJOZ6jQEtWt2cLJ52GQtrwHZzK=2OLcSw>