Page MenuHomeFreeBSD

Limit vm_memattr_t using parts to _KERNEL in arm64's pmap.h
Needs ReviewPublic

Authored by dim on May 27 2017, 2:30 PM.

Details

Reviewers
andrew
emaste
mmel
Summary

While building https://reviews.llvm.org/D32172, I found out that
including <vm/pmap.h> from userland on arm64 always leads to errors
about vm_page_t and vm_memattr_t being unknwn.

For example, the minimal program:

#include <sys/types.h>
#include <vm/pmap.h>

results in:

In file included from pmaptest.c:2:
In file included from /usr/include/vm/pmap.h:90:
/usr/include/machine/pmap.h:57:28: error: unknown type name 'vm_page_t'
void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma);
                           ^
/usr/include/machine/pmap.h:57:41: error: unknown type name
'vm_memattr_t'
void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma);
                                        ^
/usr/include/machine/pmap.h:66:2: error: unknown type name
'vm_memattr_t'
        vm_memattr_t            pv_memattr;
        ^
3 errors generated.

This is because <sys/types.h> only declares these types when _KERNEL
is defined.

To fix this, move the #endif /* _KERNEL */ in sys/arm64/include/pmap.h
a little bit lower. I don't think this will break any userland
programs, since they could never successfully compile this header
anyway.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 9529
Build 9978: arc lint + arc unit