All of lore.kernel.org
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@cisco.com>
To: Harald Krapfenbauer <krapfenbauer@ict.tuwien.ac.at>
Cc: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Subject: Re: function call on MIPS (newbie question)
Date: Tue, 24 Jun 2008 10:45:07 -0700	[thread overview]
Message-ID: <486132A3.2000507@cisco.com> (raw)
In-Reply-To: <4860C9FD.60103@ict.tuwien.ac.at>

Harald Krapfenbauer wrote:
> Hi!
> 
> I'm a newbie to the MIPS architecture and I want to port some program to
> MIPS.
> I must call a function within the .text segment with 2 simple
> parameters. So I figured out the following code
...
> 
> The code is written to the stack, the SP and the PC are then set to the
> beginning of the code on the stack.

Unlike x86 architectures, the MIPS architecture generally does not have hardware 
to synchronize data and instructions caches. When writing code for execution on 
the MIPS processor, you need to be sure that you flush the data cache and 
invalidate the instruction cache before trying to execute the code. On most MIPS 
processors, you can use the SYNCI instruction to do this. Take a look at the 
documentation for this instruction in "MIPS32® Architecture for Programmers 
Volume II: The MIPS32® Instruction Set". It has sample code on how to properly do 
this in an unprivileged application. You can get to this manual, as well as other 
MIPS manuals, at:

      http://www.mips.com/products/product-materials/processor/mips-architecture/

You will need to register for a free account to download this.

You can also use the cacheflush system call to synchronize the data and 
instruction caches.
-- 
David VomLehn, dvomlehn@cisco.com
The opinions expressed herein are likely mine, but might not be my employer's...




     - - - - -                              Cisco                            - - - - -         
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to 
the addressee). If you are not the intended recipient of this message, you are 
not authorized to read, print, retain, copy or disseminate this message or any 
part of it. If you have received this e-mail in error, please notify the sender 
immediately by return e-mail and delete it from your computer.

  reply	other threads:[~2008-06-24 17:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24 10:18 function call on MIPS (newbie question) Harald Krapfenbauer
2008-06-24 17:45 ` David VomLehn [this message]
2008-06-24 17:48 ` Chris Dearman
2008-06-27 10:00   ` Harald Krapfenbauer

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=486132A3.2000507@cisco.com \
    --to=dvomlehn@cisco.com \
    --cc=krapfenbauer@ict.tuwien.ac.at \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.