All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe LEROY <christophe.leroy@c-s.fr>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/5] powerpc/asm: Add a patch_site macro & helpers for patching instructions
Date: Thu, 09 Aug 2018 19:52:27 +1000	[thread overview]
Message-ID: <877ekzamuc.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <831e6e06-764a-89e8-1d0a-f46c3004d24f@c-s.fr>

Christophe LEROY <christophe.leroy@c-s.fr> writes:
> Le 08/08/2018 =C3=A0 18:30, Christophe LEROY a =C3=A9crit=C2=A0:
>> Le 23/07/2018 =C3=A0 17:07, Michael Ellerman a =C3=A9crit=C2=A0:
...
>>> diff --git a/arch/powerpc/include/asm/code-patching.h=20
>>> b/arch/powerpc/include/asm/code-patching.h
>>> index 812535f40124..b2051234ada8 100644
>>> --- a/arch/powerpc/include/asm/code-patching.h
>>> +++ b/arch/powerpc/include/asm/code-patching.h
>>> @@ -32,6 +32,8 @@ unsigned int create_cond_branch(const unsigned int=20
>>> *addr,
>>> =C2=A0 int patch_branch(unsigned int *addr, unsigned long target, int f=
lags);
>>> =C2=A0 int patch_instruction(unsigned int *addr, unsigned int instr);
>>> =C2=A0 int raw_patch_instruction(unsigned int *addr, unsigned int instr=
);
>>> +int patch_instruction_site(s32 *addr, unsigned int instr);
>>> +int patch_branch_site(s32 *site, unsigned long target, int flags);
>>=20
>> Why use s32* instead of unsigned int* as usual for pointer to code ?
>
> Forget my stupid question, I didn't see it was a relative address and=20
> not an absolute one.

No worries.=20

It is a bit non-obvious at first glance, it looks like the s32 * points
to the instruction. But it points to the s32 that holds the relative
offset from itself, of the instruction.

We could add a typedef to try and make that more obvious, but I
generally don't like typedefs that hide pointerness.

cheers

      reply	other threads:[~2018-08-09  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 15:07 [PATCH 1/5] powerpc/asm: Add a patch_site macro & helpers for patching instructions Michael Ellerman
2018-07-23 15:07 ` [PATCH 2/5] powerpc/64s: Add new security feature flags for count cache flush Michael Ellerman
2018-07-23 15:07 ` [PATCH 3/5] powerpc/64s: Add support for software " Michael Ellerman
2018-07-23 15:07 ` [PATCH 4/5] powerpc/pseries: Query hypervisor for count cache flush settings Michael Ellerman
2018-07-23 15:07 ` [PATCH 5/5] powerpc/powernv: Query firmware " Michael Ellerman
2018-08-08 14:25 ` [1/5] powerpc/asm: Add a patch_site macro & helpers for patching instructions Michael Ellerman
2018-08-08 16:30 ` [PATCH 1/5] " Christophe LEROY
2018-08-09  6:56   ` Christophe LEROY
2018-08-09  9:52     ` Michael Ellerman [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=877ekzamuc.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=christophe.leroy@c-s.fr \
    --cc=linuxppc-dev@ozlabs.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.