From owner-freebsd-emulation@FreeBSD.ORG Fri Nov 21 20:40:57 2014 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7784A5B for ; Fri, 21 Nov 2014 20:40:57 +0000 (UTC) Received: from mail-qa0-x230.google.com (mail-qa0-x230.google.com [IPv6:2607:f8b0:400d:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DCE5969 for ; Fri, 21 Nov 2014 20:40:57 +0000 (UTC) Received: by mail-qa0-f48.google.com with SMTP id v10so3937311qac.7 for ; Fri, 21 Nov 2014 12:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=8M0JpsnRc3GsKZYxj270mG/1NawFcAY++u+uUVUlxv0=; b=YGLB+GOMctioxlCY8OaktzUU+agdPOQquVySXY5XDJ+3ZBfqlKKtfefLNT0XOpNW0m ijABe5Pf2tBWFqUFxOsIM+M7MhY8zqaTGKjveF5o1wxvk8qcZ2xSnaGaX1yNUpWLQDmk Z0WPfm89R5HjHvBKE/mN2uZVTRgmlu1QoiDezuJtHSO4If4CwQt4QXbcwhpPAL5cCCYc TOV8FxaHMKQh8MxvNptnqCXg8/+aNZNa9NnkR2mFk12ms/6B+fruLwhKF1fGijNShl5r 7EVWxoVO8brIUjaDEH/8JqC47N8WCegqALm3Mq2cgMHQfiJlvU0wEpQLdmK848KUAaK+ K6uw== MIME-Version: 1.0 X-Received: by 10.140.101.145 with SMTP id u17mr9083958qge.84.1416602456491; Fri, 21 Nov 2014 12:40:56 -0800 (PST) Received: by 10.140.42.55 with HTTP; Fri, 21 Nov 2014 12:40:56 -0800 (PST) In-Reply-To: References: Date: Fri, 21 Nov 2014 18:40:56 -0200 Message-ID: Subject: Re: This topic is mainly for developers of FreeBSD that develop in machine code, until even in binary code. From: =?UTF-8?Q?fran=C3=A7ai_s?= To: freebsd-emulation@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2014 20:40:58 -0000 Someone? 2014-11-20 12:33 GMT-02:00 fran=C3=A7ai s : > 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 =E2=80= =9C or > sometimes the .word 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? >