From: Sam Ravnborg <sam@ravnborg.org>
To: David Miller <davem@davemloft.net>
Cc: linux-arch@vger.kernel.org
Subject: Re: Do we use runtime patching of function calls somewhere?
Date: Sun, 13 May 2012 20:45:38 +0200 [thread overview]
Message-ID: <20120513184537.GA2434@merkur.ravnborg.org> (raw)
In-Reply-To: <20120513.143229.1966847219427517224.davem@davemloft.net>
On Sun, May 13, 2012 at 02:32:29PM -0400, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Sun, 13 May 2012 14:16:00 +0200
>
> > I could try to come up with something myself - but if we already
> > have it somewhere maybe there is something to be inspired by.
>
> You could relocatable link, record all the R_SPARC_WDISP30 relocations
> into a special data file (which you'd link into vmlinux), then provide
> a stub version of all the routines.
>
> At run time you walk through the relocations and resolve them just as
> the linker or the module loader would.
>
> But I wouldn't do this, it's hairy with modules etc.
>
> Instead, I'd do for these routines what sparc64 does, which is patch
> the actual code.
>
> You have a base implementation which is at least as large as the
> largest implementation which exists. Then you simply copy the
> instructions over from the implementation you want to use. All
> branches must be relative and be to destination only within the
> routine itself, otherwise you'd have to fixup their offsets since the
> necessary branch displacement changes once you move the instruction
> from one place to another.
That makes sense - then we do not need to search for the callers etc.
And we can use the base implemntation as the default case.
But I need to brush up my sparc assembler skills a bit first,
I'm afraid.
I will put this on my todo list as this would be good to
have, but I will postpone the idea for now.
Sam
next prev parent reply other threads:[~2012-05-13 18:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-13 12:16 Do we use runtime patching of function calls somewhere? Sam Ravnborg
2012-05-13 14:29 ` Matthew Wilcox
2012-05-13 18:28 ` David Miller
2012-05-13 17:44 ` Mike Frysinger
2012-05-13 18:32 ` David Miller
2012-05-13 18:45 ` Sam Ravnborg [this message]
2012-05-13 20:01 ` David Miller
2012-05-14 16:56 ` Sam Ravnborg
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=20120513184537.GA2434@merkur.ravnborg.org \
--to=sam@ravnborg.org \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.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