Table of Contents

Learning Assembly Language

These are resources to aid users in learning assembler as it relates to Minix. Note: the prerequisite for this is knowing C. If you do not already know C, you'll save yourself many headaches by doing this first.

Use the compiler

This is the single best resource for learning assembler. You can see exactly what the compiler would to to create assembly programs (or functions etc.). The best reccomendation would be to write (small) simple programs in C, then convert them to assembly, and try to go through them using the other guides as a reference. This is good for hands-on learners.

Write a simple C program that demonstrates what you want to do, then translate it to assembly with:

$ cc -S myprogram.c

Dr. Paul Carter’s Assembly Tutorial

http://drpaulcarter.com/pcasm/

While not Minix-specific, this was the best manual for 80×86 assembly I found, and if you would rather read a manual first (before you start mucking around in code) then I would reccomend this. It is concise and well organized with plenty of examples, and covers everything you need to get started wirting assembly for 80×86. Bonus! It’s available in multiple languages. I used this as a reference, but fully intend to go back and read through the entire thing once classes end for the spring.

Appendix B from OSDI

http://www.minix3.org/doc/AppendixB.html

There are a good deal of assembly (*.s) files in the Minix source code. The two (big) files of note are: kernel/mpx386.s (line 06300, page 707) and kernel/klib386.s (line 08800, page 742). These are good references as they span a wide range of tasks. They are also minix-specific examples and if you end up writing assembly routines on your own it would be a good idea to base your conventions on these.

Examples from Minix SVN

https://gforge.cs.vu.nl/gf/project/minix/

This is the current source for 3.1.4, and is newer than the source published with the book. There are plenty of assembly files here to reference, but I’ll point out the two I used. Saturn|VU pointed me to read_tsc.s on the IRC channel. What makes this different is that it uses an operation (opcode) thats not supported by the assembler. Now while incorporating this into a high level language would be dreadfully complex, with assembly we just write in the opcode by hand and it will run just fine.

Intel 64 and IA-32 Architectures Software Developer’s Manuals

http://www.intel.com/products/processor/manuals/

While not actually an assembly reference, they contain a complete reference to anything and everything the processor can do at an assembly/machine-code level. If you're going to do anything 'exotic' or nonstandard (such as query built in performance counters) you will probably end up using these.

Other Resources

The items here are still worth a glance, but are more noise than use. As I develop my assembly skillset further I’ll do what I can to incorporate useful information from these into this wiki.