p .Fa mtrrp is a pointer to one or more mtrr structures, as described below. The .Fa n argument is a pointer to an integer containing the number of structures pointed to by .Fa mtrrp . For .Fn x86_64_set_mtrr the integer pointed to by .Fa n will be updated to reflect the actual number of MTRRs successfully set. For .Fn x86_64_get_mtrr no more than .Fa n structures will be copied out, and the integer value pointed to by .Fa n will be updated to reflect the actual number of valid structures retrieved. A .Dv NULL argument to .Fa mtrrp will result in just the number of MTRRs available being returned in the integer pointed to by .Fa n .
p The argument .Fa mtrrp has the following structure: d -literal struct mtrr { uint64_t base; uint64_t len; uint8_t type; int flags; pid_t owner; }; .Ed
p The location of the mapping is described by its physical base address .Em base and length .Em len . Valid values for .Em type are:
p l -tag -offset indent -width MTRR_TYPE_UNDEF1 -compact t MTRR_TYPE_UC uncached memory t MTRR_TYPE_WC use write-combining t MTRR_TYPE_WT use write-through caching t MTRR_TYPE_WP write-protected memory t MTRR_TYPE_WB use write-back caching .El
p Valid values for .Em flags are:
p l -tag -offset indent -width MTRR_PRIVATE -compact t MTRR_PRIVATE own range, reset the MTRR when the current process exits t MTRR_FIXED use fixed range MTRR t MTRR_VALID entry is valid .El
p The .Em owner member is the PID of the user process which claims the mapping. It is only valid if MTRR_PRIVATE is set in .Em flags . To clear/reset MTRRs, use a .Em flags field without MTRR_VALID set. .Sh RETURN VALUES Upon successful completion zero is returned, otherwise -1 is returned on failure, and the global variable .Va errno is set to indicate the error. The integer value pointed to by .Fa n will contain the number of successfully processed mtrr structures in both cases. .Sh ERRORS l -tag -width [EINVAL] t Bq Er ENOSYS The currently running kernel or CPU has no MTRR support. t Bq Er EINVAL The currently running kernel has no MTRR support, or one of the mtrr structures pointed to by .Fa mtrrp is invalid. t Bq Er EBUSY No unused MTRRs are available. .El .Sh HISTORY The .Fn x86_64_get_mtrr and .Fn x86_64_set_mtrr were derived from their i386 counterparts, which appeared in .Nx 1.6 .