Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

x86_64_get_mtrr(2) [netbsd man page]

X86_64_GET_MTRR(2)					  BSD/x86_64 System Calls Manual					X86_64_GET_MTRR(2)

NAME
x86_64_get_mtrr, x86_64_set_mtrr -- access Memory Type Range Registers LIBRARY
x86_64 Architecture Library (libx86_64, -lx86_64) SYNOPSIS
#include <sys/types.h> #include <machine/sysarch.h> #include <machine/mtrr.h> int x86_64_get_mtrr(struct mtrr *mtrrp, int *n); int x86_64_set_mtrr(struct mtrr *mtrrp, int *n); DESCRIPTION
These functions provide an interface to the MTRR registers found on 686-class processors for controlling processor access to memory ranges. This is most useful for accessing devices such as video accelerators on pci(4) and agp(4) buses. For example, enabling write-combining allows bus-write transfers to be combined into a larger transfer before bursting over the bus. This can increase performance of write opera- tions 2.5 times or more. mtrrp is a pointer to one or more mtrr structures, as described below. The n argument is a pointer to an integer containing the number of structures pointed to by mtrrp. For x86_64_set_mtrr() the integer pointed to by n will be updated to reflect the actual number of MTRRs suc- cessfully set. For x86_64_get_mtrr() no more than n structures will be copied out, and the integer value pointed to by n will be updated to reflect the actual number of valid structures retrieved. A NULL argument to mtrrp will result in just the number of MTRRs available being returned in the integer pointed to by n. The argument mtrrp has the following structure: struct mtrr { uint64_t base; uint64_t len; uint8_t type; int flags; pid_t owner; }; The location of the mapping is described by its physical base address base and length len. Valid values for type are: MTRR_TYPE_UC uncached memory MTRR_TYPE_WC use write-combining MTRR_TYPE_WT use write-through caching MTRR_TYPE_WP write-protected memory MTRR_TYPE_WB use write-back caching Valid values for flags are: MTRR_PRIVATE own range, reset the MTRR when the current process exits MTRR_FIXED use fixed range MTRR MTRR_VALID entry is valid The owner member is the PID of the user process which claims the mapping. It is only valid if MTRR_PRIVATE is set in flags. To clear/reset MTRRs, use a flags field without MTRR_VALID set. RETURN VALUES
Upon successful completion zero is returned, otherwise -1 is returned on failure, and the global variable errno is set to indicate the error. The integer value pointed to by n will contain the number of successfully processed mtrr structures in both cases. ERRORS
[ENOSYS] The currently running kernel or CPU has no MTRR support. [EINVAL] The currently running kernel has no MTRR support, or one of the mtrr structures pointed to by mtrrp is invalid. [EBUSY] No unused MTRRs are available. HISTORY
The x86_64_get_mtrr() and x86_64_set_mtrr() were derived from their i386 counterparts, which appeared in NetBSD 1.6. BSD
November 10, 2001 BSD

Check Out this Related Man Page

I386_PMC_INFO(2)					   BSD/i386 System Calls Manual 					  I386_PMC_INFO(2)

NAME
i386_pmc_info, i386_pmc_startstop, i386_pmc_read -- interface to CPU performance counters LIBRARY
i386 Architecture Library (libi386, -li386) SYNOPSIS
#include <sys/types.h> #include <machine/sysarch.h> #include <machine/specialreg.h> int i386_pmc_info(struct i386_pmc_info_args *ia); int i386_pmc_startstop(struct i386_pmc_startstop_args *ssa); int i386_pmc_read(struct i386_pmc_read_args *ra); DESCRIPTION
These functions provide an interface to the CPU performance counters on the 586-class and 686-class processors. i386_pmc_info() will return information about the available CPU counters. The information is returned in ia having the following structure: struct i386_pmc_info_args { int type; int flags; }; The type member describes the class of performance counters available. Valid values are: PMC_TYPE_NONE No PMC support PMC_TYPE_I586 586-class CPUs PMC_TYPE_I686 686-class Intel CPUs PMC_TYPE_K7 686-class AMD CPUs The flags member describes additional capabilities of the processor. Valid values are: PMC_INFO_HASTSC CPU has time-stamp counter i386_pmc_startstop() is used to start and stop the measurement of the CPU performance counters. The argument ssa has the following struc- ture: struct i386_pmc_startstop_args { int counter; uint64_t val; uint8_t event; uint8_t unit; uint8_t compare; uint8_t flags; }; The counter specified by the member counter is started if the member flags has PMC_SETUP_KERNEL or PMC_SETUP_USER set, otherwise the counter is stopped. The initial value of the counter is set to val. Additional values for the flags member are PMC_SETUP_EDGE and PMC_SETUP_INV. The event member specifies some event written to the control register. The unit member specifies the measurement units. The compare member is a mask for the counter. i386_pmc_read() will return information about a specific CPU counter measured during the last measurement period determined by the calling of i386_pmc_startstop(). The information is returned in ra having the following structure: struct i386_pmc_read_args { int counter; uint64_t val; uint64_t time; }; The counter to read should be specified by the counter member. Counters are numbered from 0 to PMC_NCOUNTERS. The value of the counter is returned in the val member. The time since epoch, measured in CPU clock cycles, is returned in the time member. RETURN VALUES
Upon successful completion zero is returned, otherwise -1 is returned on failure. BSD
November 10, 2001 BSD
Man Page