home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!cs.utexas.edu!uwm.edu!spool.mu.edu!olivea!sgigate!odin!twilight!zuni!anchor!olson
- From: olson@anchor.esd.sgi.com (Dave Olson)
- Newsgroups: comp.sys.sgi
- Subject: Re: need /dev/kmem advice
- Message-ID: <pee0vpc@zuni.esd.sgi.com>
- Date: 4 Sep 92 18:23:59 GMT
- References: <Bu22JC.Hz5@mentor.cc.purdue.edu>
- Sender: news@zuni.esd.sgi.com (Net News)
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Lines: 41
-
- In <Bu22JC.Hz5@mentor.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
-
- | I am trying to port an existing application to an SGI work station,
- | running IRIX 4.0.5. The application uses nlist() to obtain kernel
- | addresses and reads kernel values via lseek() and read() calls on
- | a /dev/kmem descriptor. It's an open-file lister, ala ofiles or
- | fstat, that I call lsof.
- |
- | The nlist() works properly, but I have to strip the high order bit
- | (0x80000000) from the addresses it returns in order to avoid an EINVAL
- | from lseek(). If I do that, the values I get from read() seem correct.
- |
- | I've even deduced (I think) how to read the user area structure from
- | some hints in <sys/proc.h> and <sys/immu.h>. However, I can't find a
- | way to read the array of open file pointers, using the u_ofile pointer
- | in the user area. If I strip its high order bit, I get an ENXIO error
- | from read(). The address appears to be in the kernel stack -- e.g.,
- | 0xffffc808.
-
- The uarea, not the stack. Most SVR3 kernels put the file table
- at the end of the defined part of the user struct, but still part
- of the uarea; that allows changing the max # of open files per
- user without changing offsets in the uarea (it may even go back
- further to SVR2, I just don't remember)
-
- | So, two questions for the gurus of this news group.
- |
- | 1. Is stripping the high order bit from kernel addresses the right way
- | to use them via /dev/kmem?
-
- For the most part, yes.
-
- | 2. How does one read from addresses of form 0xffffc808?
-
- You have to read the uarea for that process, and the best
- way to do that is with the syssgi system call with SGI_RDUBLK.
- See 'man syssgi' for details.
- --
- Let no one tell me that silence gives consent, | Dave Olson
- because whoever is silent dissents. | Silicon Graphics, Inc.
- Maria Isabel Barreno | olson@sgi.com
-