User Tools

Site Tools


developersguide:learningassemblyinminix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developersguide:learningassemblyinminix [2014/11/17 07:22] (current)
Line 1: Line 1:
 +===== 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 [[http://​ajray.wordpress.com/​2009/​04/​06/​query-the-processor-for-pmcs/​|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.
 +
 +  * [[http://​ozark.hendrix.edu/​~burch/​csbsju/​cs/​350/​handouts/​x86.html|Intel x86 Assembly Language in Minix]]: This is a very good tutorial for assembly and is entirely Minix-applicable. ​ It’s only lacking one thing: commuicating between C and Assembly programs, and since that is often vital to integrating assembly routines, it is included here.
 +  * English translation of a [[http://​www.woodhull.com/​newfaq/​faq/​MinixAsMn.html|Minix Assembly Language Manual]], originally written in Chinese by Mao Yao and Yang Songhua. ​ This does explain some Minix-specific assembler, but did not do so very clearly.
 +  * [[http://​wiki.minix3.org/​wikis/​minix3/​AssemblyLanguage|Minix assembly pseudo-ops, sections, and comments]] has some minix-specific information for those that already know assembly language, but doesn’t give enough for it to be of use for someone who doesn’t already know assembler.
 +  * A few others are listed in [[http://​www.minix3.org/​doc/​environ.html|Programming in the Minix 3 Environment]],​ but those are outdated (for versions 1 or 2) old newsgoup posts. I haven’t even gone through all of them, and I’ll probably scan through them when I’m working on the wiki pages for assembler.
  
developersguide/learningassemblyinminix.txt · Last modified: 2014/11/17 07:22 (external edit)