Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Fabrizio Fazzino <fabrizio@fazzino.it>
To: linux-mips@linux-mips.org
Subject: Re: Assembly macro with parameters
Date: Sat, 09 Jul 2005 09:22:08 +0200	[thread overview]
Message-ID: <42CF7B20.5010101@fazzino.it> (raw)
In-Reply-To: <Pine.LNX.4.61L.0507041306440.32001@blysk.ds.pg.gda.pl>

Maciej W. Rozycki wrote:
> Fabrizio Fazzino wrote:
> 
>>By the way, is there any quick way of writing a setreg(reg_num,reg_val)
>>C macro to set the value of a register?

Hi guys,
just to let you know that I solved my problem this way:

    // Set a register to the desired value
    #define setreg(regnum,value) asm("move $" #regnum ", %0" : : "r"(value) : "$" #regnum)

    // Move the content of a register to the desired variable
    #define reg2var(regnum,var) asm("sw $" #regnum ", %0" : "=m"(*var) : : "memory")

>  BTW, how about adding support for opcodes you are interested in to 
> binutils instead?  It would make interfacing them to GCC much easier.

The CPU I'm working on will never "exist"... I'm just simulating it
as VHDL code, so I just needed a quick-and-dirty way of generating
inside my very short test programs the new opcodes added as an extension.

Thanks to all for your precious support!

Cheers and regards,

         Fabrizio


-- 
============================================
    Fabrizio Fazzino - fabrizio@fazzino.it
      Fazzino.IT - http://www.fazzino.it
============================================

      reply	other threads:[~2005-07-09  7:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 17:53 Assembly macro with parameters Fabrizio Fazzino
2005-04-07 18:25 ` Ralf Baechle
2005-04-08 16:47   ` Fabrizio Fazzino
2005-04-08 16:57     ` Daniel Jacobowitz
2005-06-30 17:20       ` Fabrizio Fazzino
2005-06-30 17:32         ` David Daney
2005-07-01  8:38         ` Maciej W. Rozycki
2005-07-03 10:31           ` Fabrizio Fazzino
2005-07-04  7:40             ` Geert Uytterhoeven
2005-07-04 12:12             ` Maciej W. Rozycki
2005-07-09  7:22               ` Fabrizio Fazzino [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=42CF7B20.5010101@fazzino.it \
    --to=fabrizio@fazzino.it \
    --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