Linux-Development-Sys Digest #789, Volume #8 Fri, 15 Jun 01 00:13:14 EDT
Contents:
problem with adding a system call (Thomas)
Want to create "task" in kernel (Jerry Walden)
Re: net_device driver (skb...) (Michael)
Off Topic: Human Decadence, please read (Daniel Clemente)
Re: pause the bootup (Mike McDonald)
Slab allocator question ([EMAIL PROTECTED])
how to do a boot floppy for RH6.2 with reiserfs? ("gdm")
Linux Device Driver Sample Code Problem (john f. davis)
Re: Linux Device Driver Sample Code Problem
Re: Shared memory RDONLY question (Rob Yampolsky)
Re: Off Topic: Human Decadence, please read (Micah Cowan)
PCI device register access (Kaelin Colclasure)
Re: Off Topic: Human Decadence, please read (Erik Max Francis)
Re: where is this kernel code?
Re: PCI device register access ("Lee Ho")
Re: PCI device register access
Re: Want to create "task" in kernel ("Lee Ho")
Kickstart from within Linux? (Wilfred Dee)
----------------------------------------------------------------------------
From: Thomas <[EMAIL PROTECTED]>
Subject: problem with adding a system call
Date: Thu, 14 Jun 2001 17:56:51 -0400
I tried to add a system call to my kernel.
This is what I did :
In /usr/src/linux/include/asm/unistd.h :
I add " #define __NR_show_mult 222 "
In /usr/include/asm/unistd.h I did the same.
In /usr/src/linux/arch/i386/kernel/entry.S :
I add " .long SYMBOL_NAME(sys_show_mult) "
In /usr/src/linux/kernel/sys.c : I add the code of the new system call
asmlinkage int sys_show_mult(int x,int y, int *res)
{
int error;
int compute;
error=verify_area(VERIFY_WRITE,res,sizeof(*res));
if(error)
return error;
compute= x*y;
put_user(compute,res);
printk("Value computed : %d x %d = %d \n, x,y, compute");
return 0;
}
And this is the test programm which use the system call :
#include <stdio.h>
#include <stdlib.h>
#include <linux/unistd.h>
_syscall3(int, show_mult,int, x, int , y, int *, resul);
main()
{
int ret = 0;
show_mult(2,3,&ret);
printf("Resultat %d %d = %d \n",2,3,ret);
}
Everything seems to be OK but when I try to use the system call it does
nothing and the return code is '18'.
Could anyone help me ? I think the problem is in entry.S.
Thanks a lot
Thomas (France)
------------------------------
From: [EMAIL PROTECTED] (Jerry Walden)
Subject: Want to create "task" in kernel
Date: 14 Jun 2001 09:22:00 -0700
Greetings:
I need to create 4 "tasks" in the kernel, and have those "tasks"
"wait" on whatever the kernel equivalent is of a semaphore.
I want to do this because I writing some driver level code that needs
to run in the kernel to avoid context switches between user space, and
kernel space.
Is there an example in some existing part of the kernel (or some
other open-source project) that shows how I might do this?
Any assistance is greatly appreciated!!
Thanks!
------------------------------
From: Michael <[EMAIL PROTECTED]>
Subject: Re: net_device driver (skb...)
Date: Thu, 14 Jun 2001 18:24:59 +0200
Ok, i've got it.
First i tried to set the hardware-address manually to all tx-packets and
disabled ARP. Everything worked fine (IP-stuff)! Switching back using
ARP, nothing happened.
I solved the problem by not using `eth_type_trans'. Instead i set
`skb->pkt_type' and `skb->protocol' manually
and at last: `skb_pull( skb, ETH_HLEN )'.
Nothing ARP-specific...
I don't know, why `eth_type_trans' didn't work.
Do you?
Michael
------------------------------
From: Daniel Clemente <[EMAIL PROTECTED]>
Crossposted-To:
comp.os.linux.development.apps,comp.os.linux.development.x,linux.redhat.misc,linux.redhat.ppp,linux.redhat.rpm
Subject: Off Topic: Human Decadence, please read
Date: Thu, 14 Jun 2001 19:02:15 +0200
Hi all,
First of all, sorry if this is an Off Topic, message, but, please read it.
I receive an message, request me to attack an email.
The cause, well, from whose who know spanish, please read at the bottom
of the message, for others:
The are a person who sell "cat in a bottle" (I don't write bad, cat
inside a bottle), and they are "ALIVE".
He put inside a bottle, connect a fathoms for extract the waste, and
other for give it some chemical, to keep it alive, and to make the bones
get adapted to the bottle.
Then he sell it, and distribute around the world.
I don't know you, but for me this is not my favorite pet.
Anyone as I think that we must attack him
This is him website:
http://www.bonsaikitten.com/
and this is the webmaster mail:
[EMAIL PROTECTED]
>El mensaje en cuesti�n es para recoger firmas y chaparle el
>negocio
>a un cabronazo japon�s que vende gatos embotellados
>(���vivos!!!) y lo peor es que lo esta poniendo de moda (en los
>USA claro, donde iba a ser).
>
>El tipo mete gatos beb�s en botellas de vidrio les mete una
>sonda por el ano que tiene una salida fuera de la botella para
>deshacerse de la orina y materia fecal, para que los gatos tomen
>la forma de la botella. Se les alimenta con qu�micos para
>ablandarles los huesos, ah� los mantienen por el tiempo que
>logra el gato sobrevivir a esta tortura, no puede moverse, ni
>caminar, ni limpiarse, es realmente una crueldad pero es algo que
>se est� poniendo muy de moda en N.Y., China,Indonesia y Nueva
>Zelanda porque es una \"mascota adorno\". Si quieren m�s
>informaci�n entren a: .
>
>Lo que se busca es recaudar firmas para mandarlas a la sociedad
>protectora de animales en Estados Unidos y M�xico, al maldito
>japon�s y a > los noticieros para evitar que este abuso se siga
>cometiendo. Les agradezco > su inter�s, les pido que lo reenv�en
>a otras personas que amen a los gatos > o que respeten la vida
>de cualquier ser vivo, que agreguen su nombre a la > lista y
>env�enlo nuevamente. �c�mo hacerlo? marca con el mouse todo este
>texto, le das ctrl+C (copiar) y lo pegas ctrl+V en el mail
>que vas a enviar > a tu lista de correo y te agregas al final de
>la lista.
>
>P.D: no es ninguna broma, la p�gina donde se ofrecen
>estas mascotas es:
>http://www.bonsaikitten.com/
>
>Mi consejo personal es petarle el correo al hijoputa �ste.
>
>Aqu� lo ten�is:
>[EMAIL PROTECTED]
>
------------------------------
Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Mike McDonald)
Subject: Re: pause the bootup
Date: Thu, 14 Jun 2001 17:42:29 GMT
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Aravindh) writes:
> i am running on a proprietary system not a regular pc.
> problem with dmesg and ctrl-pageup is that i need to boot into linux
> to do all that. the system crashes way before that and i am unable to
> see the messages. that is why i need some code in the kernel which
> flushes the buffer or a "getchar()" which pauses execution of the
> kernel. any idea how to do this?
>
> aravindh
If your system has a serial port, try configuring your kernel for a serial
console. Also, change the printk buf to not be static so you can look to see
what's in it after the kernel has crashed. (assuming you have some kind of
debugger that can dump memory as text.)
Mike McDonald
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED]
Subject: Slab allocator question
Date: Thu, 14 Jun 2001 14:12:24 -0400
Is it posssible to have two different modules access the same slab
allocator -or- is it possible to check if a slab by a particular name
exists when a module is started and then use it. Say a module crashes
and you want to reload it without rebooting the system but your slab
allocator still exists.
I thought it was possible to create slabs using the same name but a
check is done when a slab is created to see if a slab by the same name
exists. Unfortunately it calls BUG() if a name already exists instead
of returning the pointer to the existing slab allocator.
Thanks for any help.
------------------------------
From: "gdm" <[EMAIL PROTECTED]>
Subject: how to do a boot floppy for RH6.2 with reiserfs?
Date: Thu, 14 Jun 2001 20:29:43 +0200
how to do a boot floppy for RH6.2 with reiserfs?
gdm
------------------------------
From: [EMAIL PROTECTED] (john f. davis)
Subject: Linux Device Driver Sample Code Problem
Date: 14 Jun 2001 11:22:55 -0700
Hello
I am trying to use the sample code which accompinies the book "Linux Device
Drivers" by Rubini. I am using the updated beta copy with a linux 2.2.18 kernel.
When I issued make at the top of the example code source tree, I get a build
break in the scullp directory because mmap.c line 84 uses a member vm_pgoff
which doesn't exist. I didn't think this would be a problem since, I am
just trying to compile the simplier scull example for chapter 3.
Anyhow, the build completed for the scull directory, but when I try to insert
the module using scull_load script I get an error.
./scull.o unresolved symbol scull_remove_proc
I have no idea why this error occurs. Any help would be appreciated.
Thanks
John
------------------------------
From: [EMAIL PROTECTED] ()
Subject: Re: Linux Device Driver Sample Code Problem
Date: Thu, 14 Jun 2001 19:38:42 -0000
In article <[EMAIL PROTECTED]>,
john f. davis <[EMAIL PROTECTED]> wrote:
>./scull.o unresolved symbol scull_remove_proc
>
>I have no idea why this error occurs. Any help would be appreciated.
The kernel probably has module versioning turned on and your module
compile doesn't.
--
http://www.spinics.net/linux/
------------------------------
From: Rob Yampolsky <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.aix,comp.unix.programmer
Subject: Re: Shared memory RDONLY question
Date: Thu, 14 Jun 2001 17:52:54 -0400
> Yet another option altogether would be to use the new POSIX shared
> memory API. You use shm_open() to open a named shared memory segment,
> which returns a fd that you can then mmap(). As that mapping *is*
> established by mmap(), mprotect() should work in this case even
> according to POSIX ... (However, the question is whether all
> platforms you want to use have implemented POSIX shared memory already.)
>
There's no man page for shm_open on AIX3.2.5 or AIX4.3. Then again,
there's no man page for it on my Linux 2.2 system either.
In the meantime, I've kludged this by writing a ProtectSharedMemory()
function that shmdt/shmat's the segment whenever the app needs to change
the read/write permissions. Works fine, but probably not the most
efficient thing around. Still, mprotect's got to cost something, and I
don't notice a performance hit (yet).
------------------------------
Crossposted-To:
comp.os.linux.development.apps,comp.os.linux.development.x,linux.redhat.misc,linux.redhat.ppp,linux.redhat.rpm
Subject: Re: Off Topic: Human Decadence, please read
From: Micah Cowan <[EMAIL PROTECTED]>
Date: 14 Jun 2001 16:28:46 -0700
Daniel Clemente <[EMAIL PROTECTED]> writes:
> Hi all,
>
> First of all, sorry if this is an Off Topic, message, but, please
> read it.
There is no justification, ever, for posting messages as off-topic as
this one.
The website you refer to is a hoax. You've been had.
Micah
------------------------------
From: Kaelin Colclasure <[EMAIL PROTECTED]>
Subject: PCI device register access
Date: 14 Jun 2001 18:15:58 -0700
I am taking my first crack at writing a HW device driver, and I am a little
confused over the distinction between IO mapping and memory mapping of my
PCI card's register space.
At the moment, my interpretation of the HW spec leads me to believe this
particular PCI device maps its registers both into IO space and into PCI
memory. Is that typical? [If it matters, the card is a Symbios SCSI host
controller.]
Assuming the registers *can* be accessed either way, would it not make
sense to prefer the memory mapped access, as that is supported on all
platforms? And if the answer to this rhetorical-looking question is
indeed ``yes'' then why do none of the existing drivers I've looked at
do it this way? Every single driver seems instead to define its own
private set of inb/inw/inl and outb/outw/outl macros, to handle making
memory references on platforms with no IO space and byte-swapping on
big-endian platforms. Is this just an artifact of their age/heritage?
And finally, if the practice above is so common, why doesn't Linux have
a standard set of macros for this somewhere? [Or why don't people use
them?]
-- Kaelin
------------------------------
From: Erik Max Francis <[EMAIL PROTECTED]>
Crossposted-To:
comp.os.linux.development.apps,comp.os.linux.development.x,linux.redhat.misc,linux.redhat.ppp,linux.redhat.rpm
Subject: Re: Off Topic: Human Decadence, please read
Date: Thu, 14 Jun 2001 18:55:56 -0700
Daniel Clemente wrote:
> Anyone as I think that we must attack him
>
> This is him website:
>
> http://www.bonsaikitten.com/
>
> and this is the webmaster mail:
>
> [EMAIL PROTECTED]
You, sir, are a retard.
--
Erik Max Francis / [EMAIL PROTECTED] / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Ten lands are sooner known than one man.
\__/ (a Yiddish proverb)
Esperanto reference / http://mirror/alcyone/max/lang/esperanto/
An Esperanto reference for English speakers.
------------------------------
From: <[EMAIL PROTECTED]>
Subject: Re: where is this kernel code?
Date: Thu, 14 Jun 2001 19:32:25 -0700
And RedHat puts it into rc.sysinit. I believe in either case, that reading
and studying the contents of /etc/inittab will lead you understanding what
happens when a Linux system starts up. Please feel free to try to analyze
inittab and describe any of its statements that you don't understand how
they work.
"Peet Grobler" <peetgr at absa.co.za> wrote in message
news:3b287a28$0$[EMAIL PROTECTED]...
> That's in your startup script. Which distro are you using? Mandrake stuffs
> this in /etc/rc.d/rc iirc.
>
> Aravindh wrote in message ...
> >hi,
> >
> >i was looking for the code in the kernel where it displays "Press 'I'
> >to enter interactive..." and I am just not able to find it. Also where
> >is the code once the system goes into interactive mode. For ex - where
> >is the code for "Start service kudzu (Y)es/(N)o/(C)ontinue?"
> >
> >thanks
> >aravindh
>
>
>
------------------------------
From: "Lee Ho" <[EMAIL PROTECTED]>
Subject: Re: PCI device register access
Date: Fri, 15 Jun 2001 02:48:13 GMT
Kaelin Colclasure Wrote:
>I am taking my first crack at writing a HW device driver, and I am a little
>confused over the distinction between IO mapping and memory mapping of my
>PCI card's register space.
>
>At the moment, my interpretation of the HW spec leads me to believe this
>particular PCI device maps its registers both into IO space and into PCI
>memory. Is that typical? [If it matters, the card is a Symbios SCSI host
>controller.]
Yes. PCI device can have PCI I/O space and PCI memory space, and
typically use I/O space for register, and memory space for data.
But many device map their register into memory space. Perhaps
Symbios SCSI host controller (like LSI Logic NCRxxxx) maps register into
I/O space, and script area into memory space.
>Assuming the registers *can* be accessed either way, would it not make
>sense to prefer the memory mapped access, as that is supported on all
>platforms? And if the answer to this rhetorical-looking question is
>indeed ``yes'' then why do none of the existing drivers I've looked at
>do it this way? Every single driver seems instead to define its own
>private set of inb/inw/inl and outb/outw/outl macros, to handle making
>memory references on platforms with no IO space and byte-swapping on
>big-endian platforms. Is this just an artifact of their age/heritage?
It's just the choice of the hardware developer. And AFAIK, I/O space is
mapped into memory area in which system does not support I/O port,
so it doesn't make problem.
>And finally, if the practice above is so common, why doesn't Linux have
>a standard set of macros for this somewhere? [Or why don't people use
>them?]
Linux defines standard APIs. There is inb()/inw()/inl() and oub()/outw()/outl()
for accessing I/O space, ioremap() function for mapping I/O memory space
into virtual memory, and readb()/readw()/readl()/readq(),
writeb()/writew()/writel()/writeq()
for accessing memory space.
>-- Kaelin
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to
------------------------------
From: <[EMAIL PROTECTED]>
Subject: Re: PCI device register access
Date: Thu, 14 Jun 2001 19:52:06 -0700
Dear Kaelin:
Well, I'll try a crack at your question. First of all, we have to be
able to accept chips designed by various companies that we cannot change.
They just are. Many of these chips use the concept of either memory or IO
accesses or both. All processors that connect to PCI devices *must* use the
paradigm of both IO and memory space access. This is native for the 386
architecture. For say, MIPS, PPC, ARM or others which only have the concept
of memory space, they use bridge chips that map memory accesses (read and
write) to IO port accesses (in port and out port) at particular memory
locations.
I don't think I would say that every driver uses its own set of in/out
macros, but they may if they wish and some do. Most of the ones that I have
looked at do eventually resolve to the system in and out subroutines or
macros, but they ususally have the offset of the PCI device BAR (Base
Address Register) for IO access added to the argument to the in/out macro.
Thats the reason you see many unique named macros around the sources. They
are usually just adding the appropriate BAR contents as an offset. The BIOS
and OS are free to load the memory BAR's and the IO BAR's with any contents
they wish that don't conflict with other system enumerated resources. In
fact the BAR itself has a bit (bit 0 as a matter of fact), that indicates
whether or not this BAR is a memory access BAR or an IO access BAR.
PCI configuration itself depends on two IO port accesses. When the
typical PCI device is powered up, it has no contents to its BAR's and the
CPU uses two IO ports (usually CF8h and CFCh) to perform type 1
configuration space accesses via IO and read and set the contents of various
important registers in each PCI device such as the vendor ID, device ID,
which must be read to successfully do a pci_find_device. The command and
status register to determine the chips capabilities and enable IO access,
memory access or both.
Some chips must have both IO and memory space. The VGA controller and
its derivatives has IO port accesses at the typical VGA IO port addresses of
3C4/3C5 and others and also must have a memory mapped area for its video
buffer. Others, such as modern IDE controllers have both the traditional PIO
ports at 1F0-1F7 and may have DMA access to memory.
The book "PCI System Archtecture" is really good at explaining how PCI
devices work. You might want to pick up a copy of it if you wish to get
deeper into PCI.
"Kaelin Colclasure" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> I am taking my first crack at writing a HW device driver, and I am a
little
> confused over the distinction between IO mapping and memory mapping of my
> PCI card's register space.
>
> At the moment, my interpretation of the HW spec leads me to believe this
> particular PCI device maps its registers both into IO space and into PCI
> memory. Is that typical? [If it matters, the card is a Symbios SCSI host
> controller.]
>
> Assuming the registers *can* be accessed either way, would it not make
> sense to prefer the memory mapped access, as that is supported on all
> platforms? And if the answer to this rhetorical-looking question is
> indeed ``yes'' then why do none of the existing drivers I've looked at
> do it this way? Every single driver seems instead to define its own
> private set of inb/inw/inl and outb/outw/outl macros, to handle making
> memory references on platforms with no IO space and byte-swapping on
> big-endian platforms. Is this just an artifact of their age/heritage?
>
> And finally, if the practice above is so common, why doesn't Linux have
> a standard set of macros for this somewhere? [Or why don't people use
> them?]
>
> -- Kaelin
>
------------------------------
From: "Lee Ho" <[EMAIL PROTECTED]>
Subject: Re: Want to create "task" in kernel
Date: Fri, 15 Jun 2001 02:54:29 GMT
Jerry Walden Wrote:
>Greetings:
>
> I need to create 4 "tasks" in the kernel, and have those "tasks"
>"wait" on whatever the kernel equivalent is of a semaphore.
>
> I want to do this because I writing some driver level code that needs
>to run in the kernel to avoid context switches between user space, and
>kernel space.
use kernel_thread(). kernel_thread() creates kernel thread. kernel thread
is one of the process which runs in the kernel mode. It can call kernel
functions and system call also.
> Is there an example in some existing part of the kernel (or some
>other open-source project) that shows how I might do this?
You can find the code using kernel thread in the init/main.c.
I found thread controlling example in the http://www.scs.ch/~frey/linux/
and http://linuxkernel.to/klib/download/klib.tar.gz
> Any assistance is greatly appreciated!!
>
> Thanks!
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to
------------------------------
From: [EMAIL PROTECTED] (Wilfred Dee)
Subject: Kickstart from within Linux?
Date: 14 Jun 2001 20:56:13 -0700
Is there any way possible to start Kickstart from within Linux? The
reason I ask is because I need to run a script that determines some
system information which is used to start Kickstart with a particular
config file. I have to do it this way because I need to retrieve some
information stored in the Non Volatile RAM and use that to determine
which Kickstart config file to use. In the past I used a DOS boot
disk and ran a script which in turn ran loadlin with the appropriate
config file to start the Kickstart process. Is it possible to start
Kickstart from within Linux? If not, is there any other way to work
around the problem?
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************