From owner-freebsd-hackers Sat Sep 5 07:16:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA26632 for freebsd-hackers-outgoing; Sat, 5 Sep 1998 07:16:51 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from penmax.com (cc595093-a.mdltwn1.nj.home.com [24.3.192.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA26625 for ; Sat, 5 Sep 1998 07:16:49 -0700 (PDT) (envelope-from vincef@penmax.com) Received: from penmax.com (rembrandt.penmax.com [10.1.3.2]) by penmax.com (8.8.8/8.8.8) with ESMTP id KAA05537; Sat, 5 Sep 1998 10:00:30 -0400 (EDT) (envelope-from vincef@penmax.com) Message-ID: <35F14846.96A419F8@penmax.com> Date: Sat, 05 Sep 1998 10:18:46 -0400 From: Vincent Fleming Reply-To: vincef@penmax.com Organization: Penmax Grafix, Inc. X-Mailer: Mozilla 4.05 [en] (Win95; I) MIME-Version: 1.0 To: joelh@gnu.org CC: dag-erli@ifi.uio.no, ormonde@aker.com.br, hackers@FreeBSD.ORG Subject: Re: Assembler with FreeBSD References: <3.0.3.32.19980903123603.0068c6f4@cnt.org.br> <199809042207.RAA15514@detlev.UUCP> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Joel Ray Holveck wrote: > >> I have to write a few high speed routines in assembler to run on a > >> FreeBSD box. I used to program in assembler to DOS, so I think I have the > >> necessary knowledge to do it on FreeBSD. > > Why do you want to do that? FreeBSD isn't DOS. Your assembler routine > > is unlikely to be significantly faster than the corresponding C code > > compiled with 'gcc -O3'. > > More specifically, many things that were best done in assembler on DOS > are better done in C on Unix. I am going to write a web page later > tonight that addresses the differences between DOS and Unix assembler > codes, and will be sure to post the URL. I've found that although it's MUCH easier in C, it isn't faster. A human can optimize much better than an automated compiler. Well, that is IF they know what they're doing... The easiest way of working with assembler routines on new platforms I've found is to actually write the function in C, and have the compiler spit out assembler code (see the man page for the compiler for the switch - I forget what FreeBSD uses). You can then edit the assembler, and use either the assember or even the C compiler to assemble the code (most C compilers are smart enough to handle .s files.) This way, the platform-specific preambles and whatnot are generated by the C compiler, and you don't have to research how to write them! Good luck! Vince Fleming To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message