Re: Develop an assembler module

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

 



On Tue, Aug 23, 2005 at 18:23:23 +0200, Garcia Jérémie wrote:
> Hi everybody, 
> some will find this question stupid for sure but as a kernel newbie, I need some help please.
> I'd like to develop a module which will be able to execute assembler code.
> What I'd like to do is to have in this module a number of ioctl which will allow a user space program to 
> launch some assembler code to act on our hardware.
> 
>   USER_SPACE_PROG    ---->     KERNEL MODULE     ---->    ASSEMBLER_FILE
> ioctl(fd, FUNC1,arg)         my_ioctl get the           definition of FUNC1
>                           function to call :FUNC1

I hope you didn't mean you pass the actual code via the ioctl...

> So how do I have to compile the module file (.c) and the assembler file (.S) : separatly or not? with what compile options?
> Cause if I declare in my "module.c" the assembler function as "extern" how the link is done?
> Please give some clues cause I do not have much time to achieve this...

Gcc compiles C to assembly. From which point they are both treated the same.

Now each assembly is assembled to object separately. It is always the case,
even if you call gcc with multiple source arguments. So there is no question
there.

The options are the same as when compiling C. Some options could be omitted,
as they apply to the compilation proper, but gcc will ignore them if you pass
them, so you can just pass the same options to all sources.

As they are different sources, you need to declare symbols you need from the
other as extern. Note, that extern on function declaration has no effect, as
function declarations are extern by default.

There is a bunch of assembly sources in kernel sources, in the arch
directory, so have a look how the kernel Makefile handles them and how the
symbols from them are accessed.

--
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux