linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: junxiao.bi@windriver.com (Bi Junxiao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] ARM: support kernel modules in BE8 mode
Date: Tue, 22 Nov 2011 09:32:16 +0800	[thread overview]
Message-ID: <4ECAFBA0.2030001@windriver.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1111211427400.17904@xanadu.home>

on 11/22/2011 03:29 AM Nicolas Pitre wrote:
> On Tue, 15 Nov 2011, Junxiao Bi wrote:
>
>    
>> From: Stanley.Miao<stanley.miao@windriver.com>
>>
>> In BE8 mode, data must be manipulated in big endian format while
>> text must be little endian. Therefore, when relocating the text
>> section of module in BE8 mode, we must convert the location offset
>> of the text to big endian from the native little endian. After
>> the relocation is complete, the location offset value is re-written
>> as little endian.
>>
>> Since only BE8 mode has such special requirement while other big endian
>> mode not, cpu_to_le32 and le32_to_cpu can not be used to relocate the
>> text. We introduce write_instr* and read_instr* to do it.
>>
>> Signed-off-by: Stanley.Miao<stanley.miao@windriver.com>
>> Signed-off-by: Junxiao Bi<junxiao.bi@windriver.com>
>> ---
>>   arch/arm/Makefile         |    1 +
>>   arch/arm/include/asm/io.h |   12 ++++++++++
>>   arch/arm/kernel/module.c  |   51 +++++++++++++++++++++++----------------------
>>   3 files changed, 39 insertions(+), 25 deletions(-)
>>
>> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
>> index dfcf3b0..c858184 100644
>> --- a/arch/arm/Makefile
>> +++ b/arch/arm/Makefile
>> @@ -13,6 +13,7 @@
>>   LDFLAGS_vmlinux	:=-p --no-undefined -X
>>   ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
>>   LDFLAGS_vmlinux	+= --be8
>> +LDFLAGS_MODULE	+= --be8
>>   endif
>>
>>   OBJCOPYFLAGS	:=-O binary -R .comment -S
>> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
>> index 065d100..4b6c7de 100644
>> --- a/arch/arm/include/asm/io.h
>> +++ b/arch/arm/include/asm/io.h
>> @@ -210,6 +210,18 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
>>    * Again, this are defined to perform little endian accesses.  See the
>>    * IO port primitives for more information.
>>    */
>> +#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
>>      
> NAK.  This has nothing to do with IO.
>
> If only module.c requires this, please move those definitions there.
>    
Not only modules, all components that needs to read and write text 
segment like kprobes also needs this. As it is special to arm be8, how 
about define it in arch/arm/include/asm/swab.h?
>
> Nicolas
>
>    

  reply	other threads:[~2011-11-22  1:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15  2:06 [PATCH 1/6] ARM: fix be8 support for phys/virt address conversion Junxiao Bi
2011-11-15  2:06 ` [PATCH 2/6] ARM: gic: fix big endian support Junxiao Bi
2011-11-21 19:11   ` Nicolas Pitre
2011-11-22  1:47     ` Bi Junxiao
2011-11-22  4:10       ` Nicolas Pitre
2011-11-22  5:22         ` Bi Junxiao
2011-11-22 10:33       ` Dave Martin
2011-11-23  2:32         ` Bi Junxiao
2011-11-15  2:06 ` [PATCH 3/6] ARM: early_printk: pl01x: " Junxiao Bi
2011-11-15  2:06 ` [PATCH 4/6] ARM: add big endian support for peripheral access Junxiao Bi
2011-11-15  2:06 ` [PATCH 5/6] ARM: Atomic64: fix 64bit ops in BE mode Junxiao Bi
2011-11-21 19:24   ` Nicolas Pitre
2011-11-15  2:06 ` [PATCH 6/6] ARM: support kernel modules in BE8 mode Junxiao Bi
2011-11-21 19:29   ` Nicolas Pitre
2011-11-22  1:32     ` Bi Junxiao [this message]
2011-11-22  4:17       ` Nicolas Pitre
2011-11-22  5:27         ` Bi Junxiao
2011-11-22 10:47       ` Dave Martin
2011-11-23  3:30         ` Bi Junxiao
2011-11-21  5:44 ` [PATCH 1/6] ARM: fix be8 support for phys/virt address conversion Bi Junxiao
2011-11-21 18:32 ` Nicolas Pitre
  -- strict thread matches above, loose matches on Subject: below --
2011-12-08 10:07 [V2][PATCH 0/6]ARM: fix BE8 mode support Junxiao Bi
2011-12-08 10:07 ` [PATCH 6/6] ARM: support kernel modules in BE8 mode Junxiao Bi

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=4ECAFBA0.2030001@windriver.com \
    --to=junxiao.bi@windriver.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).