[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Loadable module support for Petalinux w/MMU?



Hi,

This may not be related, but I ran into a problem with pointers to strings getting clobbered in microblaze uClinux 2.4. I posted to the group about this in June. Basically, there was an array of string pointers and one of them was overlaid by another pointer. At first I thought it was run-time corruption, but this appears to have happened in the conversion process from elf to binflt. If I dumped the .elf object, the array looked OK, but if I dumped the equivalent flat file executable, the array was corrupted.

To get around this, I tracked down the source line that the overlaying pointer represented and changed it from "const unsigned char MyVar = 8;" to "unsigned char MyVar = 8;". I know this doesn't solve what appears to me to be the actual problem, but no one else seems to have reported problems of this type. Rod Campbell
Steven Hein wrote:
John Williams wrote:
Hi Steve,

Steven Hein wrote:

Does anyone have loadable kernel module support working in
the Petalinux w/ the Microaze MMU enabled? I tried to build
the kernel with module support enabled, and I got this
compile error:

This was discussed a couple of months ago, and I posted a patch. It will be in the archives, but let us know if you are unable to track it down.

cheers,

Thanks John, I found it.

After applying the patch, the printk's work.....however, I am now
having troubles with strings that are statically initialized in a
structure.     Here's a simple example:



#include <linux/module.h>
#include <linux/types.h>

static struct attribute tstattr = { .name = "tstattr", .mode = 0654, .owner = THIS_MODULE };

static void __exit
hello_exit (void)
{
       return;
}

static int __init
hello_init (void)
{
       printk ("name=|%s| mode=0%o\n", tstattr.name, tstattr.mode);

       return 0;
}

module_init (hello_init);
module_exit (hello_exit);


When I load this module (compiled with mb-linux-gcc), I see:

# insmod /tmp/hello.ko name=|hello| mode=0654

The value of tstattr.name is printed as "hello", not as "tstattr"
which it should be!
(Note that the string I see within the |'s varies depending on the
complexity of the loadable module.    The original problem I
was trying to debug was problems creating a sysfs file.    Based
on the output in those cases, I could see that this isn't a simple
printk problem, but a problem with the initialization of the
string.)


Can anyone offer any insight into this type of problem?

Thanks,
Steve



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/