[BusyBox] Re: BusyBox insmod problem. Global variables badly initialized.
Matthias Fuchs
matthias.fuchs at esd-electronics.com
Wed May 8 04:01:04 UTC 2002
Hi Christian,
I think I encountered the same problem. Did you hear about a workaround ?
Matthias
Christian Grigis wrote:
> Hello,
>
> On Thu Mar 28 01:28:05 2002, <Frederic.Goddeeris at siemens.atea.be> wrote:
>
>>Hi,
>>
>>I have been struggling with global variables that are not always correctly
>>initialized in kernel modules and have been posting reports to ppclinux-dev
>>about this.
>>
>>Somebody reported that he had seen the same issue while somebody else
>>reported he could not reproduce the problem. Today I discovered that when I
>>use the original insmod instead of the insmod in Busybox the issue seems
>>solved...
>>
>>This is the modules I used for testing:
>>
>>#include <linux/module.h>
>>#include <linux/kernel.h>
>>#include <linux/init.h>
>>
>>char MyMemSpace[2*0x100];
>>char *MemPointers[2] = {&(MyMemSpace[0]), &(MyMemSpace[0x100])};
>>
>>typedef struct
>>{
>> char *szName;
>> char *szName2;
>>} MyStruct_t;
>>
>>MyStruct_t MyStruct[] = {{"A", "A2"}, {"B", "B2"}};
>>
>>int init_module(void)
>>{
>> printk("TestDriver 3 Loaded\n");
>>
>> printk("MyMemSpace: 0x%lx 0x%lx \n", (long)&(MyMemSpace[0]),
>> (long)&(MyMemSpace[0x100]));
>> printk("MemPointers: 0x%lx 0x%lx \n", (long)(MemPointers[0]),
>> (long)(MemPointers[1]));
>>
>> printk("First Char is MyStruct[0].szName %c\n",
>> MyStruct[0].szName[0]);
>>
>>
>> return -1;
>>}
>>
>>void cleanup_module(void)
>>{
>> return;
>>}
>>
>>With insmod of busybox I get:
>> MyMemSpace: 0xc304a1ec 0xc304a2ec
>> MemPointers: 0xc304a1ec 0xc304a3ec
>> First Char is MyStruct[0].szName e
>>
>>With the regular insmod I get:
>> MyMemSpace: 0xc304226c 0xc304236c
>> MemPointers: 0xc304226c 0xc304236c
>> First Char is MyStruct[0].szName A
>>
>>I use HHL2.0 (2.4.2), gcc 2.95.3, Busybox 0.60.2
>>
>>Can somebody help me solving this issue?
>>
>>Thanks,
>>Frederic
>>
>
>
> I have been having the exact same problem on a similar environment (HHL2.0 PPC
> w/kernel 2.4.2, gcc 2.95.3, latest CVS busybox), and also noticed that the
> char pointers in a global struct were resolved correctly only with the
> standard insmod from modutils, but not with BusyBox's insmod.
>
> Does anyone have more information about this? Is it a problem with BusyBox's
> insmod or the kernel I am using?
>
> Thank you very much for any help.
>
> Regards,
>
> -Christian
>
>
--
-------------------------------------------------------------------------
_/_/_/_/ Matthias Fuchs
_/_/_/_/ Dipl.-Ing.
_/_/_/_/ matthias.fuchs at esd-electronics.com
_/_/_/ _/_/_/_/_/_/_/ esd electronic system design gmbh
_/ _/ _/ _/ Vahrenwalder Str. 207
_/ _/ _/_/_/ _/ _/ D-30165 Hannover
_/ _/ _/ _/ Phone: +49-511-37298-0
_/_/_/_/_/_/_/ _/_/_/ Fax: +49-511-37298-68
-------------------------------------------------------------------------
More information about the busybox
mailing list