Article View: comp.sys.next.programmer
Article #1188Re: Mach messaging to kernel server vs. "traditional" kernel drivers
From: Graham Stoney
Date: Mon, 17 Aug 1992 02:36
Date: Mon, 17 Aug 1992 02:36
47 lines
2987 bytes
2987 bytes
louie@sayshell.umd.edu (Louis A. Mamakos) writes: >I'm designing a loadable kernel server which needs to communicate with >user level processes. I hope you like a real challenge... I'm also writing a kernel server, and it's certianly lots of fun and games. Some of the big suprises I found that weren't mentioned in the "Writing Loadable Kernel Servers" manual were that (at least in 2.1) only the superuser can send out-of-line messages to a kernel server%, and that the message-based interface was _40 times_ slower than ioctl#. NeXT's documentation in this area leaves a _great deal_ to be desired; the manual refers you to Egan & Teixeira for Unix-style drivers - but their book is about System V, not BSD, and of course doesn't mention NeXT's changes or anything about Mach. I've had to disassemble parts of the kernel numerous times; the latest real beauty was disassembling selwakeup() to find that it takes a thread *, not a proc * like it does in other BSD Unix systems. This one took a real long time and lots of stabs in the dark to find. Quite logical once you know about it, but it's documented _nowhere_. And kgdb is next to useless, because you can't depend on the info it gives you. I used it to single step a simple 'if' condition on an int in an interrupt routine and it stepped down the _wrong_ path, so I wasted a whole day until one of the hardware guys here suggested I put a printf on the line I _knew_ it wasn't getting to. I did so to prove he was wrong and found kgdb had lied to me. It always prints the values of local variables wrong too; although it seems to get parameters of a function and info registers right. We call it the Intel now. NeXT could not possibly have used it without noticing some ef these problems. Anyone else want to share their experiences?. regards, Graham %: The kernel server needs access to the kernel task port to vm_write the out-of-line data into its (the kernel server's) address space; and the only way it can get the kernel task port is if the user process sends it in; and the only way the user process can get it is via task_by_unix_pid with pid 0; and only the superuser can do that. Fixed in 3.0 though. #: On my NeXTstation color. Your milage may vary. -- Graham Stoney | "a Perl script is correct if it's halfway Flip Dibner fan club, "Hi Flip!" | readable and gets the job done before your Ph: +61 2 805-2909 Fax: -2929 | boss fires you." L. Wall & R. Schwartz
Technical Details
Message-ID:
<Bt3wKx.M2L@research.canon.oz.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!mama!greyhamReferences:
<1992Aug14.133748.29123@ni.umd.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!mama!greyham From: greyham@research.canon.oz.au (Graham Stoney) Subject: Re: Mach messaging to kernel server vs. "traditional" kernel drivers Message-ID: <Bt3wKx.M2L@research.canon.oz.au> Sender: news@research.canon.oz.au Organization: Canon Information Systems Research Australia References: <1992Aug14.133748.29123@ni.umd.edu> Date: Mon, 17 Aug 1992 02:36:32 GMT Lines: 47