egs@killer.UUCP (Eric Schnoebelen) (06/18/88)
Hi. I need to allocate a particular piece of memory for a driver. The card has an onboard buffer in ROM space on the PC that the driver needs to be able to read and write. I assume I need to allocate a memory descriptor of some kind in the kernel to do this ( I have already gotten the segment violation panic without doing this ). The question is: How do I do this under Microport SysV/AT? What about under SysV/386 ( I plan on porting the driver real soon )? Any pointers would be useful. And I have read the runtime manual about adding device drivers, with no mention of a seemingly appropriate function. Thanks Eric Schnoebelen John W. Bridges & Assoc., Inc Lewisville, Tx ...!killer!u-word!egs
bowles@lll-crg.llnl.gov (Jeff Bowles) (06/20/88)
In article <4490@killer.UUCP> egs@killer.UUCP (Eric Schnoebelen) writes: > I need to allocate a particular piece of memory for a driver. The >card has an onboard buffer in ROM space on the PC that the driver needs to >be able to read and write.... #include <sys/types.h> #include <sys/errno.h> #include <sys/param.h> #include <sys/dir.h> #include <sys/immu.h> #include <sys/file.h> #include <sys/region.h> #include <sys/proc.h> #include <sys/signal.h> #include <sys/sysmacros.h> #include <sys/stream.h> #include <sys/strlog.h> #include <sys/stropts.h> #include <sys/user.h> #include <sys/errno.h> #include <sys/cmn_err.h> { char *p = (struct cmm_regs *)sptalloc( btoc(WORKSIZE), PG_RW | PG_P , pfnum(BOARDADDR), 0); ********************************** For me, this worked on the Bell Tech Unix SVR3; I believe it's consistent with all things ported from the 3B2 - BOARDADDR in this case was something like 0xE00000 and WORKSIZE was something like 8192, but I don't remember. You can guess the arguments - "I need a workspace of size <arg1> in clicks to be mapped into kernel space with permissions RW (read/write) and P (present). The address is page frame number <pfnum(<arg3>. I don't know about the last arg." Jeff Bowles