Port-powerpc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Segments
On Wed, 18 Nov 1998, Wolfgang Solfrank wrote:
[Me asking about segments, as they seem really goofy]
> If you run a PowerXXX processor with memory management enabled, every memory
> address gets translated. Since you might have some large contiguous region
> of memory that you want access to, segments allow this without loosing
> any entries in the page table and/or the tlb cache. Note that in order to
> access device registers, you _have_ to enable memory management.
I'm confused. I am puzzled by how segments are handled, the translation
which happens based on the upper nibble (4 bits) of the virtual address. I
think you're describing the BAT, the Block address translation if I got
the term right. They seem to cover large blocks of memory. They are, also,
one of the few things that make sense about PPC memory. :-)
> > Also, how does NetBSD, specifically macppc, handle segments?
>
> I'm not 100% sure how NetBSD/macppc handles this, but I think that it didn't
> change much from the NetBSD/ofppc (formerly NetBSD/powerpc) way of doing
> things:
>
> Basically, the segment registers are used to map all of the machines
> address space 1:1. (Since a segment register can map at most 256 MB and
> you have only 4 of them (usable to access data), this mapping has to be
> supported by a simple fault handler, but the assumption is, that you needn't
> access to that many regions anyway).
>
> The exception to this are two 256 MB regions. It is assumed that there is
> nothing behind these regions.
I thought we had 16 segment registers, one per VA nibble.
> One of those two regions is mapped normally via the page table and is used
> as kernel virtual memory. That is, it's used to access memory that cannot
> be accessed with its real address. E.g. the disk buffers, or memory that
> is malloc'ed within the kernel (this latter is due to the way kernel
> malloc works).
>
> The other region is used to access user memory. I.e. the 256 MB region
> of user memory the kernel needs access to is remapped into this region.
Hmm. Sounds like I need to grovvel through the code. :-(
> BTW, this latter thing implies that there is a difference between
> NetBSD/powerpc and most other ports: with NetBSD/powerpc the kernel
> doesn't occupy part of the available virtual address space, and thus
> with NetBSD/powerpc user programs see the full 4 GB address space (to be
> honest, the very last page isn't available to user programs. This is due
> to a bug in the vm system (at least the old mach vm, haven't had time to
> look into uvm, but since it's using the same pmap interface, I suspect
> it's the same in this respect)).
>
> If you need more info, feel free to ask.
Ok. I'm still a bit confused. :-)
I'll refine the question a bit. How are the mappings set up for a user
process, and for a kernel process (well, a process running in the kernel -
could be in a system call, etc)?
How does the 4GB virtual space look to a user process? Does it notice the
fact that it is made up of 16 256-MB segments?
I expect my question is still a little vague, and that's becase I'm still
vague on the conepts. :-)
Take care,
Bill
Home |
Main Index |
Thread Index |
Old Index