[Top] [All Lists]

Re: function call on MIPS (newbie question)

To: Harald Krapfenbauer <>
Subject: Re: function call on MIPS (newbie question)
From: David VomLehn <>
Date: Tue, 24 Jun 2008 10:45:07 -0700
Authentication-results: rtp-dkim-1;; dkim=pass ( sig from verified; );
Cc: "" <>
Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; l=2061; t=1214329521; x=1215193521; c=relaxed/simple; s=rtpdkim1001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version;;; z=From:=20David=20VomLehn=20<> |Subject:=20Re=3A=20function=20call=20on=20MIPS=20(newbie=2 0question) |Sender:=20 |To:=20Harald=20Krapfenbauer=20< at>; bh=qSISNRgjPFqKC3pDpDMS4LjADo/VtG9cDEvaK6q6OUU=; b=peqNlZkBVcTiUtA9lA1Jf+z6pAvsS4jweYL+w7pRCywI5ioSuCe1JlupWp K2rKbpDE4jcmeRbyAabXSJC2UtU0PJz2j1jf/JP4XdmsymMopvznw/5agoMi EX1zFY3ANw;
In-reply-to: <>
Original-recipient: rfc822;
References: <>
User-agent: Thunderbird (Windows/20080421)
Harald Krapfenbauer wrote:

I'm a newbie to the MIPS architecture and I want to port some program to
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:

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,
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.

<Prev in Thread] Current Thread [Next in Thread>