Page MenuHomeFreeBSD

Define a unified pmap structure for i386.
ClosedPublic

Authored by markj on Dec 21 2019, 3:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 9, 1:25 PM
Unknown Object (File)
Sun, Mar 31, 6:49 AM
Unknown Object (File)
Feb 18 2024, 10:27 AM
Unknown Object (File)
Jan 16 2024, 3:42 AM
Unknown Object (File)
Dec 20 2023, 8:21 AM
Unknown Object (File)
Dec 12 2023, 7:37 AM
Unknown Object (File)
Dec 2 2023, 5:22 PM
Unknown Object (File)
Dec 2 2023, 5:07 PM
Subscribers

Details

Summary

My aim is to fix the CTF type graph in the i386 kernel. The templating
of struct pmap results in three different definitions of struct pmap
among different compilation units. This means that any structure that
references struct pmap or pmap_t, such as vmspace or vm_map, gets
duplicated, and this results in a blow-up of the CTF type graph.

Re-unify the pmap definition using unions for fields that differ between
the PAE and non-PAE pmaps. This is not very pretty, but I think it is
easier to understand and removes the need to #define pmap.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

A different approach would be to define pmap_cpu_t to represent the CPU-specific pmap type, and use pmap_cpu_t instead of pmap_t in pmap.c. The dispatch functions in pmap_base.c would convert from pmap_t to pmap_cpu_t and we would just to cast the return value of vmspace_pmap() in the pmap_activate() implementation. This would result in a lot of churn but is a bit cleaner IMO.

Can pm_pdpt define moved to pmap_[no]pae.c (and pm_pdir as well, of course) ?

I remember that anon unions are not in C99, I think you can provide both kinds of pdir/pdpt always, same as ptdpg.

In D22896#505270, @kib wrote:

Can pm_pdpt define moved to pmap_[no]pae.c (and pm_pdir as well, of course) ?

Sure.

I remember that anon unions are not in C99, I think you can provide both kinds of pdir/pdpt always, same as ptdpg.

I always assumed it was fine to use C99 features; struct mbuf has contained an anonymous union for a long time.

In D22896#505270, @kib wrote:

I remember that anon unions are not in C99, I think you can provide both kinds of pdir/pdpt always, same as ptdpg.

I always assumed it was fine to use C99 features; struct mbuf has contained an anonymous union for a long time.

C99 sure, but anon unions are C11 or gnu99 feature.

Provide field definitions in pmap_(no)pae.c.
Do not provide pm_pdpt in the non-PAE pmap.
Avoid anonymous unions.

This revision is now accepted and ready to land.Jan 7 2020, 11:42 AM
This revision was automatically updated to reflect the committed changes.