Address spaces on a i386 - Getting Confused

Paul Sargent (Paul.Sargent@3dlabs.com)
Tue, 30 Mar 1999 11:35:39 +0100


Hi all,

I've been going through the 2.2.x source to try to get a handle on the
address spaces used in various circumstances.

As far as I can see there are probably three distinct address spaces used
(please correct me if I'm wrong)
* Kernel space Virtual Addresses
* User Space Virtual Addresses (1 address space per process)
* Physical (Bus) addresses

Now Physical Addresses I understand. As a PCI/AGP Board Designer they are
what I have to deal with all the time. My confusion starts when I look at
the virt-to-phys and phys-to-virt macros. These seem to just use the
PAGE_OFFSET constant (normally 0xC0000000) as a mask to map between to two
spaces. Now by my reckoning this would give a 1:1 virtual to physical memory
mapping, so why bother with virtual addresses.

Obviously I'm missing something, so I started trace trace through a read()
system call to see how the user space address of the read buffer was passed
to the kernel, and so remapped into kernel space. Unfortunatley from what I
can see, apart from an int 0x80 along the way (which I assume puts the
processor into a different operating mode), no address translation takes
place and copy_to_user() is just a straight copy.

Does anybody fancy explaining this to me? I should point out (if it's not
already obvious) I've been going through the i386 code.

I had a bit of a trawl through the archives and what documentaion I could
find. I understand everything I read, except nothing I read tells me what I
want to know.

Paul

P.S. I'm not subscribed to the list and I would appreciacte being cc'ed on
any response.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/