Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "J. Scott Kasten" <jscottkasten@yahoo.com>
To: Hyon Lim <alex@alexlab.net>
Cc: linux-mips@linux-mips.org
Subject: Re: implementation of software suspend on MIPS. (system log)
Date: Thu, 1 Nov 2007 09:41:12 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0711010908090.11339@pixie.tetracon-eng.net> (raw)
In-Reply-To: <dd7dc2bc0711010211k530296a4u8dc9272673075248@mail.gmail.com>



On Thu, 1 Nov 2007, Hyon Lim wrote:

> I think the reason of assembly implementation is processor context
> replacement.

Understood.  Assembly may indeed be required for specific things like 
restoring register state or fiddling with the cache if there aren't 
already macros or functions in the kernel that do exactly what you need.

> The second reason that I thinking is calling convention of C language.

It's not uncommon at all to have assembly language glue, say between a 
BIOS callback and the C language routine that does the work.

In your original post, you mentioned tracking variables and things that 
suggested a module that does much more that just load some odd registers 
or flip around a function call stack.  If that is indeed the case, then 
for sake of maintainablility and readability, one would be strongly 
encouraged to write the core stuff in plain old C and sprinkle in assembly 
glue code as required.

Think about it this way.  MIPS is a pretty large family of CPUs, each with 
it's own strange behaviors.  Several of those people on this list spend a 
lot of time tweeking that assembly to make it work cleanly across various 
CPUs.  It's a lot easier to understand 25 lines of assembly interface code 
and 200 lines of C code, than an entire 1000 line module written in 
assembly.  It's also a lot easier when you can shove most of the work over 
to the compiler, especially if others like your work and want to 
generalize it for use on many other MIPS CPUs.

I guess the real question here is how complex do you think your code needs 
to be?  That should determine your path.

Regards,

-S-

  reply	other threads:[~2007-11-01 13:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DDAE9570F73FC744918E843E20BE598B096E8E@server1.RightHand.righthandtech.com>
2007-11-01  1:46 ` implementation of software suspend on MIPS. (system log) Hyon Lim
2007-11-01  2:27   ` J. Scott Kasten
2007-11-01  9:11     ` Hyon Lim
2007-11-01 13:41       ` J. Scott Kasten [this message]
2007-11-01 14:37         ` Hyon Lim
2007-11-01 15:00           ` J. Scott Kasten
2007-10-30 19:15 Hyon Lim
     [not found] ` <20071031132553.GF14187@linux-mips.org>
2007-10-31 18:15   ` Hyon Lim
2007-10-31 18:30     ` Ralf Baechle
2007-10-31 18:32     ` Uhler, Mike
2007-10-31 18:32       ` Uhler, Mike

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=Pine.LNX.4.64.0711010908090.11339@pixie.tetracon-eng.net \
    --to=jscottkasten@yahoo.com \
    --cc=alex@alexlab.net \
    --cc=linux-mips@linux-mips.org \
    /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