From: Chris Hafey (chafey@ecst.csuchico.edu)
Date: 06/30/93


From: chafey@ecst.csuchico.edu (Chris Hafey)
Subject: Kernel Mods and Memory Addressing
Date: 30 Jun 1993 23:19:34 GMT

Hello All.
  Thanks for the help on quad-word aligning of structures. I have run into
a few things which should be updated. First, the device structure in
net/inet/dev.h needs a dma channel field. Many network cards will use a dma
channel and this info should be kept in the dev structure (I think) right with
the irq and base address.
  Another thing is that I couldn't find a 16 bit out or in function. We have
outb and inb, but those are 8 bit functions. A simple addition of a inw and
outw follows:

include/asm/io.h

extern inline void outw(unsigned short value, unsigned short port)
{
__asm__ __volatile__ ("out %%ax,%%dx"
                ::"a" ((unsigned short) value),"d" ((unsigned short) port));
}

extern inline unsigned short inw(unsigned short port)
{
        unsigned short _v;
__asm__ __volatile__ ("in %%dx,%%ax"
                :"=a" (_v):"d" ((unsigned short) port),"0" (0));
        return _v;

  I have a question for the kernel gurus out there. I need the physical
address of a buffer in memory. Can I use the pointer returned from kmalloc,
or using the & operator? BSD has a function called (kvtop) which converts
a kernel virtual address to a physical address. Does linux have/need a
similar function? A brief summary of how physical memory/ linear memory /
kernel memory and virtual memory work together would be nice. I looked
through the LKHG, but couldn't find a refernce to physical memory in it.

 Thanks for the help!

Chris

-- 
Chris Hafey                      |  True programming is rebooting the machine
chafey@cscihp.ecst.csuchico.edu  |  after each crash until it works.