From owner-freebsd-doc Thu May 20 16:48:22 1999 Delivered-To: freebsd-doc@freebsd.org Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (Postfix) with ESMTP id 5D1F314E6C for ; Thu, 20 May 1999 16:48:15 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id JAA15202; Fri, 21 May 1999 09:18:14 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.3/8.9.0) id JAA13752; Fri, 21 May 1999 09:18:13 +0930 (CST) Date: Fri, 21 May 1999 09:18:12 +0930 From: Greg Lehey To: Jeff Clough Cc: doc@FreeBSD.ORG Subject: Re: At&T-style ASM Tutorial? Message-ID: <19990521091812.Q89091@freebie.lemis.com> References: <37441616.F133AAB0@chaosphere.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <37441616.F133AAB0@chaosphere.com>; from Jeff Clough on Thu, May 20, 1999 at 10:03:02AM -0400 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thursday, 20 May 1999 at 10:03:02 -0400, Jeff Clough wrote: > To Whom It May Concern: > > Having no experience with assembly outside of a DOS environment, and > having forgotten nearly everything I learned before, I resolved to learn > assembly all over again on my trusty FreeBSD box. While this endevour > is certainly adventurous, I had no idea that there would be no maps to > show me the way. Specifically, I note the absence of the following > (granted, I might have missed something): > > - There are no tutorials for learning assembly using the AT&T syntax > - There is no list of available OS interrupts (if they exist at all) I think you mean system calls. That's what part 2 of the manual is about. > - There are no instructions (human, not processor) for accessing the > BIOS FreeBSD doesn't use the BIOS. > - There is no manifest available that says "This is what you need to > know to write slick assembly under FreeBSD Right. Assembly has been deprecated in UNIX since 1973. > - An interrupt list ala "Ralph Brown's Interrupt List" for FreeBSD Again, look at section 2 of the manual. > I spoke with someone a while ago about this (no one from the FreeBSD > movement, this guy was a Linux-phile) and was told "Why would you want > to learn AT&T!?! Just grab a copy of NASM you masochist!". This isn't > all that practical since I use gcc exclusively and I like to stick with > "standard" tools. The standard programming tool for UNIX is the C compiler. > I think you're more apt to find gas on a system than NASM. Plus, > this still doesn't address the "How do I do X with FreeBSD?" issue. Right. NASM is pointless. > Now, the point: > > Since I'm learning this anyway and I love FreeBSD I'd like to get > involved with a project that fills in the blanks I listed above. I > would love to see a "A Guide To FreeBSD Assembler" or something > similar. A nice friendly tutorial that assumes no knowledge of the > Intel syntax. Despite all I've said above, this sounds like a very good idea. > If there is currently a project underway that is doing this, I'd > like to help. If not, I'd like to start one. Hopefully such a thing > would put me in contact with people that can answer such questions > as "How do I print something to the screen without using a call to > printf, etc.?" Well, I can answer that one. Use write(2). But that's documented. > Would such a thing be wonderful? Please let me know. I think you need to refocus a little bit. UNIX is an operating system, which means that you have no specific advantage in using assembly in userland code. There is some advantage in using it in kernel code, and certainly things like instruction mnemonics should be documented. But there's very little you can really do with assembler. I'd suggest you start with the gas manual (look in /usr/src/contrib/binutils/gas/doc/) and flesh that out with stuff you think's appropriate. You might like to look at some of the low-level kernel code in /usr/src/sys/i386/i386/ to get an idea how things are used. If you have any specific questions, drop me a line. Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message