linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] Support BE8 mode kernel modules relocation
Date: Tue, 18 Jan 2011 15:23:19 +0000	[thread overview]
Message-ID: <AANLkTi=F8_Zmm4OM2=JPMzSWbm0-Nyr4mxSPUNpdBg3N@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=q=e03GhmNZypGa5na2OiAr8SAOtiXm=+NPq5t@mail.gmail.com>

On 18 January 2011 01:22, Stanley.Miao <stanleymiao@gmail.com> wrote:
> 2011/1/17 Catalin Marinas <catalin.marinas@arm.com>:
>> On 17 January 2011 08:42, Stanley.Miao <stanley.miao@windriver.com> wrote:
>>> The code section in BE8 kernel modules is in little-endian while data
>>> section is in big-endian. When reading code from memory in the relocation
>>> procedure, these instructions are read according to big-endian, so they
>>> need to be inverted before writing to memory and after reading from memory.
>> [...]
>>> --- a/arch/arm/include/asm/io.h
>>> +++ b/arch/arm/include/asm/io.h
>>> @@ -233,6 +233,18 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
>>>
>>> ?#endif /* __mem_pci */
>>>
>>> +#ifdef CONFIG_CPU_ENDIAN_BE8
>>> +#define read_instr32(c) ? ? ? ? ? ? ? ? ? ? ? ?__swab32(*(u32 *)c)
>>> +#define read_instr16(c) ? ? ? ? ? ? ? ? ? ? ? ?__swab16(*(u16 *)c)
>>> +#define write_instr32(v,a) ? ? ? ? ? ? (*(u32 *)(a) = __swab32((__force __u32)(v)))
>>> +#define write_instr16(v,a) ? ? ? ? ? ? (*(u16 *)(a) = __swab16((__force __u16)(v)))
>>> +#else
>>> +#define read_instr32(c) ? ? ? ? ? ? ? ? ? ? ? ?(*(u32 *)c)
>>> +#define read_instr16(c) ? ? ? ? ? ? ? ? ? ? ? ?(*(u16 *)c)
>>> +#define write_instr32(v,a) ? ? ? ? ? ? (*(u32 *)(a) = (v))
>>> +#define write_instr16(v,a) ? ? ? ? ? ? (*(u16 *)(a) = (v))
>>> +#endif
>>
>> Can we not use cpu_to_le32 etc in here (and as Russell said, they are
>> not really IO)?
>
> Except moving these definition to arch/arm/kernel/module.c, do I need
> to do other modifications ?

Just personal preference (not important), I'd rather have a "u32
instr" variable set by read_instr32() than this kind of functional
style (in C code, I'm fine with it otherwise):

> +                       write_instr32((read_instr32(loc) & 0xff000000) |
> +                                               (offset & 0x00ffffff), loc);

BTW (not related to modules, but since you are looking at this), when
we copy the sigreturn_codes to the vectors page in early_trap_init(),
do they get there in little endian form (as required by BE8)?

-- 
Catalin

  reply	other threads:[~2011-01-18 15:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17  8:42 [PATCH 0/3] Support BE8 kernel modules relocation Stanley.Miao
2011-01-17  8:42 ` [PATCH 1/3] Support BE8 mode " Stanley.Miao
2011-01-17  8:52   ` Russell King - ARM Linux
2011-01-17  9:56   ` Catalin Marinas
2011-01-18  1:22     ` Stanley.Miao
2011-01-18 15:23       ` Catalin Marinas [this message]
2011-01-19  6:21         ` Stanley.Miao
2011-01-19 17:32           ` Catalin Marinas
2011-01-21  9:39             ` stanley.miao
2011-01-17  8:42 ` [PATCH 2/3] support ARM BE8 mode on a little endian machine Stanley.Miao
2011-01-17 10:01   ` Catalin Marinas
2011-01-17 10:23     ` stanley.miao
2011-01-18  1:24     ` Stanley.Miao
2011-01-17  8:42 ` [PATCH 3/3] Add ARM kernel debug macros for locating the boot problems quickly Stanley.Miao
  -- strict thread matches above, loose matches on Subject: below --
2011-01-19  6:44 [PATCH V2 0/3] Support BE8 kernel modules relocation Stanley.Miao
2011-01-19  6:44 ` [PATCH 1/3] Support BE8 mode " Stanley.Miao
2011-01-21  9:40   ` Stanley.Miao
2011-01-21  9:44   ` Russell King - ARM Linux
2011-01-21 10:11     ` stanley.miao
2011-01-22 17:00       ` Russell King - ARM Linux

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='AANLkTi=F8_Zmm4OM2=JPMzSWbm0-Nyr4mxSPUNpdBg3N@mail.gmail.com' \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).