Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Emmanuel Mogenet <mgix@aw.sgi.com>
To: Mike Shaver <shaver@neon.ingenia.ca>
Cc: linux@cthulhu.engr.sgi.com
Subject: Re: Sheepish question
Date: Thu, 27 Mar 1997 13:42:40 -0800	[thread overview]
Message-ID: <333AE9CF.167E@aw.sgi.com> (raw)
In-Reply-To: 199703272048.PAA13651@neon.ingenia.ca

Mike Shaver wrote:
> 
> If I were, say, a total newbie when it comes to assembly, what would
> be a good place to start?  I've always meant to learn assembly, and
> this would seem an ideal opportunity -- and to do it on real hardware!
> =)
> 
> Any good references?  Anything MIPS-specific?

For general references on assembly programming, I'm not sure.
Is there a need for such a thing ?

But for MIPS specific, if you've go an SGI with a proper
development toolkit on it, it should come with an online
book entitled "MIPS Assembly Programming Guide".

That's quite a complete reference, but not a tutorial.

The hacker way of looking at things (the one I like) is
to write tiny C programs, compile them with cc -S,
look at the output, and try to understand what happens.

Even better, compile your c program and use dis (the sgi disassembler)
to look at the result (cc -S output something that's not really the
final
thing the CPU groks)

Also, dbx has quite a few command that allow you
to follow a program step by step at  assembly level:

ni			(next instruction, don't follow subroutine calls)
si			(next instruction, follow)
stopi at 		(add an asm level breakpoint)
syscall catch call xx	(stop on system call xx)
$pc-20/50i		(list asm fragment around current PC)
pr			(dump registers)
assign $pc=xxxx		(change value of register pc to xxxx)

etc ...


Finally, beware of pipelining weirdies.
A most striking example is:

[   4] 0x40092c:  03 e0 00 08         jr        ra		// Return from
subroutine
[   4] 0x400930:  24 02 00 03         li        v0,3		// Load return
value in v0

At first reading, it seems like the routine returns
before loading the return value in v0.

Actually, both instructions are executed at the same time.

	- Mgix

      parent reply	other threads:[~1997-03-27 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-27 20:48 Sheepish question Mike Shaver
1997-03-27 20:54 ` Ariel Faigon
1997-03-27 20:54   ` Ariel Faigon
1997-03-27 21:13   ` Mike Shaver
1997-03-27 21:42 ` Emmanuel Mogenet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=333AE9CF.167E@aw.sgi.com \
    --to=mgix@aw.sgi.com \
    --cc=linux@cthulhu.engr.sgi.com \
    --cc=shaver@neon.ingenia.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox