public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Chris Friesen <cfriesen@nortel•com>
To: Benjamin Herrenschmidt <benh@kernel•crashing.org>
Cc: linuxppc-dev list <linuxppc-dev@ozlabs•org>
Subject: Re: somewhat OT -- trying to build code on the fly then run it
Date: Tue, 05 Apr 2005 11:03:44 -0600	[thread overview]
Message-ID: <4252C4F0.5000204@nortel.com> (raw)
In-Reply-To: <1112663005.26086.134.camel@gaston>

Benjamin Herrenschmidt wrote:

> bla can only be used for small addresses (or very high addresses), and
> it doesn't take a register argument but an absolute address. You want
> something different, more like
> 
> 	mtctr %2
> 	bctrl
> 
> Though you also need to add proper "clobber" constraints to indicate to
> the compiler what will be clobbered by the routine you are calling (look
> at the syscall macros of the kernel for an example of rather standard
> clobber lists).


Thanks for the tip.  With those changes, the code runs perfectly.  For 
posterity, the new function looks like this:

int dotest(void *p)
{
         int i=0;
         asm volatile (" \n\
                 mr 3,%1 \n\
		mtctr %2  \n\
		bctrl  \n\
                 mr %0,3 \n"
                 : "=r" (i)
                 : "r" (i), "r" (p)
		: "ctr", "lr");
         return i;
}


The bad news is that it seems to indicate that our kernel code to flush 
the icache doesn't seem to work.  I'll open a new thread for that.

Chris

  reply	other threads:[~2005-04-05 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-04 23:32 somewhat OT -- trying to build code on the fly then run it Chris Friesen
2005-04-05  1:03 ` Benjamin Herrenschmidt
2005-04-05 17:03   ` Chris Friesen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-04-05 15:08 Fillod Stephane
2005-04-05 16:43 ` Chris Friesen

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=4252C4F0.5000204@nortel.com \
    --to=cfriesen@nortel$(echo .)com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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