Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 1999 09:18:12 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Jeff Clough <vdk@chaosphere.com>
Cc:        doc@FreeBSD.ORG
Subject:   Re: At&T-style ASM Tutorial?
Message-ID:  <19990521091812.Q89091@freebie.lemis.com>
In-Reply-To: <37441616.F133AAB0@chaosphere.com>; from Jeff Clough on Thu, May 20, 1999 at 10:03:02AM -0400
References:  <37441616.F133AAB0@chaosphere.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990521091812.Q89091>