From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265124AbUHWPeJ (ORCPT ); Mon, 23 Aug 2004 11:34:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265237AbUHWPbB (ORCPT ); Mon, 23 Aug 2004 11:31:01 -0400 Received: from chaos.analogic.com ([204.178.40.224]:57474 "EHLO chaos.analogic.com") by vger.kernel.org with ESMTP id S265124AbUHWPVh (ORCPT ); Mon, 23 Aug 2004 11:21:37 -0400 Date: Mon, 23 Aug 2004 11:20:36 -0400 (EDT) From: "Richard B. Johnson" X-X-Sender: root@chaos Reply-To: root@chaos.analogic.com To: Lei Yang cc: Lee Revell , Sam Ravnborg , Kernel Newbies Mailing List , linux-kernel Subject: Re: Problems compiling kernel modules In-Reply-To: <412A077C.1080501@nec-labs.com> Message-ID: References: <4127A15C.1010905@nec-labs.com> <20040821214402.GA7266@mars.ravnborg.org> <4127A662.2090708@nec-labs.com> <20040821215055.GB7266@mars.ravnborg.org> <4127B49A.6080305@nec-labs.com> <1093121824.854.167.camel@krustophenia.net> <4129FAC8.3040502@nec-labs.com> <412A01AC.5020108@nec-labs.com> <412A077C.1080501@nec-labs.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Aug 2004, Lei Yang wrote: > Richard B. Johnson wrote: > > On Mon, 23 Aug 2004, Lei Yang wrote: > > > > > >>Richard B. Johnson wrote: > >> > >> > >>>Do `depmod -e test.ko` to see what it's complaining about. You > >>>can see all the symbols by using `nm`. Try it. Your code > >>>probably didn't define the necessary stuff to make a module. > >>>You need to look at a typical module (driver) that comes with the > >>>kernel. Just find one of the shortest ".c" files in the driver > >>>tree. > >> > >>Thanks! I did less /var/log/messages, and got the unknown symbols > >>Unknown symbol __divsf3 > >>Unknown symbol __fixsfsi > >>Unknown symbol __subsf3 > >>Unknown symbol __floatsisf > >>Unknown symbol __mulsf3 > >>Unknown symbol __gesf2 > >>Unknown symbol __addsf3 > >> > >>However, I don't know what those symbols are :( I am a bit worried that > >>maybe I've done something that is not supported by the kernel, like > >>left-shift 16 bits of an int, or floating operations. > >> > >>Any hints? > >> > >>Thanks a lot! > >>Lei > > > > > > You cannot use floating-point in the kernel. It appears that you > > are trying to make user-mode code execute within the kernel. It > > can't. That's not what a module does. The kernel executes code > > on behalf of the user-mode caller, in the context of the caller. > > It does things, on behalf of the user, that the user can't > > be trusted to do properly by himself. That's all the kernel > > is for! Any calculations and similar stuff can be done in > > regular user-mode code. > > Sort of, I am trying to make a usr mode library work with kernel. > However, floating point operation is necessary in the algorithm. You > mean that this can never be done? Is changing floating-point the only > thing I can do now? > > Thanks! > Lei Let's put it this way. If you think you need to use a floating-point library inside the kernel, then you don't understand what the kernel does or what it was designed to do. You should make a module that reads from, or writes to, the special hardware you are using. Then, using user mode code (called a daemon), you read from the device, perform the floating-point processing, then write to the device. That way, you are using the kernel priviliges only for reading/writing to the device. It is possible to execute floating point code within the kernel if the context of the floating-point unit is saved first, and restored after the operation. However, you will never get a math library to work inside the kernel unless you write your own. You cannot use the 'C' runtime library inside the kernel. That library was designed to be outside the kernel (it uses the kernel). > > Cheers, > > Dick Johnson > > Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips). > > Note 96.31% of all statistics are fiction. > > > > > Cheers, Dick Johnson Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips). Note 96.31% of all statistics are fiction.