[BusyBox] Re: BusyBox insmod problem. Global variables badly initialized.
Christian Grigis
christian.grigis at smartdata.ch
Mon Apr 15 02:19:03 UTC 2002
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
--
Christian Grigis | SMARTDATA SA
Software Engineer | PSE-A / EPFL
Phone: +41-21-693-84-98 | CH - 1015 Lausanne
mailto:christian.grigis at smartdata.ch | http://www.smartdata.ch
More information about the busybox
mailing list