From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 17 15:29:32 2014 Return-Path: Delivered-To: freebsd-hackers@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 3E16B3CC for ; Mon, 17 Nov 2014 15:29:32 +0000 (UTC) Received: from mail-qg0-x233.google.com (mail-qg0-x233.google.com [IPv6:2607:f8b0:400d:c04::233]) (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 EAB2A3E0 for ; Mon, 17 Nov 2014 15:29:31 +0000 (UTC) Received: by mail-qg0-f51.google.com with SMTP id l89so815828qgf.38 for ; Mon, 17 Nov 2014 07:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=NWGzjQspUeAiGLCmUM+4ulrqV3UR18v6ymKD9HnM8WI=; b=UJUTwCGS6dccI0mHN48Ctvf4IxSqgeQzd54f4KNEwmLjTIRTe5fS1IvFJQBQ0GQyqv TNlT7nFxb4g80JycsbDik13nXH/HWwcldh6KQ26HEl7w9/I2lKn0qU1Ft7O5mta5A0gB hOYrWuJUyi1LxO6VYuGucKTElV9+L5z9HOKYgBHfXwaQVRKrEWrM9bWwdfXUuT7IqJfS RFcPGj7P18x4RLoaXzeGW8u5Wdw6tPvemm5HyIYgL3+sGHQs7Wk2AHOAm2XY2vEE02E/ cXd/NkvfIW5TY9u/hbTgCGnrFiYAa94EynF5c7a/MeXn8Ld6QYMfWks3UCryfssjuJtL ukoA== MIME-Version: 1.0 X-Received: by 10.229.104.3 with SMTP id m3mr35348956qco.0.1416238171118; Mon, 17 Nov 2014 07:29:31 -0800 (PST) Received: by 10.140.42.55 with HTTP; Mon, 17 Nov 2014 07:29:31 -0800 (PST) Date: Mon, 17 Nov 2014 13:29:31 -0200 Message-ID: Subject: 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-hackers@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-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2014 15:29:32 -0000 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=E2=80=99t develop in machine code, in other words, the mino= rity 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 on= ly 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=E2=80=99s syntax. It is rare, but has happened, that we only expos= e 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=E2=80=99t in a delay slot o= r 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 assembler 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 i= n FreeBSD development, and don=E2=80=99t 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=E2=80=99t write in raw machine opcodes. That is indepe= ndent 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.ht= ml Also exist tutorial that teaches programming in machine code to FreeBSD?