It is currently Mon, 04 Mar 2024 02:19:44 GMT

Author Message
 debian, m68k: HELP PROBLEM: global register variable follows a function definition
Hi group

I would really like som help to solve this puzzle:

I'm trying to compile a driver as a loadable module, for the debian woody
distribution which uses kernel 2.2.20.
My platform is a Motorola VME16x with Motorola 68k processor.

Installing the woody distribution caused no problems.

Next I installed the kernel source package "kernel-source-2.2.20", the
kernel patch "kernel-patch-2.2.20-m68k"
Unpacked the stuff. Patched the kernel, transferred the config. Configured
the kernel "make menuconfig",   compiled the modules and kernel (make dep,
make modules, make bzImage)  ... not that I needed doing that, but it shows
that the sources have some integrity :-)

... all went well..

Now I'm trying to my  loadable module "chardev.c" which is just a skeleton
character driver.  I compile from my development path

gcc -Wall -Wstrict-prototypes -O -DMODULE -D__KERNEL__ -fomit-frame-pointer
-I/usr/src/kernel-source-2.2.20/include -c chardev.c
In file included from
                 from /usr/src/kernel-source-2.2.20/include/linux/mm.h:4,
                 from /usr/src/kernel-source-2.2.20/include/linux/slab.h:14,
                 from chardev.c:31:
/usr/src/kernel-source-2.2.20/include/asm/current.h:4: global register
variable follows a function definition

On the net I've found other cases with this error. They were suggested to
use other CFLAGS.  I've tried those - and also the flags used when I issue
the make modules... no luck!.

The source which I sucessfully can compile and install on my RedHat 7.2 i386
installation is not the cause of the problem.
If I patch the current.h file in the kernel source, removing the register
declaration, the module compiles successfully. It can also be installed
and will do most things with no problems. Access to hardware, ioctl, read,
write and all works perfectly.

BUT, when I try to use the current pointer to access the task structure of
my task I get a segmentation failure. (I do this indirectly by calling
sleep_on_interrupible() )
It turns out that the current pointer is NULL. ... just removing  "register"
in "current.h" doesn't solve the problem.

Can anybody please help..

 / Bo

My makefile:

CFLAGS= -D__KERNEL__ -DMODULE -I/usr/src/kernel-source-2.2.20/include -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer  -pipe -fno-strength-reduce -ff

chardev.o: chardev.c /usr/include/linux/version.h
 $(CC) $(CFLAGS) $(INCL) -c chardev.c

.. I  didn't include the source - I can't compile any modules..

 Wed, 03 Nov 2004 01:24:35 GMT   
   [ 1 post ] 

Similar Threads

1. Global register variables in C with Sparc

2. gcc and global register variables

3. Accessing global variables from shared/dynmaic functions.

4. SPARC libthread problem with global registers (LONG)

5. file contents into variable, or global variable from shell script

6. static functions in library matching global functions

7. Problems with Elf and Global variables

8. Problems with shared libraries and external global variables

9. Help: Register variable access with ptrace in SunOS 4.1.x

10. Trident sound driver - global registers not restored

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software